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_data *td, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 td->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 == td->o.bssplit_nr[ddir]) {
88 td->o.bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, td->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, td)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 td->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 < td->o.bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -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 for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 td->o.min_bs[ddir] = min_bs;
155 td->o.max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 td->o.bssplit[ddir] = bssplit;
166 static int str_bssplit_cb(void *data, const char *input)
168 struct thread_data *td = data;
169 char *str, *p, *odir, *ddir;
172 p = str = strdup(input);
174 strip_blank_front(&str);
175 strip_blank_end(str);
177 odir = strchr(str, ',');
179 ddir = strchr(odir + 1, ',');
181 ret = bssplit_ddir(td, DDIR_TRIM, ddir + 1);
187 op = strdup(odir + 1);
188 ret = bssplit_ddir(td, DDIR_TRIM, op);
193 ret = bssplit_ddir(td, DDIR_WRITE, odir + 1);
196 ret = bssplit_ddir(td, DDIR_READ, str);
202 ret = bssplit_ddir(td, DDIR_WRITE, op);
207 ret = bssplit_ddir(td, DDIR_TRIM, op);
210 ret = bssplit_ddir(td, DDIR_READ, str);
217 static int str2error(char *str)
219 const char * err[] = {"EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
220 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
221 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
222 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
223 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
224 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
225 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
226 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE"};
227 int i = 0, num = sizeof(err) / sizeof(void *);
230 if (!strcmp(err[i], str))
237 static int ignore_error_type(struct thread_data *td, int etype, char *str)
243 if (etype >= ERROR_TYPE_CNT) {
244 log_err("Illegal error type\n");
248 td->o.ignore_error_nr[etype] = 4;
249 error = malloc(4 * sizeof(struct bssplit));
252 while ((fname = strsep(&str, ":")) != NULL) {
258 * grow struct buffer, if needed
260 if (i == td->o.ignore_error_nr[etype]) {
261 td->o.ignore_error_nr[etype] <<= 1;
262 error = realloc(error, td->o.ignore_error_nr[etype]
265 if (fname[0] == 'E') {
266 error[i] = str2error(fname);
268 error[i] = atoi(fname);
273 log_err("Unknown error %s, please use number value \n",
280 td->o.continue_on_error |= 1 << etype;
281 td->o.ignore_error_nr[etype] = i;
282 td->o.ignore_error[etype] = error;
288 static int str_ignore_error_cb(void *data, const char *input)
290 struct thread_data *td = data;
292 int type = 0, ret = 1;
293 p = str = strdup(input);
295 strip_blank_front(&str);
296 strip_blank_end(str);
302 ret = ignore_error_type(td, type, p);
312 static int str_rw_cb(void *data, const char *str)
314 struct thread_data *td = data;
315 char *nr = get_opt_postfix(str);
317 td->o.ddir_seq_nr = 1;
318 td->o.ddir_seq_add = 0;
324 td->o.ddir_seq_nr = atoi(nr);
328 if (str_to_decimal(nr, &val, 1, td)) {
329 log_err("fio: rw postfix parsing failed\n");
334 td->o.ddir_seq_add = val;
341 static int str_mem_cb(void *data, const char *mem)
343 struct thread_data *td = data;
345 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
346 td->mmapfile = get_opt_postfix(mem);
351 static int str_verify_cb(void *data, const char *mem)
353 struct thread_data *td = data;
355 if (td->o.verify == VERIFY_CRC32C_INTEL ||
356 td->o.verify == VERIFY_CRC32C) {
357 crc32c_intel_probe();
363 static int fio_clock_source_cb(void *data, const char *str)
365 struct thread_data *td = data;
367 fio_clock_source = td->o.clocksource;
368 fio_clock_source_set = 1;
373 static int str_rwmix_read_cb(void *data, unsigned long long *val)
375 struct thread_data *td = data;
377 td->o.rwmix[DDIR_READ] = *val;
378 td->o.rwmix[DDIR_WRITE] = 100 - *val;
382 static int str_rwmix_write_cb(void *data, unsigned long long *val)
384 struct thread_data *td = data;
386 td->o.rwmix[DDIR_WRITE] = *val;
387 td->o.rwmix[DDIR_READ] = 100 - *val;
391 #ifdef FIO_HAVE_IOPRIO
392 static int str_prioclass_cb(void *data, unsigned long long *val)
394 struct thread_data *td = data;
398 * mask off old class bits, str_prio_cb() may have set a default class
400 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
403 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
408 static int str_prio_cb(void *data, unsigned long long *val)
410 struct thread_data *td = data;
415 * If no class is set, assume BE
417 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
418 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
425 static int str_exitall_cb(void)
427 exitall_on_terminate = 1;
431 #ifdef FIO_HAVE_CPU_AFFINITY
432 static int str_cpumask_cb(void *data, unsigned long long *val)
434 struct thread_data *td = data;
439 ret = fio_cpuset_init(&td->o.cpumask);
441 log_err("fio: cpuset_init failed\n");
442 td_verror(td, ret, "fio_cpuset_init");
446 max_cpu = cpus_online();
448 for (i = 0; i < sizeof(int) * 8; i++) {
449 if ((1 << i) & *val) {
451 log_err("fio: CPU %d too large (max=%ld)\n", i,
455 dprint(FD_PARSE, "set cpu allowed %d\n", i);
456 fio_cpu_set(&td->o.cpumask, i);
460 td->o.cpumask_set = 1;
464 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
471 ret = fio_cpuset_init(mask);
473 log_err("fio: cpuset_init failed\n");
474 td_verror(td, ret, "fio_cpuset_init");
478 p = str = strdup(input);
480 strip_blank_front(&str);
481 strip_blank_end(str);
483 max_cpu = cpus_online();
485 while ((cpu = strsep(&str, ",")) != NULL) {
494 while ((cpu2 = strsep(&str2, "-")) != NULL) {
504 while (icpu <= icpu2) {
505 if (icpu >= FIO_MAX_CPUS) {
506 log_err("fio: your OS only supports up to"
507 " %d CPUs\n", (int) FIO_MAX_CPUS);
511 if (icpu > max_cpu) {
512 log_err("fio: CPU %d too large (max=%ld)\n",
518 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
519 fio_cpu_set(mask, icpu);
528 td->o.cpumask_set = 1;
532 static int str_cpus_allowed_cb(void *data, const char *input)
534 struct thread_data *td = data;
537 ret = set_cpus_allowed(td, &td->o.cpumask, input);
539 td->o.cpumask_set = 1;
544 static int str_verify_cpus_allowed_cb(void *data, const char *input)
546 struct thread_data *td = data;
549 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
551 td->o.verify_cpumask_set = 1;
557 #ifdef CONFIG_LIBNUMA
558 static int str_numa_cpunodes_cb(void *data, char *input)
560 struct thread_data *td = data;
562 /* numa_parse_nodestring() parses a character string list
563 * of nodes into a bit mask. The bit mask is allocated by
564 * numa_allocate_nodemask(), so it should be freed by
565 * numa_free_nodemask().
567 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
568 if (td->o.numa_cpunodesmask == NULL) {
569 log_err("fio: numa_parse_nodestring failed\n");
570 td_verror(td, 1, "str_numa_cpunodes_cb");
574 td->o.numa_cpumask_set = 1;
578 static int str_numa_mpol_cb(void *data, char *input)
580 struct thread_data *td = data;
581 const char * const policy_types[] =
582 { "default", "prefer", "bind", "interleave", "local" };
585 char *nodelist = strchr(input, ':');
587 /* NUL-terminate mode */
591 for (i = 0; i <= MPOL_LOCAL; i++) {
592 if (!strcmp(input, policy_types[i])) {
593 td->o.numa_mem_mode = i;
597 if (i > MPOL_LOCAL) {
598 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
602 switch (td->o.numa_mem_mode) {
605 * Insist on a nodelist of one node only
608 char *rest = nodelist;
609 while (isdigit(*rest))
612 log_err("fio: one node only for \'prefer\'\n");
616 log_err("fio: one node is needed for \'prefer\'\n");
620 case MPOL_INTERLEAVE:
622 * Default to online nodes with memory if no nodelist
625 nodelist = strdup("all");
630 * Don't allow a nodelist
633 log_err("fio: NO nodelist for \'local\'\n");
639 * Insist on a nodelist
642 log_err("fio: a nodelist is needed for \'bind\'\n");
649 /* numa_parse_nodestring() parses a character string list
650 * of nodes into a bit mask. The bit mask is allocated by
651 * numa_allocate_nodemask(), so it should be freed by
652 * numa_free_nodemask().
654 switch (td->o.numa_mem_mode) {
656 td->o.numa_mem_prefer_node = atoi(nodelist);
658 case MPOL_INTERLEAVE:
660 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
661 if (td->o.numa_memnodesmask == NULL) {
662 log_err("fio: numa_parse_nodestring failed\n");
663 td_verror(td, 1, "str_numa_memnodes_cb");
673 td->o.numa_memmask_set = 1;
681 static int str_fst_cb(void *data, const char *str)
683 struct thread_data *td = data;
684 char *nr = get_opt_postfix(str);
686 td->file_service_nr = 1;
688 td->file_service_nr = atoi(nr);
695 #ifdef CONFIG_SYNC_FILE_RANGE
696 static int str_sfr_cb(void *data, const char *str)
698 struct thread_data *td = data;
699 char *nr = get_opt_postfix(str);
701 td->sync_file_range_nr = 1;
703 td->sync_file_range_nr = atoi(nr);
711 static int str_random_distribution_cb(void *data, const char *str)
713 struct thread_data *td = data;
717 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
719 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
724 nr = get_opt_postfix(str);
725 if (nr && !str_to_float(nr, &val)) {
726 log_err("fio: random postfix parsing failed\n");
733 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
735 log_err("fio: zipf theta must different than 1.0\n");
738 td->o.zipf_theta = val;
740 if (val <= 0.00 || val >= 1.00) {
741 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
744 td->o.pareto_h = val;
750 static int check_dir(struct thread_data *td, char *fname)
753 char file[PATH_MAX], *dir;
756 if (td->o.directory) {
757 strcpy(file, td->o.directory);
762 sprintf(file + elen, "%s", fname);
768 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
769 * yet, so we can't do this check right here...
771 if (lstat(dir, &sb) < 0) {
774 log_err("fio: %s is not a directory\n", dir);
775 td_verror(td, ret, "lstat");
779 if (!S_ISDIR(sb.st_mode)) {
780 log_err("fio: %s is not a directory\n", dir);
790 * Return next file in the string. Files are separated with ':'. If the ':'
791 * is escaped with a '\', then that ':' is part of the filename and does not
792 * indicate a new file.
794 static char *get_next_file_name(char **ptr)
799 if (!str || !strlen(str))
805 * No colon, we are done
807 p = strchr(str, ':');
814 * We got a colon, but it's the first character. Skip and
822 if (*(p - 1) != '\\') {
828 memmove(p - 1, p, strlen(p) + 1);
835 static int str_filename_cb(void *data, const char *input)
837 struct thread_data *td = data;
838 char *fname, *str, *p;
840 p = str = strdup(input);
842 strip_blank_front(&str);
843 strip_blank_end(str);
845 if (!td->files_index)
848 while ((fname = get_next_file_name(&str)) != NULL) {
851 if (check_dir(td, fname)) {
863 static int str_directory_cb(void *data, const char fio_unused *str)
865 struct thread_data *td = data;
868 if (lstat(td->o.directory, &sb) < 0) {
871 log_err("fio: %s is not a directory\n", td->o.directory);
872 td_verror(td, ret, "lstat");
875 if (!S_ISDIR(sb.st_mode)) {
876 log_err("fio: %s is not a directory\n", td->o.directory);
883 static int str_opendir_cb(void *data, const char fio_unused *str)
885 struct thread_data *td = data;
887 if (!td->files_index)
890 return add_dir_files(td, td->o.opendir);
893 static int str_verify_offset_cb(void *data, unsigned long long *off)
895 struct thread_data *td = data;
897 if (*off && *off < sizeof(struct verify_header)) {
898 log_err("fio: verify_offset too small\n");
902 td->o.verify_offset = *off;
906 static int str_verify_pattern_cb(void *data, const char *input)
908 struct thread_data *td = data;
910 int i = 0, j = 0, len, k, base = 10;
913 loc1 = strstr(input, "0x");
914 loc2 = strstr(input, "0X");
917 off = strtol(input, NULL, base);
918 if (off != LONG_MAX || errno != ERANGE) {
920 td->o.verify_pattern[i] = off & 0xff;
929 j = loc1 - input + 2;
931 j = loc2 - input + 2;
934 if (len - j < MAX_PATTERN_SIZE * 2) {
936 off = converthexchartoint(input[k--]);
938 off += (converthexchartoint(input[k--])
940 td->o.verify_pattern[i++] = (char) off;
946 * Fill the pattern all the way to the end. This greatly reduces
947 * the number of memcpy's we have to do when verifying the IO.
949 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
950 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
955 * The code in verify_io_u_pattern assumes a single byte pattern
956 * fills the whole verify pattern buffer.
958 memset(td->o.verify_pattern, td->o.verify_pattern[0],
962 td->o.verify_pattern_bytes = i;
965 * VERIFY_META could already be set
967 if (td->o.verify == VERIFY_NONE)
968 td->o.verify = VERIFY_PATTERN;
973 static int str_write_bw_log_cb(void *data, const char *str)
975 struct thread_data *td = data;
978 td->o.bw_log_file = strdup(str);
980 td->o.write_bw_log = 1;
984 static int str_write_lat_log_cb(void *data, const char *str)
986 struct thread_data *td = data;
989 td->o.lat_log_file = strdup(str);
991 td->o.write_lat_log = 1;
995 static int str_write_iops_log_cb(void *data, const char *str)
997 struct thread_data *td = data;
1000 td->o.iops_log_file = strdup(str);
1002 td->o.write_iops_log = 1;
1006 static int str_gtod_reduce_cb(void *data, int *il)
1008 struct thread_data *td = data;
1011 td->o.disable_lat = !!val;
1012 td->o.disable_clat = !!val;
1013 td->o.disable_slat = !!val;
1014 td->o.disable_bw = !!val;
1015 td->o.clat_percentiles = !val;
1017 td->tv_cache_mask = 63;
1022 static int str_gtod_cpu_cb(void *data, long long *il)
1024 struct thread_data *td = data;
1027 td->o.gtod_cpu = val;
1028 td->o.gtod_offload = 1;
1032 static int str_size_cb(void *data, unsigned long long *__val)
1034 struct thread_data *td = data;
1035 unsigned long long v = *__val;
1037 if (parse_is_percent(v)) {
1039 td->o.size_percent = -1ULL - v;
1046 static int rw_verify(struct fio_option *o, void *data)
1048 struct thread_data *td = data;
1050 if (read_only && td_write(td)) {
1051 log_err("fio: job <%s> has write bit set, but fio is in"
1052 " read-only mode\n", td->o.name);
1059 static int gtod_cpu_verify(struct fio_option *o, void *data)
1061 #ifndef FIO_HAVE_CPU_AFFINITY
1062 struct thread_data *td = data;
1064 if (td->o.gtod_cpu) {
1065 log_err("fio: platform must support CPU affinity for"
1066 "gettimeofday() offloading\n");
1077 static struct opt_group fio_opt_groups[] = {
1080 .mask = FIO_OPT_C_GENERAL,
1084 .mask = FIO_OPT_C_IO,
1088 .mask = FIO_OPT_C_FILE,
1091 .name = "Statistics",
1092 .mask = FIO_OPT_C_STAT,
1096 .mask = FIO_OPT_C_LOG,
1100 .mask = FIO_OPT_C_PROFILE,
1107 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1108 unsigned int inv_mask)
1110 struct opt_group *og;
1113 if (*mask == inv_mask || !*mask)
1116 for (i = 0; ogs[i].name; i++) {
1119 if (*mask & og->mask) {
1120 *mask &= ~(og->mask);
1128 struct opt_group *opt_group_from_mask(unsigned int *mask)
1130 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1133 static struct opt_group fio_opt_cat_groups[] = {
1136 .mask = FIO_OPT_G_RATE,
1140 .mask = FIO_OPT_G_ZONE,
1143 .name = "Read/write mix",
1144 .mask = FIO_OPT_G_RWMIX,
1148 .mask = FIO_OPT_G_VERIFY,
1152 .mask = FIO_OPT_G_TRIM,
1155 .name = "I/O Logging",
1156 .mask = FIO_OPT_G_IOLOG,
1159 .name = "I/O Depth",
1160 .mask = FIO_OPT_G_IO_DEPTH,
1164 .mask = FIO_OPT_G_IO_FLOW,
1167 .name = "Description",
1168 .mask = FIO_OPT_G_DESC,
1172 .mask = FIO_OPT_G_FILENAME,
1175 .name = "General I/O",
1176 .mask = FIO_OPT_G_IO_BASIC,
1180 .mask = FIO_OPT_G_CGROUP,
1184 .mask = FIO_OPT_G_RUNTIME,
1188 .mask = FIO_OPT_G_PROCESS,
1191 .name = "Job credentials / priority",
1192 .mask = FIO_OPT_G_CRED,
1195 .name = "Clock settings",
1196 .mask = FIO_OPT_G_CLOCK,
1200 .mask = FIO_OPT_G_IO_TYPE,
1203 .name = "I/O Thinktime",
1204 .mask = FIO_OPT_G_THINKTIME,
1207 .name = "Randomizations",
1208 .mask = FIO_OPT_G_RANDOM,
1211 .name = "I/O buffers",
1212 .mask = FIO_OPT_G_IO_BUF,
1215 .name = "Tiobench profile",
1216 .mask = FIO_OPT_G_TIOBENCH,
1224 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1226 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1230 * Map of job/command line options
1232 static struct fio_option fio_options[FIO_MAX_OPTS] = {
1234 .name = "description",
1235 .lname = "Description of job",
1236 .type = FIO_OPT_STR_STORE,
1237 .off1 = td_var_offset(description),
1238 .help = "Text job description",
1239 .category = FIO_OPT_C_GENERAL,
1240 .group = FIO_OPT_G_DESC,
1244 .lname = "Job name",
1245 .type = FIO_OPT_STR_STORE,
1246 .off1 = td_var_offset(name),
1247 .help = "Name of this job",
1248 .category = FIO_OPT_C_GENERAL,
1249 .group = FIO_OPT_G_DESC,
1253 .lname = "Filename(s)",
1254 .type = FIO_OPT_STR_STORE,
1255 .off1 = td_var_offset(filename),
1256 .cb = str_filename_cb,
1257 .prio = -1, /* must come after "directory" */
1258 .help = "File(s) to use for the workload",
1259 .category = FIO_OPT_C_FILE,
1260 .group = FIO_OPT_G_FILENAME,
1263 .name = "directory",
1264 .lname = "Directory",
1265 .type = FIO_OPT_STR_STORE,
1266 .off1 = td_var_offset(directory),
1267 .cb = str_directory_cb,
1268 .help = "Directory to store files in",
1269 .category = FIO_OPT_C_FILE,
1270 .group = FIO_OPT_G_FILENAME,
1273 .name = "filename_format",
1274 .type = FIO_OPT_STR_STORE,
1275 .off1 = td_var_offset(filename_format),
1276 .prio = -1, /* must come after "directory" */
1277 .help = "Override default $jobname.$jobnum.$filenum naming",
1278 .def = "$jobname.$jobnum.$filenum",
1279 .category = FIO_OPT_C_FILE,
1280 .group = FIO_OPT_G_FILENAME,
1284 .lname = "Lockfile",
1285 .type = FIO_OPT_STR,
1286 .off1 = td_var_offset(file_lock_mode),
1287 .help = "Lock file when doing IO to it",
1288 .parent = "filename",
1291 .category = FIO_OPT_C_FILE,
1292 .group = FIO_OPT_G_FILENAME,
1295 .oval = FILE_LOCK_NONE,
1296 .help = "No file locking",
1298 { .ival = "exclusive",
1299 .oval = FILE_LOCK_EXCLUSIVE,
1300 .help = "Exclusive file lock",
1303 .ival = "readwrite",
1304 .oval = FILE_LOCK_READWRITE,
1305 .help = "Read vs write lock",
1311 .lname = "Open directory",
1312 .type = FIO_OPT_STR_STORE,
1313 .off1 = td_var_offset(opendir),
1314 .cb = str_opendir_cb,
1315 .help = "Recursively add files from this directory and down",
1316 .category = FIO_OPT_C_FILE,
1317 .group = FIO_OPT_G_FILENAME,
1321 .lname = "Read/write",
1322 .alias = "readwrite",
1323 .type = FIO_OPT_STR,
1325 .off1 = td_var_offset(td_ddir),
1326 .help = "IO direction",
1328 .verify = rw_verify,
1329 .category = FIO_OPT_C_IO,
1330 .group = FIO_OPT_G_IO_BASIC,
1333 .oval = TD_DDIR_READ,
1334 .help = "Sequential read",
1337 .oval = TD_DDIR_WRITE,
1338 .help = "Sequential write",
1341 .oval = TD_DDIR_TRIM,
1342 .help = "Sequential trim",
1344 { .ival = "randread",
1345 .oval = TD_DDIR_RANDREAD,
1346 .help = "Random read",
1348 { .ival = "randwrite",
1349 .oval = TD_DDIR_RANDWRITE,
1350 .help = "Random write",
1352 { .ival = "randtrim",
1353 .oval = TD_DDIR_RANDTRIM,
1354 .help = "Random trim",
1358 .help = "Sequential read and write mix",
1360 { .ival = "readwrite",
1362 .help = "Sequential read and write mix",
1365 .oval = TD_DDIR_RANDRW,
1366 .help = "Random read and write mix"
1371 .name = "rw_sequencer",
1372 .lname = "RW Sequencer",
1373 .type = FIO_OPT_STR,
1374 .off1 = td_var_offset(rw_seq),
1375 .help = "IO offset generator modifier",
1376 .def = "sequential",
1377 .category = FIO_OPT_C_IO,
1378 .group = FIO_OPT_G_IO_BASIC,
1380 { .ival = "sequential",
1382 .help = "Generate sequential offsets",
1384 { .ival = "identical",
1385 .oval = RW_SEQ_IDENT,
1386 .help = "Generate identical offsets",
1393 .lname = "IO Engine",
1394 .type = FIO_OPT_STR_STORE,
1395 .off1 = td_var_offset(ioengine),
1396 .help = "IO engine to use",
1397 .def = FIO_PREFERRED_ENGINE,
1398 .category = FIO_OPT_C_IO,
1399 .group = FIO_OPT_G_IO_BASIC,
1402 .help = "Use read/write",
1405 .help = "Use pread/pwrite",
1408 .help = "Use readv/writev",
1410 #ifdef CONFIG_LIBAIO
1412 .help = "Linux native asynchronous IO",
1415 #ifdef CONFIG_POSIXAIO
1416 { .ival = "posixaio",
1417 .help = "POSIX asynchronous IO",
1420 #ifdef CONFIG_SOLARISAIO
1421 { .ival = "solarisaio",
1422 .help = "Solaris native asynchronous IO",
1425 #ifdef CONFIG_WINDOWSAIO
1426 { .ival = "windowsaio",
1427 .help = "Windows native asynchronous IO"
1431 .help = "Memory mapped IO"
1433 #ifdef CONFIG_LINUX_SPLICE
1435 .help = "splice/vmsplice based IO",
1437 { .ival = "netsplice",
1438 .help = "splice/vmsplice to/from the network",
1441 #ifdef FIO_HAVE_SGIO
1443 .help = "SCSI generic v3 IO",
1447 .help = "Testing engine (no data transfer)",
1450 .help = "Network IO",
1453 .help = "CPU cycle burner engine",
1457 .help = "GUASI IO engine",
1460 #ifdef FIO_HAVE_BINJECT
1461 { .ival = "binject",
1462 .help = "binject direct inject block engine",
1467 .help = "RDMA IO engine",
1470 #ifdef CONFIG_FUSION_AW
1471 { .ival = "fusion-aw-sync",
1472 .help = "Fusion-io atomic write engine",
1475 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1476 { .ival = "e4defrag",
1477 .help = "ext4 defrag engine",
1480 #ifdef CONFIG_LINUX_FALLOCATE
1482 .help = "fallocate() file based engine",
1485 { .ival = "external",
1486 .help = "Load external engine (append name)",
1492 .lname = "IO Depth",
1493 .type = FIO_OPT_INT,
1494 .off1 = td_var_offset(iodepth),
1495 .help = "Number of IO buffers to keep in flight",
1499 .category = FIO_OPT_C_IO,
1500 .group = FIO_OPT_G_IO_BASIC,
1503 .name = "iodepth_batch",
1504 .lname = "IO Depth batch",
1505 .alias = "iodepth_batch_submit",
1506 .type = FIO_OPT_INT,
1507 .off1 = td_var_offset(iodepth_batch),
1508 .help = "Number of IO buffers to submit in one go",
1509 .parent = "iodepth",
1514 .category = FIO_OPT_C_IO,
1515 .group = FIO_OPT_G_IO_BASIC,
1518 .name = "iodepth_batch_complete",
1519 .lname = "IO Depth batch complete",
1520 .type = FIO_OPT_INT,
1521 .off1 = td_var_offset(iodepth_batch_complete),
1522 .help = "Number of IO buffers to retrieve in one go",
1523 .parent = "iodepth",
1528 .category = FIO_OPT_C_IO,
1529 .group = FIO_OPT_G_IO_BASIC,
1532 .name = "iodepth_low",
1533 .lname = "IO Depth batch low",
1534 .type = FIO_OPT_INT,
1535 .off1 = td_var_offset(iodepth_low),
1536 .help = "Low water mark for queuing depth",
1537 .parent = "iodepth",
1540 .category = FIO_OPT_C_IO,
1541 .group = FIO_OPT_G_IO_BASIC,
1546 .type = FIO_OPT_STR_VAL,
1548 .help = "Total size of device or files",
1549 .interval = 1024 * 1024,
1550 .category = FIO_OPT_C_IO,
1551 .group = FIO_OPT_G_INVALID,
1554 .name = "fill_device",
1555 .lname = "Fill device",
1557 .type = FIO_OPT_BOOL,
1558 .off1 = td_var_offset(fill_device),
1559 .help = "Write until an ENOSPC error occurs",
1561 .category = FIO_OPT_C_FILE,
1562 .group = FIO_OPT_G_INVALID,
1566 .lname = "File size",
1567 .type = FIO_OPT_STR_VAL,
1568 .off1 = td_var_offset(file_size_low),
1569 .off2 = td_var_offset(file_size_high),
1571 .help = "Size of individual files",
1572 .interval = 1024 * 1024,
1573 .category = FIO_OPT_C_FILE,
1574 .group = FIO_OPT_G_INVALID,
1578 .lname = "IO offset",
1579 .alias = "fileoffset",
1580 .type = FIO_OPT_STR_VAL,
1581 .off1 = td_var_offset(start_offset),
1582 .help = "Start IO from this offset",
1584 .interval = 1024 * 1024,
1585 .category = FIO_OPT_C_IO,
1586 .group = FIO_OPT_G_INVALID,
1589 .name = "offset_increment",
1590 .lname = "IO offset increment",
1591 .type = FIO_OPT_STR_VAL,
1592 .off1 = td_var_offset(offset_increment),
1593 .help = "What is the increment from one offset to the next",
1597 .interval = 1024 * 1024,
1598 .category = FIO_OPT_C_IO,
1599 .group = FIO_OPT_G_INVALID,
1603 .lname = "Block size",
1604 .alias = "blocksize",
1605 .type = FIO_OPT_INT,
1606 .off1 = td_var_offset(bs[DDIR_READ]),
1607 .off2 = td_var_offset(bs[DDIR_WRITE]),
1608 .off3 = td_var_offset(bs[DDIR_TRIM]),
1610 .help = "Block size unit",
1615 .category = FIO_OPT_C_IO,
1616 .group = FIO_OPT_G_INVALID,
1620 .lname = "Block size align",
1621 .alias = "blockalign",
1622 .type = FIO_OPT_INT,
1623 .off1 = td_var_offset(ba[DDIR_READ]),
1624 .off2 = td_var_offset(ba[DDIR_WRITE]),
1625 .off3 = td_var_offset(ba[DDIR_TRIM]),
1627 .help = "IO block offset alignment",
1631 .category = FIO_OPT_C_IO,
1632 .group = FIO_OPT_G_INVALID,
1636 .lname = "Block size range",
1637 .alias = "blocksize_range",
1638 .type = FIO_OPT_RANGE,
1639 .off1 = td_var_offset(min_bs[DDIR_READ]),
1640 .off2 = td_var_offset(max_bs[DDIR_READ]),
1641 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1642 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1643 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1644 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1646 .help = "Set block size range (in more detail than bs)",
1650 .category = FIO_OPT_C_IO,
1651 .group = FIO_OPT_G_INVALID,
1655 .lname = "Block size split",
1656 .type = FIO_OPT_STR,
1657 .cb = str_bssplit_cb,
1658 .help = "Set a specific mix of block sizes",
1661 .category = FIO_OPT_C_IO,
1662 .group = FIO_OPT_G_INVALID,
1665 .name = "bs_unaligned",
1666 .lname = "Block size unaligned",
1667 .alias = "blocksize_unaligned",
1668 .type = FIO_OPT_STR_SET,
1669 .off1 = td_var_offset(bs_unaligned),
1670 .help = "Don't sector align IO buffer sizes",
1673 .category = FIO_OPT_C_IO,
1674 .group = FIO_OPT_G_INVALID,
1677 .name = "randrepeat",
1678 .lname = "Random repeatable",
1679 .type = FIO_OPT_BOOL,
1680 .off1 = td_var_offset(rand_repeatable),
1681 .help = "Use repeatable random IO pattern",
1685 .category = FIO_OPT_C_IO,
1686 .group = FIO_OPT_G_RANDOM,
1689 .name = "use_os_rand",
1690 .lname = "Use OS random",
1691 .type = FIO_OPT_BOOL,
1692 .off1 = td_var_offset(use_os_rand),
1693 .help = "Set to use OS random generator",
1697 .category = FIO_OPT_C_IO,
1698 .group = FIO_OPT_G_RANDOM,
1701 .name = "norandommap",
1702 .lname = "No randommap",
1703 .type = FIO_OPT_STR_SET,
1704 .off1 = td_var_offset(norandommap),
1705 .help = "Accept potential duplicate random blocks",
1709 .category = FIO_OPT_C_IO,
1710 .group = FIO_OPT_G_RANDOM,
1713 .name = "softrandommap",
1714 .lname = "Soft randommap",
1715 .type = FIO_OPT_BOOL,
1716 .off1 = td_var_offset(softrandommap),
1717 .help = "Set norandommap if randommap allocation fails",
1718 .parent = "norandommap",
1721 .category = FIO_OPT_C_IO,
1722 .group = FIO_OPT_G_RANDOM,
1725 .name = "random_generator",
1726 .type = FIO_OPT_STR,
1727 .off1 = td_var_offset(random_generator),
1728 .help = "Type of random number generator to use",
1729 .def = "tausworthe",
1731 { .ival = "tausworthe",
1732 .oval = FIO_RAND_GEN_TAUSWORTHE,
1733 .help = "Strong Tausworthe generator",
1736 .oval = FIO_RAND_GEN_LFSR,
1737 .help = "Variable length LFSR",
1740 .category = FIO_OPT_C_IO,
1741 .group = FIO_OPT_G_RANDOM,
1744 .name = "random_distribution",
1745 .type = FIO_OPT_STR,
1746 .off1 = td_var_offset(random_distribution),
1747 .cb = str_random_distribution_cb,
1748 .help = "Random offset distribution generator",
1752 .oval = FIO_RAND_DIST_RANDOM,
1753 .help = "Completely random",
1756 .oval = FIO_RAND_DIST_ZIPF,
1757 .help = "Zipf distribution",
1760 .oval = FIO_RAND_DIST_PARETO,
1761 .help = "Pareto distribution",
1764 .category = FIO_OPT_C_IO,
1765 .group = FIO_OPT_G_RANDOM,
1769 .lname = "Number of files",
1770 .alias = "nr_files",
1771 .type = FIO_OPT_INT,
1772 .off1 = td_var_offset(nr_files),
1773 .help = "Split job workload between this number of files",
1776 .category = FIO_OPT_C_FILE,
1777 .group = FIO_OPT_G_INVALID,
1780 .name = "openfiles",
1781 .lname = "Number of open files",
1782 .type = FIO_OPT_INT,
1783 .off1 = td_var_offset(open_files),
1784 .help = "Number of files to keep open at the same time",
1785 .category = FIO_OPT_C_FILE,
1786 .group = FIO_OPT_G_INVALID,
1789 .name = "file_service_type",
1790 .lname = "File service type",
1791 .type = FIO_OPT_STR,
1793 .off1 = td_var_offset(file_service_type),
1794 .help = "How to select which file to service next",
1795 .def = "roundrobin",
1796 .category = FIO_OPT_C_FILE,
1797 .group = FIO_OPT_G_INVALID,
1800 .oval = FIO_FSERVICE_RANDOM,
1801 .help = "Choose a file at random",
1803 { .ival = "roundrobin",
1804 .oval = FIO_FSERVICE_RR,
1805 .help = "Round robin select files",
1807 { .ival = "sequential",
1808 .oval = FIO_FSERVICE_SEQ,
1809 .help = "Finish one file before moving to the next",
1812 .parent = "nrfiles",
1815 #ifdef CONFIG_POSIX_FALLOCATE
1817 .name = "fallocate",
1818 .lname = "Fallocate",
1819 .type = FIO_OPT_STR,
1820 .off1 = td_var_offset(fallocate_mode),
1821 .help = "Whether pre-allocation is performed when laying out files",
1823 .category = FIO_OPT_C_FILE,
1824 .group = FIO_OPT_G_INVALID,
1827 .oval = FIO_FALLOCATE_NONE,
1828 .help = "Do not pre-allocate space",
1831 .oval = FIO_FALLOCATE_POSIX,
1832 .help = "Use posix_fallocate()",
1834 #ifdef CONFIG_LINUX_FALLOCATE
1836 .oval = FIO_FALLOCATE_KEEP_SIZE,
1837 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1840 /* Compatibility with former boolean values */
1842 .oval = FIO_FALLOCATE_NONE,
1843 .help = "Alias for 'none'",
1846 .oval = FIO_FALLOCATE_POSIX,
1847 .help = "Alias for 'posix'",
1851 #endif /* CONFIG_POSIX_FALLOCATE */
1853 .name = "fadvise_hint",
1854 .lname = "Fadvise hint",
1855 .type = FIO_OPT_BOOL,
1856 .off1 = td_var_offset(fadvise_hint),
1857 .help = "Use fadvise() to advise the kernel on IO pattern",
1859 .category = FIO_OPT_C_FILE,
1860 .group = FIO_OPT_G_INVALID,
1865 .type = FIO_OPT_INT,
1866 .off1 = td_var_offset(fsync_blocks),
1867 .help = "Issue fsync for writes every given number of blocks",
1870 .category = FIO_OPT_C_FILE,
1871 .group = FIO_OPT_G_INVALID,
1874 .name = "fdatasync",
1875 .lname = "Fdatasync",
1876 .type = FIO_OPT_INT,
1877 .off1 = td_var_offset(fdatasync_blocks),
1878 .help = "Issue fdatasync for writes every given number of blocks",
1881 .category = FIO_OPT_C_FILE,
1882 .group = FIO_OPT_G_INVALID,
1885 .name = "write_barrier",
1886 .lname = "Write barrier",
1887 .type = FIO_OPT_INT,
1888 .off1 = td_var_offset(barrier_blocks),
1889 .help = "Make every Nth write a barrier write",
1892 .category = FIO_OPT_C_IO,
1893 .group = FIO_OPT_G_INVALID,
1895 #ifdef CONFIG_SYNC_FILE_RANGE
1897 .name = "sync_file_range",
1898 .lname = "Sync file range",
1900 { .ival = "wait_before",
1901 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1902 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1906 .oval = SYNC_FILE_RANGE_WRITE,
1907 .help = "SYNC_FILE_RANGE_WRITE",
1911 .ival = "wait_after",
1912 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1913 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1917 .type = FIO_OPT_STR_MULTI,
1919 .off1 = td_var_offset(sync_file_range),
1920 .help = "Use sync_file_range()",
1921 .category = FIO_OPT_C_FILE,
1922 .group = FIO_OPT_G_INVALID,
1927 .lname = "Direct I/O",
1928 .type = FIO_OPT_BOOL,
1929 .off1 = td_var_offset(odirect),
1930 .help = "Use O_DIRECT IO (negates buffered)",
1932 .inverse = "buffered",
1933 .category = FIO_OPT_C_IO,
1934 .group = FIO_OPT_G_IO_TYPE,
1938 .lname = "Buffered I/O",
1939 .type = FIO_OPT_BOOL,
1940 .off1 = td_var_offset(odirect),
1942 .help = "Use buffered IO (negates direct)",
1944 .inverse = "direct",
1945 .category = FIO_OPT_C_IO,
1946 .group = FIO_OPT_G_IO_TYPE,
1949 .name = "overwrite",
1950 .lname = "Overwrite",
1951 .type = FIO_OPT_BOOL,
1952 .off1 = td_var_offset(overwrite),
1953 .help = "When writing, set whether to overwrite current data",
1955 .category = FIO_OPT_C_FILE,
1956 .group = FIO_OPT_G_INVALID,
1961 .type = FIO_OPT_INT,
1962 .off1 = td_var_offset(loops),
1963 .help = "Number of times to run the job",
1966 .category = FIO_OPT_C_GENERAL,
1967 .group = FIO_OPT_G_RUNTIME,
1971 .lname = "Number of jobs",
1972 .type = FIO_OPT_INT,
1973 .off1 = td_var_offset(numjobs),
1974 .help = "Duplicate this job this many times",
1977 .category = FIO_OPT_C_GENERAL,
1978 .group = FIO_OPT_G_RUNTIME,
1981 .name = "startdelay",
1982 .lname = "Start delay",
1983 .type = FIO_OPT_STR_VAL_TIME,
1984 .off1 = td_var_offset(start_delay),
1985 .help = "Only start job when this period has passed",
1987 .category = FIO_OPT_C_GENERAL,
1988 .group = FIO_OPT_G_RUNTIME,
1994 .type = FIO_OPT_STR_VAL_TIME,
1995 .off1 = td_var_offset(timeout),
1996 .help = "Stop workload when this amount of time has passed",
1998 .category = FIO_OPT_C_GENERAL,
1999 .group = FIO_OPT_G_RUNTIME,
2002 .name = "time_based",
2003 .lname = "Time based",
2004 .type = FIO_OPT_STR_SET,
2005 .off1 = td_var_offset(time_based),
2006 .help = "Keep running until runtime/timeout is met",
2007 .category = FIO_OPT_C_GENERAL,
2008 .group = FIO_OPT_G_RUNTIME,
2011 .name = "ramp_time",
2012 .lname = "Ramp time",
2013 .type = FIO_OPT_STR_VAL_TIME,
2014 .off1 = td_var_offset(ramp_time),
2015 .help = "Ramp up time before measuring performance",
2016 .category = FIO_OPT_C_GENERAL,
2017 .group = FIO_OPT_G_RUNTIME,
2020 .name = "clocksource",
2021 .lname = "Clock source",
2022 .type = FIO_OPT_STR,
2023 .cb = fio_clock_source_cb,
2024 .off1 = td_var_offset(clocksource),
2025 .help = "What type of timing source to use",
2026 .category = FIO_OPT_C_GENERAL,
2027 .group = FIO_OPT_G_CLOCK,
2029 #ifdef CONFIG_GETTIMEOFDAY
2030 { .ival = "gettimeofday",
2032 .help = "Use gettimeofday(2) for timing",
2035 #ifdef CONFIG_CLOCK_GETTIME
2036 { .ival = "clock_gettime",
2037 .oval = CS_CGETTIME,
2038 .help = "Use clock_gettime(2) for timing",
2041 #ifdef ARCH_HAVE_CPU_CLOCK
2043 .oval = CS_CPUCLOCK,
2044 .help = "Use CPU private clock",
2052 .lname = "I/O Memory",
2053 .type = FIO_OPT_STR,
2055 .off1 = td_var_offset(mem_type),
2056 .help = "Backing type for IO buffers",
2058 .category = FIO_OPT_C_IO,
2059 .group = FIO_OPT_G_INVALID,
2063 .help = "Use malloc(3) for IO buffers",
2067 .help = "Use shared memory segments for IO buffers",
2069 #ifdef FIO_HAVE_HUGETLB
2070 { .ival = "shmhuge",
2071 .oval = MEM_SHMHUGE,
2072 .help = "Like shm, but use huge pages",
2077 .help = "Use mmap(2) (file or anon) for IO buffers",
2079 #ifdef FIO_HAVE_HUGETLB
2080 { .ival = "mmaphuge",
2081 .oval = MEM_MMAPHUGE,
2082 .help = "Like mmap, but use huge pages",
2088 .name = "iomem_align",
2089 .alias = "mem_align",
2090 .lname = "I/O memory alignment",
2091 .type = FIO_OPT_INT,
2092 .off1 = td_var_offset(mem_align),
2094 .help = "IO memory buffer offset alignment",
2098 .category = FIO_OPT_C_IO,
2099 .group = FIO_OPT_G_INVALID,
2104 .type = FIO_OPT_STR,
2105 .off1 = td_var_offset(verify),
2106 .help = "Verify data written",
2107 .cb = str_verify_cb,
2109 .category = FIO_OPT_C_IO,
2110 .group = FIO_OPT_G_VERIFY,
2113 .oval = VERIFY_NONE,
2114 .help = "Don't do IO verification",
2118 .help = "Use md5 checksums for verification",
2121 .oval = VERIFY_CRC64,
2122 .help = "Use crc64 checksums for verification",
2125 .oval = VERIFY_CRC32,
2126 .help = "Use crc32 checksums for verification",
2128 { .ival = "crc32c-intel",
2129 .oval = VERIFY_CRC32C,
2130 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2133 .oval = VERIFY_CRC32C,
2134 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2137 .oval = VERIFY_CRC16,
2138 .help = "Use crc16 checksums for verification",
2141 .oval = VERIFY_CRC7,
2142 .help = "Use crc7 checksums for verification",
2145 .oval = VERIFY_SHA1,
2146 .help = "Use sha1 checksums for verification",
2149 .oval = VERIFY_SHA256,
2150 .help = "Use sha256 checksums for verification",
2153 .oval = VERIFY_SHA512,
2154 .help = "Use sha512 checksums for verification",
2157 .oval = VERIFY_META,
2158 .help = "Use io information",
2162 .oval = VERIFY_NULL,
2163 .help = "Pretend to verify",
2168 .name = "do_verify",
2169 .lname = "Perform verify step",
2170 .type = FIO_OPT_BOOL,
2171 .off1 = td_var_offset(do_verify),
2172 .help = "Run verification stage after write",
2176 .category = FIO_OPT_C_IO,
2177 .group = FIO_OPT_G_VERIFY,
2180 .name = "verifysort",
2181 .lname = "Verify sort",
2182 .type = FIO_OPT_BOOL,
2183 .off1 = td_var_offset(verifysort),
2184 .help = "Sort written verify blocks for read back",
2188 .category = FIO_OPT_C_IO,
2189 .group = FIO_OPT_G_VERIFY,
2192 .name = "verifysort_nr",
2193 .type = FIO_OPT_INT,
2194 .off1 = td_var_offset(verifysort_nr),
2195 .help = "Pre-load and sort verify blocks for a read workload",
2200 .category = FIO_OPT_C_IO,
2201 .group = FIO_OPT_G_VERIFY,
2204 .name = "verify_interval",
2205 .lname = "Verify interval",
2206 .type = FIO_OPT_INT,
2207 .off1 = td_var_offset(verify_interval),
2208 .minval = 2 * sizeof(struct verify_header),
2209 .help = "Store verify buffer header every N bytes",
2212 .interval = 2 * sizeof(struct verify_header),
2213 .category = FIO_OPT_C_IO,
2214 .group = FIO_OPT_G_VERIFY,
2217 .name = "verify_offset",
2218 .lname = "Verify offset",
2219 .type = FIO_OPT_INT,
2220 .help = "Offset verify header location by N bytes",
2221 .off1 = td_var_offset(verify_offset),
2222 .minval = sizeof(struct verify_header),
2223 .cb = str_verify_offset_cb,
2226 .category = FIO_OPT_C_IO,
2227 .group = FIO_OPT_G_VERIFY,
2230 .name = "verify_pattern",
2231 .lname = "Verify pattern",
2232 .type = FIO_OPT_STR,
2233 .cb = str_verify_pattern_cb,
2234 .help = "Fill pattern for IO buffers",
2237 .category = FIO_OPT_C_IO,
2238 .group = FIO_OPT_G_VERIFY,
2241 .name = "verify_fatal",
2242 .lname = "Verify fatal",
2243 .type = FIO_OPT_BOOL,
2244 .off1 = td_var_offset(verify_fatal),
2246 .help = "Exit on a single verify failure, don't continue",
2249 .category = FIO_OPT_C_IO,
2250 .group = FIO_OPT_G_VERIFY,
2253 .name = "verify_dump",
2254 .lname = "Verify dump",
2255 .type = FIO_OPT_BOOL,
2256 .off1 = td_var_offset(verify_dump),
2258 .help = "Dump contents of good and bad blocks on failure",
2261 .category = FIO_OPT_C_IO,
2262 .group = FIO_OPT_G_VERIFY,
2265 .name = "verify_async",
2266 .lname = "Verify asynchronously",
2267 .type = FIO_OPT_INT,
2268 .off1 = td_var_offset(verify_async),
2270 .help = "Number of async verifier threads to use",
2273 .category = FIO_OPT_C_IO,
2274 .group = FIO_OPT_G_VERIFY,
2277 .name = "verify_backlog",
2278 .lname = "Verify backlog",
2279 .type = FIO_OPT_STR_VAL,
2280 .off1 = td_var_offset(verify_backlog),
2281 .help = "Verify after this number of blocks are written",
2284 .category = FIO_OPT_C_IO,
2285 .group = FIO_OPT_G_VERIFY,
2288 .name = "verify_backlog_batch",
2289 .lname = "Verify backlog batch",
2290 .type = FIO_OPT_INT,
2291 .off1 = td_var_offset(verify_batch),
2292 .help = "Verify this number of IO blocks",
2295 .category = FIO_OPT_C_IO,
2296 .group = FIO_OPT_G_VERIFY,
2298 #ifdef FIO_HAVE_CPU_AFFINITY
2300 .name = "verify_async_cpus",
2301 .lname = "Async verify CPUs",
2302 .type = FIO_OPT_STR,
2303 .cb = str_verify_cpus_allowed_cb,
2304 .help = "Set CPUs allowed for async verify threads",
2305 .parent = "verify_async",
2307 .category = FIO_OPT_C_IO,
2308 .group = FIO_OPT_G_VERIFY,
2312 .name = "experimental_verify",
2313 .off1 = td_var_offset(experimental_verify),
2314 .type = FIO_OPT_BOOL,
2315 .help = "Enable experimental verification",
2316 .category = FIO_OPT_C_IO,
2317 .group = FIO_OPT_G_VERIFY,
2319 #ifdef FIO_HAVE_TRIM
2321 .name = "trim_percentage",
2322 .lname = "Trim percentage",
2323 .type = FIO_OPT_INT,
2324 .off1 = td_var_offset(trim_percentage),
2327 .help = "Number of verify blocks to discard/trim",
2332 .category = FIO_OPT_C_IO,
2333 .group = FIO_OPT_G_TRIM,
2336 .name = "trim_verify_zero",
2337 .lname = "Verify trim zero",
2338 .type = FIO_OPT_BOOL,
2339 .help = "Verify that trim/discarded blocks are returned as zeroes",
2340 .off1 = td_var_offset(trim_zero),
2341 .parent = "trim_percentage",
2344 .category = FIO_OPT_C_IO,
2345 .group = FIO_OPT_G_TRIM,
2348 .name = "trim_backlog",
2349 .lname = "Trim backlog",
2350 .type = FIO_OPT_STR_VAL,
2351 .off1 = td_var_offset(trim_backlog),
2352 .help = "Trim after this number of blocks are written",
2353 .parent = "trim_percentage",
2356 .category = FIO_OPT_C_IO,
2357 .group = FIO_OPT_G_TRIM,
2360 .name = "trim_backlog_batch",
2361 .lname = "Trim backlog batch",
2362 .type = FIO_OPT_INT,
2363 .off1 = td_var_offset(trim_batch),
2364 .help = "Trim this number of IO blocks",
2365 .parent = "trim_percentage",
2368 .category = FIO_OPT_C_IO,
2369 .group = FIO_OPT_G_TRIM,
2373 .name = "write_iolog",
2374 .lname = "Write I/O log",
2375 .type = FIO_OPT_STR_STORE,
2376 .off1 = td_var_offset(write_iolog_file),
2377 .help = "Store IO pattern to file",
2378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_IOLOG,
2382 .name = "read_iolog",
2383 .lname = "Read I/O log",
2384 .type = FIO_OPT_STR_STORE,
2385 .off1 = td_var_offset(read_iolog_file),
2386 .help = "Playback IO pattern from file",
2387 .category = FIO_OPT_C_IO,
2388 .group = FIO_OPT_G_IOLOG,
2391 .name = "replay_no_stall",
2392 .lname = "Don't stall on replay",
2393 .type = FIO_OPT_BOOL,
2394 .off1 = td_var_offset(no_stall),
2396 .parent = "read_iolog",
2398 .help = "Playback IO pattern file as fast as possible without stalls",
2399 .category = FIO_OPT_C_IO,
2400 .group = FIO_OPT_G_IOLOG,
2403 .name = "replay_redirect",
2404 .lname = "Redirect device for replay",
2405 .type = FIO_OPT_STR_STORE,
2406 .off1 = td_var_offset(replay_redirect),
2407 .parent = "read_iolog",
2409 .help = "Replay all I/O onto this device, regardless of trace device",
2410 .category = FIO_OPT_C_IO,
2411 .group = FIO_OPT_G_IOLOG,
2414 .name = "exec_prerun",
2415 .lname = "Pre-execute runnable",
2416 .type = FIO_OPT_STR_STORE,
2417 .off1 = td_var_offset(exec_prerun),
2418 .help = "Execute this file prior to running job",
2419 .category = FIO_OPT_C_GENERAL,
2420 .group = FIO_OPT_G_INVALID,
2423 .name = "exec_postrun",
2424 .lname = "Post-execute runnable",
2425 .type = FIO_OPT_STR_STORE,
2426 .off1 = td_var_offset(exec_postrun),
2427 .help = "Execute this file after running job",
2428 .category = FIO_OPT_C_GENERAL,
2429 .group = FIO_OPT_G_INVALID,
2431 #ifdef FIO_HAVE_IOSCHED_SWITCH
2433 .name = "ioscheduler",
2434 .lname = "I/O scheduler",
2435 .type = FIO_OPT_STR_STORE,
2436 .off1 = td_var_offset(ioscheduler),
2437 .help = "Use this IO scheduler on the backing device",
2438 .category = FIO_OPT_C_FILE,
2439 .group = FIO_OPT_G_INVALID,
2444 .lname = "Zone size",
2445 .type = FIO_OPT_STR_VAL,
2446 .off1 = td_var_offset(zone_size),
2447 .help = "Amount of data to read per zone",
2449 .interval = 1024 * 1024,
2450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_ZONE,
2454 .name = "zonerange",
2455 .lname = "Zone range",
2456 .type = FIO_OPT_STR_VAL,
2457 .off1 = td_var_offset(zone_range),
2458 .help = "Give size of an IO zone",
2460 .interval = 1024 * 1024,
2461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_ZONE,
2466 .lname = "Zone skip",
2467 .type = FIO_OPT_STR_VAL,
2468 .off1 = td_var_offset(zone_skip),
2469 .help = "Space between IO zones",
2471 .interval = 1024 * 1024,
2472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_ZONE,
2477 .lname = "Lock memory",
2478 .type = FIO_OPT_STR_VAL,
2479 .off1 = td_var_offset(lockmem),
2480 .help = "Lock down this amount of memory (per worker)",
2482 .interval = 1024 * 1024,
2483 .category = FIO_OPT_C_GENERAL,
2484 .group = FIO_OPT_G_INVALID,
2487 .name = "rwmixread",
2488 .lname = "Read/write mix read",
2489 .type = FIO_OPT_INT,
2490 .cb = str_rwmix_read_cb,
2492 .help = "Percentage of mixed workload that is reads",
2495 .inverse = "rwmixwrite",
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_RWMIX,
2500 .name = "rwmixwrite",
2501 .lname = "Read/write mix write",
2502 .type = FIO_OPT_INT,
2503 .cb = str_rwmix_write_cb,
2505 .help = "Percentage of mixed workload that is writes",
2508 .inverse = "rwmixread",
2509 .category = FIO_OPT_C_IO,
2510 .group = FIO_OPT_G_RWMIX,
2513 .name = "rwmixcycle",
2514 .lname = "Read/write mix cycle",
2515 .type = FIO_OPT_DEPRECATED,
2516 .category = FIO_OPT_C_IO,
2517 .group = FIO_OPT_G_RWMIX,
2522 .type = FIO_OPT_INT,
2523 .off1 = td_var_offset(nice),
2524 .help = "Set job CPU nice value",
2529 .category = FIO_OPT_C_GENERAL,
2530 .group = FIO_OPT_G_CRED,
2532 #ifdef FIO_HAVE_IOPRIO
2535 .lname = "I/O nice priority",
2536 .type = FIO_OPT_INT,
2538 .off1 = td_var_offset(ioprio),
2539 .help = "Set job IO priority value",
2543 .category = FIO_OPT_C_GENERAL,
2544 .group = FIO_OPT_G_CRED,
2547 .name = "prioclass",
2548 .lname = "I/O nice priority class",
2549 .type = FIO_OPT_INT,
2550 .cb = str_prioclass_cb,
2551 .off1 = td_var_offset(ioprio_class),
2552 .help = "Set job IO priority class",
2556 .category = FIO_OPT_C_GENERAL,
2557 .group = FIO_OPT_G_CRED,
2561 .name = "thinktime",
2562 .lname = "Thinktime",
2563 .type = FIO_OPT_INT,
2564 .off1 = td_var_offset(thinktime),
2565 .help = "Idle time between IO buffers (usec)",
2567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_THINKTIME,
2571 .name = "thinktime_spin",
2572 .lname = "Thinktime spin",
2573 .type = FIO_OPT_INT,
2574 .off1 = td_var_offset(thinktime_spin),
2575 .help = "Start think time by spinning this amount (usec)",
2577 .parent = "thinktime",
2579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_THINKTIME,
2583 .name = "thinktime_blocks",
2584 .lname = "Thinktime blocks",
2585 .type = FIO_OPT_INT,
2586 .off1 = td_var_offset(thinktime_blocks),
2587 .help = "IO buffer period between 'thinktime'",
2589 .parent = "thinktime",
2591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_THINKTIME,
2596 .lname = "I/O rate",
2597 .type = FIO_OPT_INT,
2598 .off1 = td_var_offset(rate[DDIR_READ]),
2599 .off2 = td_var_offset(rate[DDIR_WRITE]),
2600 .off3 = td_var_offset(rate[DDIR_TRIM]),
2601 .help = "Set bandwidth rate",
2602 .category = FIO_OPT_C_IO,
2603 .group = FIO_OPT_G_RATE,
2607 .lname = "I/O min rate",
2608 .type = FIO_OPT_INT,
2609 .off1 = td_var_offset(ratemin[DDIR_READ]),
2610 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2611 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2612 .help = "Job must meet this rate or it will be shutdown",
2615 .category = FIO_OPT_C_IO,
2616 .group = FIO_OPT_G_RATE,
2619 .name = "rate_iops",
2620 .lname = "I/O rate IOPS",
2621 .type = FIO_OPT_INT,
2622 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2623 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2624 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2625 .help = "Limit IO used to this number of IO operations/sec",
2627 .category = FIO_OPT_C_IO,
2628 .group = FIO_OPT_G_RATE,
2631 .name = "rate_iops_min",
2632 .lname = "I/O min rate IOPS",
2633 .type = FIO_OPT_INT,
2634 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2635 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2636 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2637 .help = "Job must meet this rate or it will be shut down",
2638 .parent = "rate_iops",
2640 .category = FIO_OPT_C_IO,
2641 .group = FIO_OPT_G_RATE,
2644 .name = "ratecycle",
2645 .lname = "I/O rate cycle",
2646 .type = FIO_OPT_INT,
2647 .off1 = td_var_offset(ratecycle),
2648 .help = "Window average for rate limits (msec)",
2652 .category = FIO_OPT_C_IO,
2653 .group = FIO_OPT_G_RATE,
2656 .name = "max_latency",
2657 .type = FIO_OPT_INT,
2658 .off1 = td_var_offset(max_latency),
2659 .help = "Maximum tolerated IO latency (usec)",
2660 .category = FIO_OPT_C_IO,
2661 .group = FIO_OPT_G_RATE,
2664 .name = "invalidate",
2665 .lname = "Cache invalidate",
2666 .type = FIO_OPT_BOOL,
2667 .off1 = td_var_offset(invalidate_cache),
2668 .help = "Invalidate buffer/page cache prior to running job",
2670 .category = FIO_OPT_C_IO,
2671 .group = FIO_OPT_G_IO_TYPE,
2675 .lname = "Synchronous I/O",
2676 .type = FIO_OPT_BOOL,
2677 .off1 = td_var_offset(sync_io),
2678 .help = "Use O_SYNC for buffered writes",
2680 .parent = "buffered",
2682 .category = FIO_OPT_C_IO,
2683 .group = FIO_OPT_G_IO_TYPE,
2686 .name = "create_serialize",
2687 .lname = "Create serialize",
2688 .type = FIO_OPT_BOOL,
2689 .off1 = td_var_offset(create_serialize),
2690 .help = "Serialize creating of job files",
2692 .category = FIO_OPT_C_FILE,
2693 .group = FIO_OPT_G_INVALID,
2696 .name = "create_fsync",
2697 .lname = "Create fsync",
2698 .type = FIO_OPT_BOOL,
2699 .off1 = td_var_offset(create_fsync),
2700 .help = "fsync file after creation",
2702 .category = FIO_OPT_C_FILE,
2703 .group = FIO_OPT_G_INVALID,
2706 .name = "create_on_open",
2707 .lname = "Create on open",
2708 .type = FIO_OPT_BOOL,
2709 .off1 = td_var_offset(create_on_open),
2710 .help = "Create files when they are opened for IO",
2712 .category = FIO_OPT_C_FILE,
2713 .group = FIO_OPT_G_INVALID,
2716 .name = "create_only",
2717 .type = FIO_OPT_BOOL,
2718 .off1 = td_var_offset(create_only),
2719 .help = "Only perform file creation phase",
2720 .category = FIO_OPT_C_FILE,
2725 .lname = "Pre-read files",
2726 .type = FIO_OPT_BOOL,
2727 .off1 = td_var_offset(pre_read),
2728 .help = "Pre-read files before starting official testing",
2730 .category = FIO_OPT_C_FILE,
2731 .group = FIO_OPT_G_INVALID,
2733 #ifdef FIO_HAVE_CPU_AFFINITY
2736 .lname = "CPU mask",
2737 .type = FIO_OPT_INT,
2738 .cb = str_cpumask_cb,
2739 .help = "CPU affinity mask",
2740 .category = FIO_OPT_C_GENERAL,
2741 .group = FIO_OPT_G_CRED,
2744 .name = "cpus_allowed",
2745 .lname = "CPUs allowed",
2746 .type = FIO_OPT_STR,
2747 .cb = str_cpus_allowed_cb,
2748 .help = "Set CPUs allowed",
2749 .category = FIO_OPT_C_GENERAL,
2750 .group = FIO_OPT_G_CRED,
2753 #ifdef CONFIG_LIBNUMA
2755 .name = "numa_cpu_nodes",
2756 .type = FIO_OPT_STR,
2757 .cb = str_numa_cpunodes_cb,
2758 .help = "NUMA CPU nodes bind",
2759 .category = FIO_OPT_C_GENERAL,
2760 .group = FIO_OPT_G_INVALID,
2763 .name = "numa_mem_policy",
2764 .type = FIO_OPT_STR,
2765 .cb = str_numa_mpol_cb,
2766 .help = "NUMA memory policy setup",
2767 .category = FIO_OPT_C_GENERAL,
2768 .group = FIO_OPT_G_INVALID,
2772 .name = "end_fsync",
2773 .lname = "End fsync",
2774 .type = FIO_OPT_BOOL,
2775 .off1 = td_var_offset(end_fsync),
2776 .help = "Include fsync at the end of job",
2778 .category = FIO_OPT_C_FILE,
2779 .group = FIO_OPT_G_INVALID,
2782 .name = "fsync_on_close",
2783 .lname = "Fsync on close",
2784 .type = FIO_OPT_BOOL,
2785 .off1 = td_var_offset(fsync_on_close),
2786 .help = "fsync files on close",
2788 .category = FIO_OPT_C_FILE,
2789 .group = FIO_OPT_G_INVALID,
2793 .lname = "Unlink file",
2794 .type = FIO_OPT_BOOL,
2795 .off1 = td_var_offset(unlink),
2796 .help = "Unlink created files after job has completed",
2798 .category = FIO_OPT_C_FILE,
2799 .group = FIO_OPT_G_INVALID,
2803 .lname = "Exit-all on terminate",
2804 .type = FIO_OPT_STR_SET,
2805 .cb = str_exitall_cb,
2806 .help = "Terminate all jobs when one exits",
2807 .category = FIO_OPT_C_GENERAL,
2808 .group = FIO_OPT_G_PROCESS,
2811 .name = "stonewall",
2812 .lname = "Wait for previous",
2813 .alias = "wait_for_previous",
2814 .type = FIO_OPT_STR_SET,
2815 .off1 = td_var_offset(stonewall),
2816 .help = "Insert a hard barrier between this job and previous",
2817 .category = FIO_OPT_C_GENERAL,
2818 .group = FIO_OPT_G_PROCESS,
2821 .name = "new_group",
2822 .lname = "New group",
2823 .type = FIO_OPT_STR_SET,
2824 .off1 = td_var_offset(new_group),
2825 .help = "Mark the start of a new group (for reporting)",
2826 .category = FIO_OPT_C_GENERAL,
2827 .group = FIO_OPT_G_PROCESS,
2832 .type = FIO_OPT_STR_SET,
2833 .off1 = td_var_offset(use_thread),
2834 .help = "Use threads instead of processes",
2835 .category = FIO_OPT_C_GENERAL,
2836 .group = FIO_OPT_G_PROCESS,
2839 .name = "write_bw_log",
2840 .lname = "Write bandwidth log",
2841 .type = FIO_OPT_STR,
2842 .off1 = td_var_offset(bw_log_file),
2843 .cb = str_write_bw_log_cb,
2844 .help = "Write log of bandwidth during run",
2845 .category = FIO_OPT_C_LOG,
2846 .group = FIO_OPT_G_INVALID,
2849 .name = "write_lat_log",
2850 .lname = "Write latency log",
2851 .type = FIO_OPT_STR,
2852 .off1 = td_var_offset(lat_log_file),
2853 .cb = str_write_lat_log_cb,
2854 .help = "Write log of latency during run",
2855 .category = FIO_OPT_C_LOG,
2856 .group = FIO_OPT_G_INVALID,
2859 .name = "write_iops_log",
2860 .lname = "Write IOPS log",
2861 .type = FIO_OPT_STR,
2862 .off1 = td_var_offset(iops_log_file),
2863 .cb = str_write_iops_log_cb,
2864 .help = "Write log of IOPS during run",
2865 .category = FIO_OPT_C_LOG,
2866 .group = FIO_OPT_G_INVALID,
2869 .name = "log_avg_msec",
2870 .lname = "Log averaging (msec)",
2871 .type = FIO_OPT_INT,
2872 .off1 = td_var_offset(log_avg_msec),
2873 .help = "Average bw/iops/lat logs over this period of time",
2875 .category = FIO_OPT_C_LOG,
2876 .group = FIO_OPT_G_INVALID,
2879 .name = "bwavgtime",
2880 .lname = "Bandwidth average time",
2881 .type = FIO_OPT_INT,
2882 .off1 = td_var_offset(bw_avg_time),
2883 .help = "Time window over which to calculate bandwidth"
2886 .parent = "write_bw_log",
2889 .category = FIO_OPT_C_LOG,
2890 .group = FIO_OPT_G_INVALID,
2893 .name = "iopsavgtime",
2894 .lname = "IOPS average time",
2895 .type = FIO_OPT_INT,
2896 .off1 = td_var_offset(iops_avg_time),
2897 .help = "Time window over which to calculate IOPS (msec)",
2899 .parent = "write_iops_log",
2902 .category = FIO_OPT_C_LOG,
2903 .group = FIO_OPT_G_INVALID,
2906 .name = "group_reporting",
2907 .lname = "Group reporting",
2908 .type = FIO_OPT_BOOL,
2909 .off1 = td_var_offset(group_reporting),
2910 .help = "Do reporting on a per-group basis",
2912 .category = FIO_OPT_C_STAT,
2913 .group = FIO_OPT_G_INVALID,
2916 .name = "zero_buffers",
2917 .lname = "Zero I/O buffers",
2918 .type = FIO_OPT_STR_SET,
2919 .off1 = td_var_offset(zero_buffers),
2920 .help = "Init IO buffers to all zeroes",
2921 .category = FIO_OPT_C_IO,
2922 .group = FIO_OPT_G_IO_BUF,
2925 .name = "refill_buffers",
2926 .lname = "Refill I/O buffers",
2927 .type = FIO_OPT_STR_SET,
2928 .off1 = td_var_offset(refill_buffers),
2929 .help = "Refill IO buffers on every IO submit",
2930 .category = FIO_OPT_C_IO,
2931 .group = FIO_OPT_G_IO_BUF,
2934 .name = "scramble_buffers",
2935 .lname = "Scramble I/O buffers",
2936 .type = FIO_OPT_BOOL,
2937 .off1 = td_var_offset(scramble_buffers),
2938 .help = "Slightly scramble buffers on every IO submit",
2940 .category = FIO_OPT_C_IO,
2941 .group = FIO_OPT_G_IO_BUF,
2944 .name = "buffer_compress_percentage",
2945 .lname = "Buffer compression percentage",
2946 .type = FIO_OPT_INT,
2947 .off1 = td_var_offset(compress_percentage),
2950 .help = "How compressible the buffer is (approximately)",
2952 .category = FIO_OPT_C_IO,
2953 .group = FIO_OPT_G_IO_BUF,
2956 .name = "buffer_compress_chunk",
2957 .lname = "Buffer compression chunk size",
2958 .type = FIO_OPT_INT,
2959 .off1 = td_var_offset(compress_chunk),
2960 .parent = "buffer_compress_percentage",
2962 .help = "Size of compressible region in buffer",
2964 .category = FIO_OPT_C_IO,
2965 .group = FIO_OPT_G_IO_BUF,
2968 .name = "clat_percentiles",
2969 .lname = "Completion latency percentiles",
2970 .type = FIO_OPT_BOOL,
2971 .off1 = td_var_offset(clat_percentiles),
2972 .help = "Enable the reporting of completion latency percentiles",
2974 .category = FIO_OPT_C_STAT,
2975 .group = FIO_OPT_G_INVALID,
2978 .name = "percentile_list",
2979 .lname = "Completion latency percentile list",
2980 .type = FIO_OPT_FLOAT_LIST,
2981 .off1 = td_var_offset(percentile_list),
2982 .off2 = td_var_offset(percentile_precision),
2983 .help = "Specify a custom list of percentiles to report",
2984 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2985 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2988 .category = FIO_OPT_C_STAT,
2989 .group = FIO_OPT_G_INVALID,
2992 #ifdef FIO_HAVE_DISK_UTIL
2994 .name = "disk_util",
2995 .lname = "Disk utilization",
2996 .type = FIO_OPT_BOOL,
2997 .off1 = td_var_offset(do_disk_util),
2998 .help = "Log disk utilization statistics",
3000 .category = FIO_OPT_C_STAT,
3001 .group = FIO_OPT_G_INVALID,
3005 .name = "gtod_reduce",
3006 .lname = "Reduce gettimeofday() calls",
3007 .type = FIO_OPT_BOOL,
3008 .help = "Greatly reduce number of gettimeofday() calls",
3009 .cb = str_gtod_reduce_cb,
3012 .category = FIO_OPT_C_STAT,
3013 .group = FIO_OPT_G_INVALID,
3016 .name = "disable_lat",
3017 .lname = "Disable all latency stats",
3018 .type = FIO_OPT_BOOL,
3019 .off1 = td_var_offset(disable_lat),
3020 .help = "Disable latency numbers",
3021 .parent = "gtod_reduce",
3024 .category = FIO_OPT_C_STAT,
3025 .group = FIO_OPT_G_INVALID,
3028 .name = "disable_clat",
3029 .lname = "Disable completion latency stats",
3030 .type = FIO_OPT_BOOL,
3031 .off1 = td_var_offset(disable_clat),
3032 .help = "Disable completion latency numbers",
3033 .parent = "gtod_reduce",
3036 .category = FIO_OPT_C_STAT,
3037 .group = FIO_OPT_G_INVALID,
3040 .name = "disable_slat",
3041 .lname = "Disable submission latency stats",
3042 .type = FIO_OPT_BOOL,
3043 .off1 = td_var_offset(disable_slat),
3044 .help = "Disable submission latency numbers",
3045 .parent = "gtod_reduce",
3048 .category = FIO_OPT_C_STAT,
3049 .group = FIO_OPT_G_INVALID,
3052 .name = "disable_bw_measurement",
3053 .lname = "Disable bandwidth stats",
3054 .type = FIO_OPT_BOOL,
3055 .off1 = td_var_offset(disable_bw),
3056 .help = "Disable bandwidth logging",
3057 .parent = "gtod_reduce",
3060 .category = FIO_OPT_C_STAT,
3061 .group = FIO_OPT_G_INVALID,
3065 .lname = "Dedicated gettimeofday() CPU",
3066 .type = FIO_OPT_INT,
3067 .cb = str_gtod_cpu_cb,
3068 .help = "Set up dedicated gettimeofday() thread on this CPU",
3069 .verify = gtod_cpu_verify,
3070 .category = FIO_OPT_C_GENERAL,
3071 .group = FIO_OPT_G_CLOCK,
3074 .name = "unified_rw_reporting",
3075 .type = FIO_OPT_BOOL,
3076 .off1 = td_var_offset(unified_rw_rep),
3077 .help = "Unify reporting across data direction",
3079 .category = FIO_OPT_C_GENERAL,
3080 .group = FIO_OPT_G_INVALID,
3083 .name = "continue_on_error",
3084 .lname = "Continue on error",
3085 .type = FIO_OPT_STR,
3086 .off1 = td_var_offset(continue_on_error),
3087 .help = "Continue on non-fatal errors during IO",
3089 .category = FIO_OPT_C_GENERAL,
3090 .group = FIO_OPT_G_ERR,
3093 .oval = ERROR_TYPE_NONE,
3094 .help = "Exit when an error is encountered",
3097 .oval = ERROR_TYPE_READ,
3098 .help = "Continue on read errors only",
3101 .oval = ERROR_TYPE_WRITE,
3102 .help = "Continue on write errors only",
3105 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3106 .help = "Continue on any IO errors",
3109 .oval = ERROR_TYPE_VERIFY,
3110 .help = "Continue on verify errors only",
3113 .oval = ERROR_TYPE_ANY,
3114 .help = "Continue on all io and verify errors",
3117 .oval = ERROR_TYPE_NONE,
3118 .help = "Alias for 'none'",
3121 .oval = ERROR_TYPE_ANY,
3122 .help = "Alias for 'all'",
3127 .name = "ignore_error",
3128 .type = FIO_OPT_STR,
3129 .cb = str_ignore_error_cb,
3130 .help = "Set a specific list of errors to ignore",
3132 .category = FIO_OPT_C_GENERAL,
3133 .group = FIO_OPT_G_ERR,
3136 .name = "error_dump",
3137 .type = FIO_OPT_BOOL,
3138 .off1 = td_var_offset(error_dump),
3140 .help = "Dump info on each error",
3141 .category = FIO_OPT_C_GENERAL,
3142 .group = FIO_OPT_G_ERR,
3147 .type = FIO_OPT_STR_STORE,
3148 .off1 = td_var_offset(profile),
3149 .help = "Select a specific builtin performance test",
3150 .category = FIO_OPT_C_PROFILE,
3151 .group = FIO_OPT_G_INVALID,
3156 .type = FIO_OPT_STR_STORE,
3157 .off1 = td_var_offset(cgroup),
3158 .help = "Add job to cgroup of this name",
3159 .category = FIO_OPT_C_GENERAL,
3160 .group = FIO_OPT_G_CGROUP,
3163 .name = "cgroup_nodelete",
3164 .lname = "Cgroup no-delete",
3165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(cgroup_nodelete),
3167 .help = "Do not delete cgroups after job completion",
3170 .category = FIO_OPT_C_GENERAL,
3171 .group = FIO_OPT_G_CGROUP,
3174 .name = "cgroup_weight",
3175 .lname = "Cgroup weight",
3176 .type = FIO_OPT_INT,
3177 .off1 = td_var_offset(cgroup_weight),
3178 .help = "Use given weight for cgroup",
3182 .category = FIO_OPT_C_GENERAL,
3183 .group = FIO_OPT_G_CGROUP,
3188 .type = FIO_OPT_INT,
3189 .off1 = td_var_offset(uid),
3190 .help = "Run job with this user ID",
3191 .category = FIO_OPT_C_GENERAL,
3192 .group = FIO_OPT_G_CRED,
3196 .lname = "Group ID",
3197 .type = FIO_OPT_INT,
3198 .off1 = td_var_offset(gid),
3199 .help = "Run job with this group ID",
3200 .category = FIO_OPT_C_GENERAL,
3201 .group = FIO_OPT_G_CRED,
3206 .type = FIO_OPT_INT,
3207 .off1 = td_var_offset(kb_base),
3213 .help = "Use 1024 as the K base",
3217 .help = "Use 1000 as the K base",
3220 .help = "How many bytes per KB for reporting (1000 or 1024)",
3221 .category = FIO_OPT_C_GENERAL,
3222 .group = FIO_OPT_G_INVALID,
3225 .name = "unit_base",
3226 .lname = "Base unit for reporting (Bits or Bytes)",
3227 .type = FIO_OPT_INT,
3228 .off1 = td_var_offset(unit_base),
3233 .help = "Auto-detect",
3237 .help = "Normal (byte based)",
3241 .help = "Bit based",
3244 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3245 .category = FIO_OPT_C_GENERAL,
3246 .group = FIO_OPT_G_INVALID,
3249 .name = "hugepage-size",
3250 .lname = "Hugepage size",
3251 .type = FIO_OPT_INT,
3252 .off1 = td_var_offset(hugepage_size),
3253 .help = "When using hugepages, specify size of each page",
3254 .def = __fio_stringify(FIO_HUGE_PAGE),
3255 .interval = 1024 * 1024,
3256 .category = FIO_OPT_C_GENERAL,
3257 .group = FIO_OPT_G_INVALID,
3261 .lname = "I/O flow ID",
3262 .type = FIO_OPT_INT,
3263 .off1 = td_var_offset(flow_id),
3264 .help = "The flow index ID to use",
3266 .category = FIO_OPT_C_IO,
3267 .group = FIO_OPT_G_IO_FLOW,
3271 .lname = "I/O flow weight",
3272 .type = FIO_OPT_INT,
3273 .off1 = td_var_offset(flow),
3274 .help = "Weight for flow control of this job",
3275 .parent = "flow_id",
3278 .category = FIO_OPT_C_IO,
3279 .group = FIO_OPT_G_IO_FLOW,
3282 .name = "flow_watermark",
3283 .lname = "I/O flow watermark",
3284 .type = FIO_OPT_INT,
3285 .off1 = td_var_offset(flow_watermark),
3286 .help = "High watermark for flow control. This option"
3287 " should be set to the same value for all threads"
3288 " with non-zero flow.",
3289 .parent = "flow_id",
3292 .category = FIO_OPT_C_IO,
3293 .group = FIO_OPT_G_IO_FLOW,
3296 .name = "flow_sleep",
3297 .lname = "I/O flow sleep",
3298 .type = FIO_OPT_INT,
3299 .off1 = td_var_offset(flow_sleep),
3300 .help = "How many microseconds to sleep after being held"
3301 " back by the flow control mechanism",
3302 .parent = "flow_id",
3305 .category = FIO_OPT_C_IO,
3306 .group = FIO_OPT_G_IO_FLOW,
3313 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3314 const char *name, int val)
3316 lopt->name = (char *) name;
3318 if (o->type == FIO_OPT_STR_SET)
3319 lopt->has_arg = no_argument;
3321 lopt->has_arg = required_argument;
3324 static void options_to_lopts(struct fio_option *opts,
3325 struct option *long_options,
3326 int i, int option_type)
3328 struct fio_option *o = &opts[0];
3330 add_to_lopt(&long_options[i], o, o->name, option_type);
3333 add_to_lopt(&long_options[i], o, o->alias, option_type);
3338 assert(i < FIO_NR_OPTIONS);
3342 void fio_options_set_ioengine_opts(struct option *long_options,
3343 struct thread_data *td)
3348 while (long_options[i].name) {
3349 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3350 memset(&long_options[i], 0, sizeof(*long_options));
3357 * Just clear out the prior ioengine options.
3362 options_to_lopts(td->io_ops->options, long_options, i,
3363 FIO_GETOPT_IOENGINE);
3366 void fio_options_dup_and_init(struct option *long_options)
3370 options_init(fio_options);
3373 while (long_options[i].name)
3376 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3379 struct fio_keyword {
3385 static struct fio_keyword fio_keywords[] = {
3387 .word = "$pagesize",
3388 .desc = "Page size in the system",
3391 .word = "$mb_memory",
3392 .desc = "Megabytes of memory online",
3396 .desc = "Number of CPUs online in the system",
3403 void fio_keywords_init(void)
3405 unsigned long long mb_memory;
3409 sprintf(buf, "%lu", (unsigned long) page_size);
3410 fio_keywords[0].replace = strdup(buf);
3412 mb_memory = os_phys_mem() / (1024 * 1024);
3413 sprintf(buf, "%llu", mb_memory);
3414 fio_keywords[1].replace = strdup(buf);
3417 sprintf(buf, "%lu", l);
3418 fio_keywords[2].replace = strdup(buf);
3423 static char *bc_calc(char *str)
3425 char buf[128], *tmp;
3430 * No math, just return string
3432 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3433 !strchr(str, '/')) || strchr(str, '\''))
3437 * Split option from value, we only need to calculate the value
3439 tmp = strchr(str, '=');
3446 * Prevent buffer overflows; such a case isn't reasonable anyway
3448 if (strlen(str) >= 128 || strlen(tmp) > 100)
3451 sprintf(buf, "which %s > /dev/null", BC_APP);
3453 log_err("fio: bc is needed for performing math\n");
3457 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3458 f = popen(buf, "r");
3463 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3469 buf[(tmp - str) + ret - 1] = '\0';
3470 memcpy(buf, str, tmp - str);
3476 * Return a copy of the input string with substrings of the form ${VARNAME}
3477 * substituted with the value of the environment variable VARNAME. The
3478 * substitution always occurs, even if VARNAME is empty or the corresponding
3479 * environment variable undefined.
3481 static char *option_dup_subs(const char *opt)
3483 char out[OPT_LEN_MAX+1];
3484 char in[OPT_LEN_MAX+1];
3487 char *ch1, *ch2, *env;
3488 ssize_t nchr = OPT_LEN_MAX;
3491 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3492 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3496 in[OPT_LEN_MAX] = '\0';
3497 strncpy(in, opt, OPT_LEN_MAX);
3499 while (*inptr && nchr > 0) {
3500 if (inptr[0] == '$' && inptr[1] == '{') {
3501 ch2 = strchr(inptr, '}');
3502 if (ch2 && inptr+1 < ch2) {
3509 envlen = strlen(env);
3510 if (envlen <= nchr) {
3511 memcpy(outptr, env, envlen);
3521 *outptr++ = *inptr++;
3530 * Look for reserved variable names and replace them with real values
3532 static char *fio_keyword_replace(char *opt)
3538 for (i = 0; fio_keywords[i].word != NULL; i++) {
3539 struct fio_keyword *kw = &fio_keywords[i];
3541 while ((s = strstr(opt, kw->word)) != NULL) {
3542 char *new = malloc(strlen(opt) + 1);
3548 * Copy part of the string before the keyword and
3549 * sprintf() the replacement after it.
3551 memcpy(new, opt, olen);
3552 len = sprintf(new + olen, "%s", kw->replace);
3555 * If there's more in the original string, copy that
3558 opt += strlen(kw->word) + olen;
3560 memcpy(new + olen + len, opt, opt - o_org - 1);
3563 * replace opt and free the old opt
3573 * Check for potential math and invoke bc, if possible
3581 static char **dup_and_sub_options(char **opts, int num_opts)
3584 char **opts_copy = malloc(num_opts * sizeof(*opts));
3585 for (i = 0; i < num_opts; i++) {
3586 opts_copy[i] = option_dup_subs(opts[i]);
3589 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3594 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3596 int i, ret, unknown;
3599 sort_options(opts, fio_options, num_opts);
3600 opts_copy = dup_and_sub_options(opts, num_opts);
3602 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3603 struct fio_option *o;
3604 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3613 opts_copy[i] = NULL;
3620 ret |= ioengine_load(td);
3622 sort_options(opts_copy, td->io_ops->options, num_opts);
3625 for (i = 0; i < num_opts; i++) {
3626 struct fio_option *o = NULL;
3632 newret = parse_option(opts_copy[i], opts[i],
3633 td->io_ops->options, &o,
3638 log_err("Bad option <%s>\n", opts[i]);
3641 opts_copy[i] = NULL;
3649 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3651 return parse_cmd_option(opt, val, fio_options, td);
3654 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3657 return parse_cmd_option(opt, val, td->io_ops->options, td);
3660 void fio_fill_default_options(struct thread_data *td)
3662 fill_default_options(td, fio_options);
3665 int fio_show_option_help(const char *opt)
3667 return show_cmd_help(fio_options, opt);
3670 void options_mem_dupe(void *data, struct fio_option *options)
3672 struct fio_option *o;
3675 for (o = &options[0]; o->name; o++) {
3676 if (o->type != FIO_OPT_STR_STORE)
3679 ptr = td_var(data, o->off1);
3681 *ptr = strdup(*ptr);
3686 * dupe FIO_OPT_STR_STORE options
3688 void fio_options_mem_dupe(struct thread_data *td)
3690 options_mem_dupe(&td->o, fio_options);
3692 if (td->eo && td->io_ops) {
3693 void *oldeo = td->eo;
3695 td->eo = malloc(td->io_ops->option_struct_size);
3696 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3697 options_mem_dupe(td->eo, td->io_ops->options);
3701 unsigned int fio_get_kb_base(void *data)
3703 struct thread_data *td = data;
3704 unsigned int kb_base = 0;
3707 kb_base = td->o.kb_base;
3714 int add_option(struct fio_option *o)
3716 struct fio_option *__o;
3725 memcpy(&fio_options[opt_index], o, sizeof(*o));
3729 void invalidate_profile_options(const char *prof_name)
3731 struct fio_option *o;
3735 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3736 o->type = FIO_OPT_INVALID;
3737 o->prof_name = NULL;
3743 void add_opt_posval(const char *optname, const char *ival, const char *help)
3745 struct fio_option *o;
3748 o = find_option(fio_options, optname);
3752 for (i = 0; i < PARSE_MAX_VP; i++) {
3753 if (o->posval[i].ival)
3756 o->posval[i].ival = ival;
3757 o->posval[i].help = help;
3762 void del_opt_posval(const char *optname, const char *ival)
3764 struct fio_option *o;
3767 o = find_option(fio_options, optname);
3771 for (i = 0; i < PARSE_MAX_VP; i++) {
3772 if (!o->posval[i].ival)
3774 if (strcmp(o->posval[i].ival, ival))
3777 o->posval[i].ival = NULL;
3778 o->posval[i].help = NULL;
3782 void fio_options_free(struct thread_data *td)
3784 options_free(fio_options, td);
3785 if (td->eo && td->io_ops && td->io_ops->options) {
3786 options_free(td->io_ops->options, td->eo);