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)) {
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)
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 < 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 o->min_bs[ddir] = min_bs;
155 o->max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 o->bssplit[ddir] = bssplit;
165 static int str_bssplit_cb(void *data, const char *input)
167 struct thread_data *td = data;
168 char *str, *p, *odir, *ddir;
171 p = str = strdup(input);
173 strip_blank_front(&str);
174 strip_blank_end(str);
176 odir = strchr(str, ',');
178 ddir = strchr(odir + 1, ',');
180 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
186 op = strdup(odir + 1);
187 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
192 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
195 ret = bssplit_ddir(&td->o, DDIR_READ, str);
201 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
206 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
209 ret = bssplit_ddir(&td->o, DDIR_READ, str);
216 static int str2error(char *str)
218 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
219 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
220 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
221 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
222 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
223 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
224 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
225 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
226 int i = 0, num = sizeof(err) / sizeof(void *);
229 if (!strcmp(err[i], str))
236 static int ignore_error_type(struct thread_data *td, int etype, char *str)
242 if (etype >= ERROR_TYPE_CNT) {
243 log_err("Illegal error type\n");
247 td->o.ignore_error_nr[etype] = 4;
248 error = malloc(4 * sizeof(struct bssplit));
251 while ((fname = strsep(&str, ":")) != NULL) {
257 * grow struct buffer, if needed
259 if (i == td->o.ignore_error_nr[etype]) {
260 td->o.ignore_error_nr[etype] <<= 1;
261 error = realloc(error, td->o.ignore_error_nr[etype]
264 if (fname[0] == 'E') {
265 error[i] = str2error(fname);
267 error[i] = atoi(fname);
272 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 struct thread_options *o = &td->o;
316 char *nr = get_opt_postfix(str);
325 o->ddir_seq_nr = atoi(nr);
329 if (str_to_decimal(nr, &val, 1, o)) {
330 log_err("fio: rw postfix parsing failed\n");
335 o->ddir_seq_add = val;
342 static int str_mem_cb(void *data, const char *mem)
344 struct thread_data *td = data;
346 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
347 td->o.mmapfile = get_opt_postfix(mem);
352 static int fio_clock_source_cb(void *data, const char *str)
354 struct thread_data *td = data;
356 fio_clock_source = td->o.clocksource;
357 fio_clock_source_set = 1;
362 static int str_rwmix_read_cb(void *data, unsigned long long *val)
364 struct thread_data *td = data;
366 td->o.rwmix[DDIR_READ] = *val;
367 td->o.rwmix[DDIR_WRITE] = 100 - *val;
371 static int str_rwmix_write_cb(void *data, unsigned long long *val)
373 struct thread_data *td = data;
375 td->o.rwmix[DDIR_WRITE] = *val;
376 td->o.rwmix[DDIR_READ] = 100 - *val;
380 static int str_exitall_cb(void)
382 exitall_on_terminate = 1;
386 #ifdef FIO_HAVE_CPU_AFFINITY
387 static int str_cpumask_cb(void *data, unsigned long long *val)
389 struct thread_data *td = data;
394 ret = fio_cpuset_init(&td->o.cpumask);
396 log_err("fio: cpuset_init failed\n");
397 td_verror(td, ret, "fio_cpuset_init");
401 max_cpu = cpus_online();
403 for (i = 0; i < sizeof(int) * 8; i++) {
404 if ((1 << i) & *val) {
406 log_err("fio: CPU %d too large (max=%ld)\n", i,
410 dprint(FD_PARSE, "set cpu allowed %d\n", i);
411 fio_cpu_set(&td->o.cpumask, i);
415 td->o.cpumask_set = 1;
419 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
426 ret = fio_cpuset_init(mask);
428 log_err("fio: cpuset_init failed\n");
429 td_verror(td, ret, "fio_cpuset_init");
433 p = str = strdup(input);
435 strip_blank_front(&str);
436 strip_blank_end(str);
438 max_cpu = cpus_online();
440 while ((cpu = strsep(&str, ",")) != NULL) {
449 while ((cpu2 = strsep(&str2, "-")) != NULL) {
459 while (icpu <= icpu2) {
460 if (icpu >= FIO_MAX_CPUS) {
461 log_err("fio: your OS only supports up to"
462 " %d CPUs\n", (int) FIO_MAX_CPUS);
466 if (icpu > max_cpu) {
467 log_err("fio: CPU %d too large (max=%ld)\n",
473 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
474 fio_cpu_set(mask, icpu);
483 td->o.cpumask_set = 1;
487 static int str_cpus_allowed_cb(void *data, const char *input)
489 struct thread_data *td = data;
492 ret = set_cpus_allowed(td, &td->o.cpumask, input);
494 td->o.cpumask_set = 1;
499 static int str_verify_cpus_allowed_cb(void *data, const char *input)
501 struct thread_data *td = data;
504 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
506 td->o.verify_cpumask_set = 1;
512 #ifdef CONFIG_LIBNUMA
513 static int str_numa_cpunodes_cb(void *data, char *input)
515 struct thread_data *td = data;
517 /* numa_parse_nodestring() parses a character string list
518 * of nodes into a bit mask. The bit mask is allocated by
519 * numa_allocate_nodemask(), so it should be freed by
520 * numa_free_nodemask().
522 td->o.numa_cpunodesmask = numa_parse_nodestring(input);
523 if (td->o.numa_cpunodesmask == NULL) {
524 log_err("fio: numa_parse_nodestring failed\n");
525 td_verror(td, 1, "str_numa_cpunodes_cb");
529 td->o.numa_cpumask_set = 1;
533 static int str_numa_mpol_cb(void *data, char *input)
535 struct thread_data *td = data;
536 const char * const policy_types[] =
537 { "default", "prefer", "bind", "interleave", "local", NULL };
540 char *nodelist = strchr(input, ':');
542 /* NUL-terminate mode */
546 for (i = 0; i <= MPOL_LOCAL; i++) {
547 if (!strcmp(input, policy_types[i])) {
548 td->o.numa_mem_mode = i;
552 if (i > MPOL_LOCAL) {
553 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
557 switch (td->o.numa_mem_mode) {
560 * Insist on a nodelist of one node only
563 char *rest = nodelist;
564 while (isdigit(*rest))
567 log_err("fio: one node only for \'prefer\'\n");
571 log_err("fio: one node is needed for \'prefer\'\n");
575 case MPOL_INTERLEAVE:
577 * Default to online nodes with memory if no nodelist
580 nodelist = strdup("all");
585 * Don't allow a nodelist
588 log_err("fio: NO nodelist for \'local\'\n");
594 * Insist on a nodelist
597 log_err("fio: a nodelist is needed for \'bind\'\n");
604 /* numa_parse_nodestring() parses a character string list
605 * of nodes into a bit mask. The bit mask is allocated by
606 * numa_allocate_nodemask(), so it should be freed by
607 * numa_free_nodemask().
609 switch (td->o.numa_mem_mode) {
611 td->o.numa_mem_prefer_node = atoi(nodelist);
613 case MPOL_INTERLEAVE:
615 td->o.numa_memnodesmask = numa_parse_nodestring(nodelist);
616 if (td->o.numa_memnodesmask == NULL) {
617 log_err("fio: numa_parse_nodestring failed\n");
618 td_verror(td, 1, "str_numa_memnodes_cb");
628 td->o.numa_memmask_set = 1;
636 static int str_fst_cb(void *data, const char *str)
638 struct thread_data *td = data;
639 char *nr = get_opt_postfix(str);
641 td->file_service_nr = 1;
643 td->file_service_nr = atoi(nr);
650 #ifdef CONFIG_SYNC_FILE_RANGE
651 static int str_sfr_cb(void *data, const char *str)
653 struct thread_data *td = data;
654 char *nr = get_opt_postfix(str);
656 td->sync_file_range_nr = 1;
658 td->sync_file_range_nr = atoi(nr);
666 static int str_random_distribution_cb(void *data, const char *str)
668 struct thread_data *td = data;
672 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
674 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
679 nr = get_opt_postfix(str);
680 if (nr && !str_to_float(nr, &val)) {
681 log_err("fio: random postfix parsing failed\n");
688 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
690 log_err("fio: zipf theta must different than 1.0\n");
693 td->o.zipf_theta.u.f = val;
695 if (val <= 0.00 || val >= 1.00) {
696 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
699 td->o.pareto_h.u.f = val;
706 * Return next file in the string. Files are separated with ':'. If the ':'
707 * is escaped with a '\', then that ':' is part of the filename and does not
708 * indicate a new file.
710 static char *get_next_file_name(char **ptr)
715 if (!str || !strlen(str))
721 * No colon, we are done
723 p = strchr(str, ':');
730 * We got a colon, but it's the first character. Skip and
738 if (*(p - 1) != '\\') {
744 memmove(p - 1, p, strlen(p) + 1);
751 static int str_filename_cb(void *data, const char *input)
753 struct thread_data *td = data;
754 char *fname, *str, *p;
756 p = str = strdup(input);
758 strip_blank_front(&str);
759 strip_blank_end(str);
761 if (!td->files_index)
764 while ((fname = get_next_file_name(&str)) != NULL) {
775 static int str_directory_cb(void *data, const char fio_unused *str)
777 struct thread_data *td = data;
783 if (lstat(td->o.directory, &sb) < 0) {
786 log_err("fio: %s is not a directory\n", td->o.directory);
787 td_verror(td, ret, "lstat");
790 if (!S_ISDIR(sb.st_mode)) {
791 log_err("fio: %s is not a directory\n", td->o.directory);
798 static int str_opendir_cb(void *data, const char fio_unused *str)
800 struct thread_data *td = data;
802 if (!td->files_index)
805 return add_dir_files(td, td->o.opendir);
808 static int str_verify_pattern_cb(void *data, const char *input)
810 struct thread_data *td = data;
812 int i = 0, j = 0, len, k, base = 10, pattern_length;
815 loc1 = strstr(input, "0x");
816 loc2 = strstr(input, "0X");
819 off = strtol(input, NULL, base);
820 if (off != LONG_MAX || errno != ERANGE) {
822 td->o.verify_pattern[i] = off & 0xff;
831 j = loc1 - input + 2;
833 j = loc2 - input + 2;
836 if (len - j < MAX_PATTERN_SIZE * 2) {
838 off = converthexchartoint(input[k--]);
840 off += (converthexchartoint(input[k--])
842 td->o.verify_pattern[i++] = (char) off;
848 * Fill the pattern all the way to the end. This greatly reduces
849 * the number of memcpy's we have to do when verifying the IO.
852 while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) {
853 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i);
858 * Fill remainder, if the pattern multiple ends up not being
861 while (i > 1 && i < MAX_PATTERN_SIZE) {
862 unsigned int b = min(pattern_length, MAX_PATTERN_SIZE - i);
864 memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], b);
870 * The code in verify_io_u_pattern assumes a single byte pattern
871 * fills the whole verify pattern buffer.
873 memset(td->o.verify_pattern, td->o.verify_pattern[0],
877 td->o.verify_pattern_bytes = i;
880 * VERIFY_META could already be set
882 if (td->o.verify == VERIFY_NONE)
883 td->o.verify = VERIFY_PATTERN;
888 static int str_gtod_reduce_cb(void *data, int *il)
890 struct thread_data *td = data;
893 td->o.disable_lat = !!val;
894 td->o.disable_clat = !!val;
895 td->o.disable_slat = !!val;
896 td->o.disable_bw = !!val;
897 td->o.clat_percentiles = !val;
899 td->tv_cache_mask = 63;
904 static int str_gtod_cpu_cb(void *data, long long *il)
906 struct thread_data *td = data;
909 td->o.gtod_cpu = val;
910 td->o.gtod_offload = 1;
914 static int str_size_cb(void *data, unsigned long long *__val)
916 struct thread_data *td = data;
917 unsigned long long v = *__val;
919 if (parse_is_percent(v)) {
921 td->o.size_percent = -1ULL - v;
928 static int rw_verify(struct fio_option *o, void *data)
930 struct thread_data *td = data;
932 if (read_only && td_write(td)) {
933 log_err("fio: job <%s> has write bit set, but fio is in"
934 " read-only mode\n", td->o.name);
941 static int gtod_cpu_verify(struct fio_option *o, void *data)
943 #ifndef FIO_HAVE_CPU_AFFINITY
944 struct thread_data *td = data;
946 if (td->o.gtod_cpu) {
947 log_err("fio: platform must support CPU affinity for"
948 "gettimeofday() offloading\n");
959 static struct opt_group fio_opt_groups[] = {
962 .mask = FIO_OPT_C_GENERAL,
966 .mask = FIO_OPT_C_IO,
970 .mask = FIO_OPT_C_FILE,
973 .name = "Statistics",
974 .mask = FIO_OPT_C_STAT,
978 .mask = FIO_OPT_C_LOG,
982 .mask = FIO_OPT_C_PROFILE,
989 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
990 unsigned int inv_mask)
992 struct opt_group *og;
995 if (*mask == inv_mask || !*mask)
998 for (i = 0; ogs[i].name; i++) {
1001 if (*mask & og->mask) {
1002 *mask &= ~(og->mask);
1010 struct opt_group *opt_group_from_mask(unsigned int *mask)
1012 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1015 static struct opt_group fio_opt_cat_groups[] = {
1018 .mask = FIO_OPT_G_RATE,
1022 .mask = FIO_OPT_G_ZONE,
1025 .name = "Read/write mix",
1026 .mask = FIO_OPT_G_RWMIX,
1030 .mask = FIO_OPT_G_VERIFY,
1034 .mask = FIO_OPT_G_TRIM,
1037 .name = "I/O Logging",
1038 .mask = FIO_OPT_G_IOLOG,
1041 .name = "I/O Depth",
1042 .mask = FIO_OPT_G_IO_DEPTH,
1046 .mask = FIO_OPT_G_IO_FLOW,
1049 .name = "Description",
1050 .mask = FIO_OPT_G_DESC,
1054 .mask = FIO_OPT_G_FILENAME,
1057 .name = "General I/O",
1058 .mask = FIO_OPT_G_IO_BASIC,
1062 .mask = FIO_OPT_G_CGROUP,
1066 .mask = FIO_OPT_G_RUNTIME,
1070 .mask = FIO_OPT_G_PROCESS,
1073 .name = "Job credentials / priority",
1074 .mask = FIO_OPT_G_CRED,
1077 .name = "Clock settings",
1078 .mask = FIO_OPT_G_CLOCK,
1082 .mask = FIO_OPT_G_IO_TYPE,
1085 .name = "I/O Thinktime",
1086 .mask = FIO_OPT_G_THINKTIME,
1089 .name = "Randomizations",
1090 .mask = FIO_OPT_G_RANDOM,
1093 .name = "I/O buffers",
1094 .mask = FIO_OPT_G_IO_BUF,
1097 .name = "Tiobench profile",
1098 .mask = FIO_OPT_G_TIOBENCH,
1106 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1108 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1112 * Map of job/command line options
1114 struct fio_option fio_options[FIO_MAX_OPTS] = {
1116 .name = "description",
1117 .lname = "Description of job",
1118 .type = FIO_OPT_STR_STORE,
1119 .off1 = td_var_offset(description),
1120 .help = "Text job description",
1121 .category = FIO_OPT_C_GENERAL,
1122 .group = FIO_OPT_G_DESC,
1126 .lname = "Job name",
1127 .type = FIO_OPT_STR_STORE,
1128 .off1 = td_var_offset(name),
1129 .help = "Name of this job",
1130 .category = FIO_OPT_C_GENERAL,
1131 .group = FIO_OPT_G_DESC,
1135 .lname = "Filename(s)",
1136 .type = FIO_OPT_STR_STORE,
1137 .off1 = td_var_offset(filename),
1138 .cb = str_filename_cb,
1139 .prio = -1, /* must come after "directory" */
1140 .help = "File(s) to use for the workload",
1141 .category = FIO_OPT_C_FILE,
1142 .group = FIO_OPT_G_FILENAME,
1145 .name = "directory",
1146 .lname = "Directory",
1147 .type = FIO_OPT_STR_STORE,
1148 .off1 = td_var_offset(directory),
1149 .cb = str_directory_cb,
1150 .help = "Directory to store files in",
1151 .category = FIO_OPT_C_FILE,
1152 .group = FIO_OPT_G_FILENAME,
1155 .name = "filename_format",
1156 .type = FIO_OPT_STR_STORE,
1157 .off1 = td_var_offset(filename_format),
1158 .prio = -1, /* must come after "directory" */
1159 .help = "Override default $jobname.$jobnum.$filenum naming",
1160 .def = "$jobname.$jobnum.$filenum",
1161 .category = FIO_OPT_C_FILE,
1162 .group = FIO_OPT_G_FILENAME,
1166 .lname = "Lockfile",
1167 .type = FIO_OPT_STR,
1168 .off1 = td_var_offset(file_lock_mode),
1169 .help = "Lock file when doing IO to it",
1170 .parent = "filename",
1173 .category = FIO_OPT_C_FILE,
1174 .group = FIO_OPT_G_FILENAME,
1177 .oval = FILE_LOCK_NONE,
1178 .help = "No file locking",
1180 { .ival = "exclusive",
1181 .oval = FILE_LOCK_EXCLUSIVE,
1182 .help = "Exclusive file lock",
1185 .ival = "readwrite",
1186 .oval = FILE_LOCK_READWRITE,
1187 .help = "Read vs write lock",
1193 .lname = "Open directory",
1194 .type = FIO_OPT_STR_STORE,
1195 .off1 = td_var_offset(opendir),
1196 .cb = str_opendir_cb,
1197 .help = "Recursively add files from this directory and down",
1198 .category = FIO_OPT_C_FILE,
1199 .group = FIO_OPT_G_FILENAME,
1203 .lname = "Read/write",
1204 .alias = "readwrite",
1205 .type = FIO_OPT_STR,
1207 .off1 = td_var_offset(td_ddir),
1208 .help = "IO direction",
1210 .verify = rw_verify,
1211 .category = FIO_OPT_C_IO,
1212 .group = FIO_OPT_G_IO_BASIC,
1215 .oval = TD_DDIR_READ,
1216 .help = "Sequential read",
1219 .oval = TD_DDIR_WRITE,
1220 .help = "Sequential write",
1223 .oval = TD_DDIR_TRIM,
1224 .help = "Sequential trim",
1226 { .ival = "randread",
1227 .oval = TD_DDIR_RANDREAD,
1228 .help = "Random read",
1230 { .ival = "randwrite",
1231 .oval = TD_DDIR_RANDWRITE,
1232 .help = "Random write",
1234 { .ival = "randtrim",
1235 .oval = TD_DDIR_RANDTRIM,
1236 .help = "Random trim",
1240 .help = "Sequential read and write mix",
1242 { .ival = "readwrite",
1244 .help = "Sequential read and write mix",
1247 .oval = TD_DDIR_RANDRW,
1248 .help = "Random read and write mix"
1253 .name = "rw_sequencer",
1254 .lname = "RW Sequencer",
1255 .type = FIO_OPT_STR,
1256 .off1 = td_var_offset(rw_seq),
1257 .help = "IO offset generator modifier",
1258 .def = "sequential",
1259 .category = FIO_OPT_C_IO,
1260 .group = FIO_OPT_G_IO_BASIC,
1262 { .ival = "sequential",
1264 .help = "Generate sequential offsets",
1266 { .ival = "identical",
1267 .oval = RW_SEQ_IDENT,
1268 .help = "Generate identical offsets",
1275 .lname = "IO Engine",
1276 .type = FIO_OPT_STR_STORE,
1277 .off1 = td_var_offset(ioengine),
1278 .help = "IO engine to use",
1279 .def = FIO_PREFERRED_ENGINE,
1280 .category = FIO_OPT_C_IO,
1281 .group = FIO_OPT_G_IO_BASIC,
1284 .help = "Use read/write",
1287 .help = "Use pread/pwrite",
1290 .help = "Use readv/writev",
1292 #ifdef CONFIG_PWRITEV
1294 .help = "Use preadv/pwritev",
1297 #ifdef CONFIG_LIBAIO
1299 .help = "Linux native asynchronous IO",
1302 #ifdef CONFIG_POSIXAIO
1303 { .ival = "posixaio",
1304 .help = "POSIX asynchronous IO",
1307 #ifdef CONFIG_SOLARISAIO
1308 { .ival = "solarisaio",
1309 .help = "Solaris native asynchronous IO",
1312 #ifdef CONFIG_WINDOWSAIO
1313 { .ival = "windowsaio",
1314 .help = "Windows native asynchronous IO"
1318 .help = "Memory mapped IO"
1320 #ifdef CONFIG_LINUX_SPLICE
1322 .help = "splice/vmsplice based IO",
1324 { .ival = "netsplice",
1325 .help = "splice/vmsplice to/from the network",
1328 #ifdef FIO_HAVE_SGIO
1330 .help = "SCSI generic v3 IO",
1334 .help = "Testing engine (no data transfer)",
1337 .help = "Network IO",
1340 .help = "CPU cycle burner engine",
1344 .help = "GUASI IO engine",
1347 #ifdef FIO_HAVE_BINJECT
1348 { .ival = "binject",
1349 .help = "binject direct inject block engine",
1354 .help = "RDMA IO engine",
1357 #ifdef CONFIG_FUSION_AW
1358 { .ival = "fusion-aw-sync",
1359 .help = "Fusion-io atomic write engine",
1362 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1363 { .ival = "e4defrag",
1364 .help = "ext4 defrag engine",
1367 #ifdef CONFIG_LINUX_FALLOCATE
1369 .help = "fallocate() file based engine",
1372 { .ival = "external",
1373 .help = "Load external engine (append name)",
1379 .lname = "IO Depth",
1380 .type = FIO_OPT_INT,
1381 .off1 = td_var_offset(iodepth),
1382 .help = "Number of IO buffers to keep in flight",
1386 .category = FIO_OPT_C_IO,
1387 .group = FIO_OPT_G_IO_BASIC,
1390 .name = "iodepth_batch",
1391 .lname = "IO Depth batch",
1392 .alias = "iodepth_batch_submit",
1393 .type = FIO_OPT_INT,
1394 .off1 = td_var_offset(iodepth_batch),
1395 .help = "Number of IO buffers to submit in one go",
1396 .parent = "iodepth",
1401 .category = FIO_OPT_C_IO,
1402 .group = FIO_OPT_G_IO_BASIC,
1405 .name = "iodepth_batch_complete",
1406 .lname = "IO Depth batch complete",
1407 .type = FIO_OPT_INT,
1408 .off1 = td_var_offset(iodepth_batch_complete),
1409 .help = "Number of IO buffers to retrieve in one go",
1410 .parent = "iodepth",
1415 .category = FIO_OPT_C_IO,
1416 .group = FIO_OPT_G_IO_BASIC,
1419 .name = "iodepth_low",
1420 .lname = "IO Depth batch low",
1421 .type = FIO_OPT_INT,
1422 .off1 = td_var_offset(iodepth_low),
1423 .help = "Low water mark for queuing depth",
1424 .parent = "iodepth",
1427 .category = FIO_OPT_C_IO,
1428 .group = FIO_OPT_G_IO_BASIC,
1433 .type = FIO_OPT_STR_VAL,
1435 .help = "Total size of device or files",
1436 .interval = 1024 * 1024,
1437 .category = FIO_OPT_C_IO,
1438 .group = FIO_OPT_G_INVALID,
1441 .name = "fill_device",
1442 .lname = "Fill device",
1444 .type = FIO_OPT_BOOL,
1445 .off1 = td_var_offset(fill_device),
1446 .help = "Write until an ENOSPC error occurs",
1448 .category = FIO_OPT_C_FILE,
1449 .group = FIO_OPT_G_INVALID,
1453 .lname = "File size",
1454 .type = FIO_OPT_STR_VAL,
1455 .off1 = td_var_offset(file_size_low),
1456 .off2 = td_var_offset(file_size_high),
1458 .help = "Size of individual files",
1459 .interval = 1024 * 1024,
1460 .category = FIO_OPT_C_FILE,
1461 .group = FIO_OPT_G_INVALID,
1465 .lname = "IO offset",
1466 .alias = "fileoffset",
1467 .type = FIO_OPT_STR_VAL,
1468 .off1 = td_var_offset(start_offset),
1469 .help = "Start IO from this offset",
1471 .interval = 1024 * 1024,
1472 .category = FIO_OPT_C_IO,
1473 .group = FIO_OPT_G_INVALID,
1476 .name = "offset_increment",
1477 .lname = "IO offset increment",
1478 .type = FIO_OPT_STR_VAL,
1479 .off1 = td_var_offset(offset_increment),
1480 .help = "What is the increment from one offset to the next",
1484 .interval = 1024 * 1024,
1485 .category = FIO_OPT_C_IO,
1486 .group = FIO_OPT_G_INVALID,
1489 .name = "number_ios",
1490 .lname = "Number of IOs to perform",
1491 .type = FIO_OPT_STR_VAL,
1492 .off1 = td_var_offset(number_ios),
1493 .help = "Force job completion of this number of IOs",
1495 .category = FIO_OPT_C_IO,
1496 .group = FIO_OPT_G_INVALID,
1500 .lname = "Block size",
1501 .alias = "blocksize",
1502 .type = FIO_OPT_INT,
1503 .off1 = td_var_offset(bs[DDIR_READ]),
1504 .off2 = td_var_offset(bs[DDIR_WRITE]),
1505 .off3 = td_var_offset(bs[DDIR_TRIM]),
1507 .help = "Block size unit",
1512 .category = FIO_OPT_C_IO,
1513 .group = FIO_OPT_G_INVALID,
1517 .lname = "Block size align",
1518 .alias = "blockalign",
1519 .type = FIO_OPT_INT,
1520 .off1 = td_var_offset(ba[DDIR_READ]),
1521 .off2 = td_var_offset(ba[DDIR_WRITE]),
1522 .off3 = td_var_offset(ba[DDIR_TRIM]),
1524 .help = "IO block offset alignment",
1528 .category = FIO_OPT_C_IO,
1529 .group = FIO_OPT_G_INVALID,
1533 .lname = "Block size range",
1534 .alias = "blocksize_range",
1535 .type = FIO_OPT_RANGE,
1536 .off1 = td_var_offset(min_bs[DDIR_READ]),
1537 .off2 = td_var_offset(max_bs[DDIR_READ]),
1538 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1539 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1540 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1541 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1543 .help = "Set block size range (in more detail than bs)",
1547 .category = FIO_OPT_C_IO,
1548 .group = FIO_OPT_G_INVALID,
1552 .lname = "Block size split",
1553 .type = FIO_OPT_STR,
1554 .cb = str_bssplit_cb,
1555 .help = "Set a specific mix of block sizes",
1558 .category = FIO_OPT_C_IO,
1559 .group = FIO_OPT_G_INVALID,
1562 .name = "bs_unaligned",
1563 .lname = "Block size unaligned",
1564 .alias = "blocksize_unaligned",
1565 .type = FIO_OPT_STR_SET,
1566 .off1 = td_var_offset(bs_unaligned),
1567 .help = "Don't sector align IO buffer sizes",
1570 .category = FIO_OPT_C_IO,
1571 .group = FIO_OPT_G_INVALID,
1574 .name = "bs_is_seq_rand",
1575 .lname = "Block size division is seq/random (not read/write)",
1576 .type = FIO_OPT_BOOL,
1577 .off1 = td_var_offset(bs_is_seq_rand),
1578 .help = "Consider any blocksize setting to be sequential,ramdom",
1580 .parent = "blocksize",
1581 .category = FIO_OPT_C_IO,
1582 .group = FIO_OPT_G_INVALID,
1585 .name = "randrepeat",
1586 .lname = "Random repeatable",
1587 .type = FIO_OPT_BOOL,
1588 .off1 = td_var_offset(rand_repeatable),
1589 .help = "Use repeatable random IO pattern",
1593 .category = FIO_OPT_C_IO,
1594 .group = FIO_OPT_G_RANDOM,
1597 .name = "use_os_rand",
1598 .lname = "Use OS random",
1599 .type = FIO_OPT_BOOL,
1600 .off1 = td_var_offset(use_os_rand),
1601 .help = "Set to use OS random generator",
1605 .category = FIO_OPT_C_IO,
1606 .group = FIO_OPT_G_RANDOM,
1609 .name = "norandommap",
1610 .lname = "No randommap",
1611 .type = FIO_OPT_STR_SET,
1612 .off1 = td_var_offset(norandommap),
1613 .help = "Accept potential duplicate random blocks",
1617 .category = FIO_OPT_C_IO,
1618 .group = FIO_OPT_G_RANDOM,
1621 .name = "softrandommap",
1622 .lname = "Soft randommap",
1623 .type = FIO_OPT_BOOL,
1624 .off1 = td_var_offset(softrandommap),
1625 .help = "Set norandommap if randommap allocation fails",
1626 .parent = "norandommap",
1629 .category = FIO_OPT_C_IO,
1630 .group = FIO_OPT_G_RANDOM,
1633 .name = "random_generator",
1634 .type = FIO_OPT_STR,
1635 .off1 = td_var_offset(random_generator),
1636 .help = "Type of random number generator to use",
1637 .def = "tausworthe",
1639 { .ival = "tausworthe",
1640 .oval = FIO_RAND_GEN_TAUSWORTHE,
1641 .help = "Strong Tausworthe generator",
1644 .oval = FIO_RAND_GEN_LFSR,
1645 .help = "Variable length LFSR",
1648 .category = FIO_OPT_C_IO,
1649 .group = FIO_OPT_G_RANDOM,
1652 .name = "random_distribution",
1653 .type = FIO_OPT_STR,
1654 .off1 = td_var_offset(random_distribution),
1655 .cb = str_random_distribution_cb,
1656 .help = "Random offset distribution generator",
1660 .oval = FIO_RAND_DIST_RANDOM,
1661 .help = "Completely random",
1664 .oval = FIO_RAND_DIST_ZIPF,
1665 .help = "Zipf distribution",
1668 .oval = FIO_RAND_DIST_PARETO,
1669 .help = "Pareto distribution",
1672 .category = FIO_OPT_C_IO,
1673 .group = FIO_OPT_G_RANDOM,
1676 .name = "percentage_random",
1677 .lname = "Percentage Random",
1678 .type = FIO_OPT_INT,
1679 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1680 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1681 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1683 .help = "Percentage of seq/random mix that should be random",
1684 .def = "100,100,100",
1686 .inverse = "percentage_sequential",
1687 .category = FIO_OPT_C_IO,
1688 .group = FIO_OPT_G_RANDOM,
1691 .name = "percentage_sequential",
1692 .lname = "Percentage Sequential",
1693 .type = FIO_OPT_DEPRECATED,
1694 .category = FIO_OPT_C_IO,
1695 .group = FIO_OPT_G_RANDOM,
1699 .lname = "Number of files",
1700 .alias = "nr_files",
1701 .type = FIO_OPT_INT,
1702 .off1 = td_var_offset(nr_files),
1703 .help = "Split job workload between this number of files",
1706 .category = FIO_OPT_C_FILE,
1707 .group = FIO_OPT_G_INVALID,
1710 .name = "openfiles",
1711 .lname = "Number of open files",
1712 .type = FIO_OPT_INT,
1713 .off1 = td_var_offset(open_files),
1714 .help = "Number of files to keep open at the same time",
1715 .category = FIO_OPT_C_FILE,
1716 .group = FIO_OPT_G_INVALID,
1719 .name = "file_service_type",
1720 .lname = "File service type",
1721 .type = FIO_OPT_STR,
1723 .off1 = td_var_offset(file_service_type),
1724 .help = "How to select which file to service next",
1725 .def = "roundrobin",
1726 .category = FIO_OPT_C_FILE,
1727 .group = FIO_OPT_G_INVALID,
1730 .oval = FIO_FSERVICE_RANDOM,
1731 .help = "Choose a file at random",
1733 { .ival = "roundrobin",
1734 .oval = FIO_FSERVICE_RR,
1735 .help = "Round robin select files",
1737 { .ival = "sequential",
1738 .oval = FIO_FSERVICE_SEQ,
1739 .help = "Finish one file before moving to the next",
1742 .parent = "nrfiles",
1745 #ifdef CONFIG_POSIX_FALLOCATE
1747 .name = "fallocate",
1748 .lname = "Fallocate",
1749 .type = FIO_OPT_STR,
1750 .off1 = td_var_offset(fallocate_mode),
1751 .help = "Whether pre-allocation is performed when laying out files",
1753 .category = FIO_OPT_C_FILE,
1754 .group = FIO_OPT_G_INVALID,
1757 .oval = FIO_FALLOCATE_NONE,
1758 .help = "Do not pre-allocate space",
1761 .oval = FIO_FALLOCATE_POSIX,
1762 .help = "Use posix_fallocate()",
1764 #ifdef CONFIG_LINUX_FALLOCATE
1766 .oval = FIO_FALLOCATE_KEEP_SIZE,
1767 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1770 /* Compatibility with former boolean values */
1772 .oval = FIO_FALLOCATE_NONE,
1773 .help = "Alias for 'none'",
1776 .oval = FIO_FALLOCATE_POSIX,
1777 .help = "Alias for 'posix'",
1781 #endif /* CONFIG_POSIX_FALLOCATE */
1783 .name = "fadvise_hint",
1784 .lname = "Fadvise hint",
1785 .type = FIO_OPT_BOOL,
1786 .off1 = td_var_offset(fadvise_hint),
1787 .help = "Use fadvise() to advise the kernel on IO pattern",
1789 .category = FIO_OPT_C_FILE,
1790 .group = FIO_OPT_G_INVALID,
1795 .type = FIO_OPT_INT,
1796 .off1 = td_var_offset(fsync_blocks),
1797 .help = "Issue fsync for writes every given number of blocks",
1800 .category = FIO_OPT_C_FILE,
1801 .group = FIO_OPT_G_INVALID,
1804 .name = "fdatasync",
1805 .lname = "Fdatasync",
1806 .type = FIO_OPT_INT,
1807 .off1 = td_var_offset(fdatasync_blocks),
1808 .help = "Issue fdatasync for writes every given number of blocks",
1811 .category = FIO_OPT_C_FILE,
1812 .group = FIO_OPT_G_INVALID,
1815 .name = "write_barrier",
1816 .lname = "Write barrier",
1817 .type = FIO_OPT_INT,
1818 .off1 = td_var_offset(barrier_blocks),
1819 .help = "Make every Nth write a barrier write",
1822 .category = FIO_OPT_C_IO,
1823 .group = FIO_OPT_G_INVALID,
1825 #ifdef CONFIG_SYNC_FILE_RANGE
1827 .name = "sync_file_range",
1828 .lname = "Sync file range",
1830 { .ival = "wait_before",
1831 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1832 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1836 .oval = SYNC_FILE_RANGE_WRITE,
1837 .help = "SYNC_FILE_RANGE_WRITE",
1841 .ival = "wait_after",
1842 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1843 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1847 .type = FIO_OPT_STR_MULTI,
1849 .off1 = td_var_offset(sync_file_range),
1850 .help = "Use sync_file_range()",
1851 .category = FIO_OPT_C_FILE,
1852 .group = FIO_OPT_G_INVALID,
1857 .lname = "Direct I/O",
1858 .type = FIO_OPT_BOOL,
1859 .off1 = td_var_offset(odirect),
1860 .help = "Use O_DIRECT IO (negates buffered)",
1862 .inverse = "buffered",
1863 .category = FIO_OPT_C_IO,
1864 .group = FIO_OPT_G_IO_TYPE,
1868 .lname = "Buffered I/O",
1869 .type = FIO_OPT_BOOL,
1870 .off1 = td_var_offset(odirect),
1872 .help = "Use buffered IO (negates direct)",
1874 .inverse = "direct",
1875 .category = FIO_OPT_C_IO,
1876 .group = FIO_OPT_G_IO_TYPE,
1879 .name = "overwrite",
1880 .lname = "Overwrite",
1881 .type = FIO_OPT_BOOL,
1882 .off1 = td_var_offset(overwrite),
1883 .help = "When writing, set whether to overwrite current data",
1885 .category = FIO_OPT_C_FILE,
1886 .group = FIO_OPT_G_INVALID,
1891 .type = FIO_OPT_INT,
1892 .off1 = td_var_offset(loops),
1893 .help = "Number of times to run the job",
1896 .category = FIO_OPT_C_GENERAL,
1897 .group = FIO_OPT_G_RUNTIME,
1901 .lname = "Number of jobs",
1902 .type = FIO_OPT_INT,
1903 .off1 = td_var_offset(numjobs),
1904 .help = "Duplicate this job this many times",
1907 .category = FIO_OPT_C_GENERAL,
1908 .group = FIO_OPT_G_RUNTIME,
1911 .name = "startdelay",
1912 .lname = "Start delay",
1913 .type = FIO_OPT_STR_VAL_TIME,
1914 .off1 = td_var_offset(start_delay),
1915 .help = "Only start job when this period has passed",
1917 .category = FIO_OPT_C_GENERAL,
1918 .group = FIO_OPT_G_RUNTIME,
1924 .type = FIO_OPT_STR_VAL_TIME,
1925 .off1 = td_var_offset(timeout),
1926 .help = "Stop workload when this amount of time has passed",
1928 .category = FIO_OPT_C_GENERAL,
1929 .group = FIO_OPT_G_RUNTIME,
1932 .name = "time_based",
1933 .lname = "Time based",
1934 .type = FIO_OPT_STR_SET,
1935 .off1 = td_var_offset(time_based),
1936 .help = "Keep running until runtime/timeout is met",
1937 .category = FIO_OPT_C_GENERAL,
1938 .group = FIO_OPT_G_RUNTIME,
1941 .name = "ramp_time",
1942 .lname = "Ramp time",
1943 .type = FIO_OPT_STR_VAL_TIME,
1944 .off1 = td_var_offset(ramp_time),
1945 .help = "Ramp up time before measuring performance",
1946 .category = FIO_OPT_C_GENERAL,
1947 .group = FIO_OPT_G_RUNTIME,
1950 .name = "clocksource",
1951 .lname = "Clock source",
1952 .type = FIO_OPT_STR,
1953 .cb = fio_clock_source_cb,
1954 .off1 = td_var_offset(clocksource),
1955 .help = "What type of timing source to use",
1956 .category = FIO_OPT_C_GENERAL,
1957 .group = FIO_OPT_G_CLOCK,
1959 #ifdef CONFIG_GETTIMEOFDAY
1960 { .ival = "gettimeofday",
1962 .help = "Use gettimeofday(2) for timing",
1965 #ifdef CONFIG_CLOCK_GETTIME
1966 { .ival = "clock_gettime",
1967 .oval = CS_CGETTIME,
1968 .help = "Use clock_gettime(2) for timing",
1971 #ifdef ARCH_HAVE_CPU_CLOCK
1973 .oval = CS_CPUCLOCK,
1974 .help = "Use CPU private clock",
1982 .lname = "I/O Memory",
1983 .type = FIO_OPT_STR,
1985 .off1 = td_var_offset(mem_type),
1986 .help = "Backing type for IO buffers",
1988 .category = FIO_OPT_C_IO,
1989 .group = FIO_OPT_G_INVALID,
1993 .help = "Use malloc(3) for IO buffers",
1997 .help = "Use shared memory segments for IO buffers",
1999 #ifdef FIO_HAVE_HUGETLB
2000 { .ival = "shmhuge",
2001 .oval = MEM_SHMHUGE,
2002 .help = "Like shm, but use huge pages",
2007 .help = "Use mmap(2) (file or anon) for IO buffers",
2009 #ifdef FIO_HAVE_HUGETLB
2010 { .ival = "mmaphuge",
2011 .oval = MEM_MMAPHUGE,
2012 .help = "Like mmap, but use huge pages",
2018 .name = "iomem_align",
2019 .alias = "mem_align",
2020 .lname = "I/O memory alignment",
2021 .type = FIO_OPT_INT,
2022 .off1 = td_var_offset(mem_align),
2024 .help = "IO memory buffer offset alignment",
2028 .category = FIO_OPT_C_IO,
2029 .group = FIO_OPT_G_INVALID,
2034 .type = FIO_OPT_STR,
2035 .off1 = td_var_offset(verify),
2036 .help = "Verify data written",
2038 .category = FIO_OPT_C_IO,
2039 .group = FIO_OPT_G_VERIFY,
2042 .oval = VERIFY_NONE,
2043 .help = "Don't do IO verification",
2047 .help = "Use md5 checksums for verification",
2050 .oval = VERIFY_CRC64,
2051 .help = "Use crc64 checksums for verification",
2054 .oval = VERIFY_CRC32,
2055 .help = "Use crc32 checksums for verification",
2057 { .ival = "crc32c-intel",
2058 .oval = VERIFY_CRC32C,
2059 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2062 .oval = VERIFY_CRC32C,
2063 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2066 .oval = VERIFY_CRC16,
2067 .help = "Use crc16 checksums for verification",
2070 .oval = VERIFY_CRC7,
2071 .help = "Use crc7 checksums for verification",
2074 .oval = VERIFY_SHA1,
2075 .help = "Use sha1 checksums for verification",
2078 .oval = VERIFY_SHA256,
2079 .help = "Use sha256 checksums for verification",
2082 .oval = VERIFY_SHA512,
2083 .help = "Use sha512 checksums for verification",
2086 .oval = VERIFY_META,
2087 .help = "Use io information",
2091 .oval = VERIFY_NULL,
2092 .help = "Pretend to verify",
2097 .name = "do_verify",
2098 .lname = "Perform verify step",
2099 .type = FIO_OPT_BOOL,
2100 .off1 = td_var_offset(do_verify),
2101 .help = "Run verification stage after write",
2105 .category = FIO_OPT_C_IO,
2106 .group = FIO_OPT_G_VERIFY,
2109 .name = "verifysort",
2110 .lname = "Verify sort",
2111 .type = FIO_OPT_BOOL,
2112 .off1 = td_var_offset(verifysort),
2113 .help = "Sort written verify blocks for read back",
2117 .category = FIO_OPT_C_IO,
2118 .group = FIO_OPT_G_VERIFY,
2121 .name = "verifysort_nr",
2122 .type = FIO_OPT_INT,
2123 .off1 = td_var_offset(verifysort_nr),
2124 .help = "Pre-load and sort verify blocks for a read workload",
2129 .category = FIO_OPT_C_IO,
2130 .group = FIO_OPT_G_VERIFY,
2133 .name = "verify_interval",
2134 .lname = "Verify interval",
2135 .type = FIO_OPT_INT,
2136 .off1 = td_var_offset(verify_interval),
2137 .minval = 2 * sizeof(struct verify_header),
2138 .help = "Store verify buffer header every N bytes",
2141 .interval = 2 * sizeof(struct verify_header),
2142 .category = FIO_OPT_C_IO,
2143 .group = FIO_OPT_G_VERIFY,
2146 .name = "verify_offset",
2147 .lname = "Verify offset",
2148 .type = FIO_OPT_INT,
2149 .help = "Offset verify header location by N bytes",
2150 .off1 = td_var_offset(verify_offset),
2151 .minval = sizeof(struct verify_header),
2154 .category = FIO_OPT_C_IO,
2155 .group = FIO_OPT_G_VERIFY,
2158 .name = "verify_pattern",
2159 .lname = "Verify pattern",
2160 .type = FIO_OPT_STR,
2161 .cb = str_verify_pattern_cb,
2162 .help = "Fill pattern for IO buffers",
2165 .category = FIO_OPT_C_IO,
2166 .group = FIO_OPT_G_VERIFY,
2169 .name = "verify_fatal",
2170 .lname = "Verify fatal",
2171 .type = FIO_OPT_BOOL,
2172 .off1 = td_var_offset(verify_fatal),
2174 .help = "Exit on a single verify failure, don't continue",
2177 .category = FIO_OPT_C_IO,
2178 .group = FIO_OPT_G_VERIFY,
2181 .name = "verify_dump",
2182 .lname = "Verify dump",
2183 .type = FIO_OPT_BOOL,
2184 .off1 = td_var_offset(verify_dump),
2186 .help = "Dump contents of good and bad blocks on failure",
2189 .category = FIO_OPT_C_IO,
2190 .group = FIO_OPT_G_VERIFY,
2193 .name = "verify_async",
2194 .lname = "Verify asynchronously",
2195 .type = FIO_OPT_INT,
2196 .off1 = td_var_offset(verify_async),
2198 .help = "Number of async verifier threads to use",
2201 .category = FIO_OPT_C_IO,
2202 .group = FIO_OPT_G_VERIFY,
2205 .name = "verify_backlog",
2206 .lname = "Verify backlog",
2207 .type = FIO_OPT_STR_VAL,
2208 .off1 = td_var_offset(verify_backlog),
2209 .help = "Verify after this number of blocks are written",
2212 .category = FIO_OPT_C_IO,
2213 .group = FIO_OPT_G_VERIFY,
2216 .name = "verify_backlog_batch",
2217 .lname = "Verify backlog batch",
2218 .type = FIO_OPT_INT,
2219 .off1 = td_var_offset(verify_batch),
2220 .help = "Verify this number of IO blocks",
2223 .category = FIO_OPT_C_IO,
2224 .group = FIO_OPT_G_VERIFY,
2226 #ifdef FIO_HAVE_CPU_AFFINITY
2228 .name = "verify_async_cpus",
2229 .lname = "Async verify CPUs",
2230 .type = FIO_OPT_STR,
2231 .cb = str_verify_cpus_allowed_cb,
2232 .help = "Set CPUs allowed for async verify threads",
2233 .parent = "verify_async",
2235 .category = FIO_OPT_C_IO,
2236 .group = FIO_OPT_G_VERIFY,
2240 .name = "experimental_verify",
2241 .off1 = td_var_offset(experimental_verify),
2242 .type = FIO_OPT_BOOL,
2243 .help = "Enable experimental verification",
2244 .category = FIO_OPT_C_IO,
2245 .group = FIO_OPT_G_VERIFY,
2247 #ifdef FIO_HAVE_TRIM
2249 .name = "trim_percentage",
2250 .lname = "Trim percentage",
2251 .type = FIO_OPT_INT,
2252 .off1 = td_var_offset(trim_percentage),
2255 .help = "Number of verify blocks to discard/trim",
2260 .category = FIO_OPT_C_IO,
2261 .group = FIO_OPT_G_TRIM,
2264 .name = "trim_verify_zero",
2265 .lname = "Verify trim zero",
2266 .type = FIO_OPT_BOOL,
2267 .help = "Verify that trim/discarded blocks are returned as zeroes",
2268 .off1 = td_var_offset(trim_zero),
2269 .parent = "trim_percentage",
2272 .category = FIO_OPT_C_IO,
2273 .group = FIO_OPT_G_TRIM,
2276 .name = "trim_backlog",
2277 .lname = "Trim backlog",
2278 .type = FIO_OPT_STR_VAL,
2279 .off1 = td_var_offset(trim_backlog),
2280 .help = "Trim after this number of blocks are written",
2281 .parent = "trim_percentage",
2284 .category = FIO_OPT_C_IO,
2285 .group = FIO_OPT_G_TRIM,
2288 .name = "trim_backlog_batch",
2289 .lname = "Trim backlog batch",
2290 .type = FIO_OPT_INT,
2291 .off1 = td_var_offset(trim_batch),
2292 .help = "Trim this number of IO blocks",
2293 .parent = "trim_percentage",
2296 .category = FIO_OPT_C_IO,
2297 .group = FIO_OPT_G_TRIM,
2301 .name = "write_iolog",
2302 .lname = "Write I/O log",
2303 .type = FIO_OPT_STR_STORE,
2304 .off1 = td_var_offset(write_iolog_file),
2305 .help = "Store IO pattern to file",
2306 .category = FIO_OPT_C_IO,
2307 .group = FIO_OPT_G_IOLOG,
2310 .name = "read_iolog",
2311 .lname = "Read I/O log",
2312 .type = FIO_OPT_STR_STORE,
2313 .off1 = td_var_offset(read_iolog_file),
2314 .help = "Playback IO pattern from file",
2315 .category = FIO_OPT_C_IO,
2316 .group = FIO_OPT_G_IOLOG,
2319 .name = "replay_no_stall",
2320 .lname = "Don't stall on replay",
2321 .type = FIO_OPT_BOOL,
2322 .off1 = td_var_offset(no_stall),
2324 .parent = "read_iolog",
2326 .help = "Playback IO pattern file as fast as possible without stalls",
2327 .category = FIO_OPT_C_IO,
2328 .group = FIO_OPT_G_IOLOG,
2331 .name = "replay_redirect",
2332 .lname = "Redirect device for replay",
2333 .type = FIO_OPT_STR_STORE,
2334 .off1 = td_var_offset(replay_redirect),
2335 .parent = "read_iolog",
2337 .help = "Replay all I/O onto this device, regardless of trace device",
2338 .category = FIO_OPT_C_IO,
2339 .group = FIO_OPT_G_IOLOG,
2342 .name = "exec_prerun",
2343 .lname = "Pre-execute runnable",
2344 .type = FIO_OPT_STR_STORE,
2345 .off1 = td_var_offset(exec_prerun),
2346 .help = "Execute this file prior to running job",
2347 .category = FIO_OPT_C_GENERAL,
2348 .group = FIO_OPT_G_INVALID,
2351 .name = "exec_postrun",
2352 .lname = "Post-execute runnable",
2353 .type = FIO_OPT_STR_STORE,
2354 .off1 = td_var_offset(exec_postrun),
2355 .help = "Execute this file after running job",
2356 .category = FIO_OPT_C_GENERAL,
2357 .group = FIO_OPT_G_INVALID,
2359 #ifdef FIO_HAVE_IOSCHED_SWITCH
2361 .name = "ioscheduler",
2362 .lname = "I/O scheduler",
2363 .type = FIO_OPT_STR_STORE,
2364 .off1 = td_var_offset(ioscheduler),
2365 .help = "Use this IO scheduler on the backing device",
2366 .category = FIO_OPT_C_FILE,
2367 .group = FIO_OPT_G_INVALID,
2372 .lname = "Zone size",
2373 .type = FIO_OPT_STR_VAL,
2374 .off1 = td_var_offset(zone_size),
2375 .help = "Amount of data to read per zone",
2377 .interval = 1024 * 1024,
2378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_ZONE,
2382 .name = "zonerange",
2383 .lname = "Zone range",
2384 .type = FIO_OPT_STR_VAL,
2385 .off1 = td_var_offset(zone_range),
2386 .help = "Give size of an IO zone",
2388 .interval = 1024 * 1024,
2389 .category = FIO_OPT_C_IO,
2390 .group = FIO_OPT_G_ZONE,
2394 .lname = "Zone skip",
2395 .type = FIO_OPT_STR_VAL,
2396 .off1 = td_var_offset(zone_skip),
2397 .help = "Space between IO zones",
2399 .interval = 1024 * 1024,
2400 .category = FIO_OPT_C_IO,
2401 .group = FIO_OPT_G_ZONE,
2405 .lname = "Lock memory",
2406 .type = FIO_OPT_STR_VAL,
2407 .off1 = td_var_offset(lockmem),
2408 .help = "Lock down this amount of memory (per worker)",
2410 .interval = 1024 * 1024,
2411 .category = FIO_OPT_C_GENERAL,
2412 .group = FIO_OPT_G_INVALID,
2415 .name = "rwmixread",
2416 .lname = "Read/write mix read",
2417 .type = FIO_OPT_INT,
2418 .cb = str_rwmix_read_cb,
2420 .help = "Percentage of mixed workload that is reads",
2423 .inverse = "rwmixwrite",
2424 .category = FIO_OPT_C_IO,
2425 .group = FIO_OPT_G_RWMIX,
2428 .name = "rwmixwrite",
2429 .lname = "Read/write mix write",
2430 .type = FIO_OPT_INT,
2431 .cb = str_rwmix_write_cb,
2433 .help = "Percentage of mixed workload that is writes",
2436 .inverse = "rwmixread",
2437 .category = FIO_OPT_C_IO,
2438 .group = FIO_OPT_G_RWMIX,
2441 .name = "rwmixcycle",
2442 .lname = "Read/write mix cycle",
2443 .type = FIO_OPT_DEPRECATED,
2444 .category = FIO_OPT_C_IO,
2445 .group = FIO_OPT_G_RWMIX,
2450 .type = FIO_OPT_INT,
2451 .off1 = td_var_offset(nice),
2452 .help = "Set job CPU nice value",
2457 .category = FIO_OPT_C_GENERAL,
2458 .group = FIO_OPT_G_CRED,
2460 #ifdef FIO_HAVE_IOPRIO
2463 .lname = "I/O nice priority",
2464 .type = FIO_OPT_INT,
2465 .off1 = td_var_offset(ioprio),
2466 .help = "Set job IO priority value",
2470 .category = FIO_OPT_C_GENERAL,
2471 .group = FIO_OPT_G_CRED,
2474 .name = "prioclass",
2475 .lname = "I/O nice priority class",
2476 .type = FIO_OPT_INT,
2477 .off1 = td_var_offset(ioprio_class),
2478 .help = "Set job IO priority class",
2482 .category = FIO_OPT_C_GENERAL,
2483 .group = FIO_OPT_G_CRED,
2487 .name = "thinktime",
2488 .lname = "Thinktime",
2489 .type = FIO_OPT_INT,
2490 .off1 = td_var_offset(thinktime),
2491 .help = "Idle time between IO buffers (usec)",
2493 .category = FIO_OPT_C_IO,
2494 .group = FIO_OPT_G_THINKTIME,
2497 .name = "thinktime_spin",
2498 .lname = "Thinktime spin",
2499 .type = FIO_OPT_INT,
2500 .off1 = td_var_offset(thinktime_spin),
2501 .help = "Start think time by spinning this amount (usec)",
2503 .parent = "thinktime",
2505 .category = FIO_OPT_C_IO,
2506 .group = FIO_OPT_G_THINKTIME,
2509 .name = "thinktime_blocks",
2510 .lname = "Thinktime blocks",
2511 .type = FIO_OPT_INT,
2512 .off1 = td_var_offset(thinktime_blocks),
2513 .help = "IO buffer period between 'thinktime'",
2515 .parent = "thinktime",
2517 .category = FIO_OPT_C_IO,
2518 .group = FIO_OPT_G_THINKTIME,
2522 .lname = "I/O rate",
2523 .type = FIO_OPT_INT,
2524 .off1 = td_var_offset(rate[DDIR_READ]),
2525 .off2 = td_var_offset(rate[DDIR_WRITE]),
2526 .off3 = td_var_offset(rate[DDIR_TRIM]),
2527 .help = "Set bandwidth rate",
2528 .category = FIO_OPT_C_IO,
2529 .group = FIO_OPT_G_RATE,
2533 .lname = "I/O min rate",
2534 .type = FIO_OPT_INT,
2535 .off1 = td_var_offset(ratemin[DDIR_READ]),
2536 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2537 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2538 .help = "Job must meet this rate or it will be shutdown",
2541 .category = FIO_OPT_C_IO,
2542 .group = FIO_OPT_G_RATE,
2545 .name = "rate_iops",
2546 .lname = "I/O rate IOPS",
2547 .type = FIO_OPT_INT,
2548 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2549 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2550 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2551 .help = "Limit IO used to this number of IO operations/sec",
2553 .category = FIO_OPT_C_IO,
2554 .group = FIO_OPT_G_RATE,
2557 .name = "rate_iops_min",
2558 .lname = "I/O min rate IOPS",
2559 .type = FIO_OPT_INT,
2560 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2561 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2562 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2563 .help = "Job must meet this rate or it will be shut down",
2564 .parent = "rate_iops",
2566 .category = FIO_OPT_C_IO,
2567 .group = FIO_OPT_G_RATE,
2570 .name = "ratecycle",
2571 .lname = "I/O rate cycle",
2572 .type = FIO_OPT_INT,
2573 .off1 = td_var_offset(ratecycle),
2574 .help = "Window average for rate limits (msec)",
2578 .category = FIO_OPT_C_IO,
2579 .group = FIO_OPT_G_RATE,
2582 .name = "max_latency",
2583 .type = FIO_OPT_INT,
2584 .off1 = td_var_offset(max_latency),
2585 .help = "Maximum tolerated IO latency (usec)",
2586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_RATE,
2590 .name = "invalidate",
2591 .lname = "Cache invalidate",
2592 .type = FIO_OPT_BOOL,
2593 .off1 = td_var_offset(invalidate_cache),
2594 .help = "Invalidate buffer/page cache prior to running job",
2596 .category = FIO_OPT_C_IO,
2597 .group = FIO_OPT_G_IO_TYPE,
2601 .lname = "Synchronous I/O",
2602 .type = FIO_OPT_BOOL,
2603 .off1 = td_var_offset(sync_io),
2604 .help = "Use O_SYNC for buffered writes",
2606 .parent = "buffered",
2608 .category = FIO_OPT_C_IO,
2609 .group = FIO_OPT_G_IO_TYPE,
2612 .name = "create_serialize",
2613 .lname = "Create serialize",
2614 .type = FIO_OPT_BOOL,
2615 .off1 = td_var_offset(create_serialize),
2616 .help = "Serialize creating of job files",
2618 .category = FIO_OPT_C_FILE,
2619 .group = FIO_OPT_G_INVALID,
2622 .name = "create_fsync",
2623 .lname = "Create fsync",
2624 .type = FIO_OPT_BOOL,
2625 .off1 = td_var_offset(create_fsync),
2626 .help = "fsync file after creation",
2628 .category = FIO_OPT_C_FILE,
2629 .group = FIO_OPT_G_INVALID,
2632 .name = "create_on_open",
2633 .lname = "Create on open",
2634 .type = FIO_OPT_BOOL,
2635 .off1 = td_var_offset(create_on_open),
2636 .help = "Create files when they are opened for IO",
2638 .category = FIO_OPT_C_FILE,
2639 .group = FIO_OPT_G_INVALID,
2642 .name = "create_only",
2643 .type = FIO_OPT_BOOL,
2644 .off1 = td_var_offset(create_only),
2645 .help = "Only perform file creation phase",
2646 .category = FIO_OPT_C_FILE,
2651 .lname = "Pre-read files",
2652 .type = FIO_OPT_BOOL,
2653 .off1 = td_var_offset(pre_read),
2654 .help = "Pre-read files before starting official testing",
2656 .category = FIO_OPT_C_FILE,
2657 .group = FIO_OPT_G_INVALID,
2659 #ifdef FIO_HAVE_CPU_AFFINITY
2662 .lname = "CPU mask",
2663 .type = FIO_OPT_INT,
2664 .cb = str_cpumask_cb,
2665 .help = "CPU affinity mask",
2666 .category = FIO_OPT_C_GENERAL,
2667 .group = FIO_OPT_G_CRED,
2670 .name = "cpus_allowed",
2671 .lname = "CPUs allowed",
2672 .type = FIO_OPT_STR,
2673 .cb = str_cpus_allowed_cb,
2674 .help = "Set CPUs allowed",
2675 .category = FIO_OPT_C_GENERAL,
2676 .group = FIO_OPT_G_CRED,
2679 #ifdef CONFIG_LIBNUMA
2681 .name = "numa_cpu_nodes",
2682 .type = FIO_OPT_STR,
2683 .cb = str_numa_cpunodes_cb,
2684 .help = "NUMA CPU nodes bind",
2685 .category = FIO_OPT_C_GENERAL,
2686 .group = FIO_OPT_G_INVALID,
2689 .name = "numa_mem_policy",
2690 .type = FIO_OPT_STR,
2691 .cb = str_numa_mpol_cb,
2692 .help = "NUMA memory policy setup",
2693 .category = FIO_OPT_C_GENERAL,
2694 .group = FIO_OPT_G_INVALID,
2698 .name = "end_fsync",
2699 .lname = "End fsync",
2700 .type = FIO_OPT_BOOL,
2701 .off1 = td_var_offset(end_fsync),
2702 .help = "Include fsync at the end of job",
2704 .category = FIO_OPT_C_FILE,
2705 .group = FIO_OPT_G_INVALID,
2708 .name = "fsync_on_close",
2709 .lname = "Fsync on close",
2710 .type = FIO_OPT_BOOL,
2711 .off1 = td_var_offset(fsync_on_close),
2712 .help = "fsync files on close",
2714 .category = FIO_OPT_C_FILE,
2715 .group = FIO_OPT_G_INVALID,
2719 .lname = "Unlink file",
2720 .type = FIO_OPT_BOOL,
2721 .off1 = td_var_offset(unlink),
2722 .help = "Unlink created files after job has completed",
2724 .category = FIO_OPT_C_FILE,
2725 .group = FIO_OPT_G_INVALID,
2729 .lname = "Exit-all on terminate",
2730 .type = FIO_OPT_STR_SET,
2731 .cb = str_exitall_cb,
2732 .help = "Terminate all jobs when one exits",
2733 .category = FIO_OPT_C_GENERAL,
2734 .group = FIO_OPT_G_PROCESS,
2737 .name = "stonewall",
2738 .lname = "Wait for previous",
2739 .alias = "wait_for_previous",
2740 .type = FIO_OPT_STR_SET,
2741 .off1 = td_var_offset(stonewall),
2742 .help = "Insert a hard barrier between this job and previous",
2743 .category = FIO_OPT_C_GENERAL,
2744 .group = FIO_OPT_G_PROCESS,
2747 .name = "new_group",
2748 .lname = "New group",
2749 .type = FIO_OPT_STR_SET,
2750 .off1 = td_var_offset(new_group),
2751 .help = "Mark the start of a new group (for reporting)",
2752 .category = FIO_OPT_C_GENERAL,
2753 .group = FIO_OPT_G_PROCESS,
2758 .type = FIO_OPT_STR_SET,
2759 .off1 = td_var_offset(use_thread),
2760 .help = "Use threads instead of processes",
2761 .category = FIO_OPT_C_GENERAL,
2762 .group = FIO_OPT_G_PROCESS,
2765 .name = "write_bw_log",
2766 .lname = "Write bandwidth log",
2767 .type = FIO_OPT_STR_STORE,
2768 .off1 = td_var_offset(bw_log_file),
2769 .help = "Write log of bandwidth during run",
2770 .category = FIO_OPT_C_LOG,
2771 .group = FIO_OPT_G_INVALID,
2774 .name = "write_lat_log",
2775 .lname = "Write latency log",
2776 .type = FIO_OPT_STR_STORE,
2777 .off1 = td_var_offset(lat_log_file),
2778 .help = "Write log of latency during run",
2779 .category = FIO_OPT_C_LOG,
2780 .group = FIO_OPT_G_INVALID,
2783 .name = "write_iops_log",
2784 .lname = "Write IOPS log",
2785 .type = FIO_OPT_STR_STORE,
2786 .off1 = td_var_offset(iops_log_file),
2787 .help = "Write log of IOPS during run",
2788 .category = FIO_OPT_C_LOG,
2789 .group = FIO_OPT_G_INVALID,
2792 .name = "log_avg_msec",
2793 .lname = "Log averaging (msec)",
2794 .type = FIO_OPT_INT,
2795 .off1 = td_var_offset(log_avg_msec),
2796 .help = "Average bw/iops/lat logs over this period of time",
2798 .category = FIO_OPT_C_LOG,
2799 .group = FIO_OPT_G_INVALID,
2802 .name = "bwavgtime",
2803 .lname = "Bandwidth average time",
2804 .type = FIO_OPT_INT,
2805 .off1 = td_var_offset(bw_avg_time),
2806 .help = "Time window over which to calculate bandwidth"
2809 .parent = "write_bw_log",
2812 .category = FIO_OPT_C_LOG,
2813 .group = FIO_OPT_G_INVALID,
2816 .name = "iopsavgtime",
2817 .lname = "IOPS average time",
2818 .type = FIO_OPT_INT,
2819 .off1 = td_var_offset(iops_avg_time),
2820 .help = "Time window over which to calculate IOPS (msec)",
2822 .parent = "write_iops_log",
2825 .category = FIO_OPT_C_LOG,
2826 .group = FIO_OPT_G_INVALID,
2829 .name = "group_reporting",
2830 .lname = "Group reporting",
2831 .type = FIO_OPT_STR_SET,
2832 .off1 = td_var_offset(group_reporting),
2833 .help = "Do reporting on a per-group basis",
2834 .category = FIO_OPT_C_STAT,
2835 .group = FIO_OPT_G_INVALID,
2838 .name = "zero_buffers",
2839 .lname = "Zero I/O buffers",
2840 .type = FIO_OPT_STR_SET,
2841 .off1 = td_var_offset(zero_buffers),
2842 .help = "Init IO buffers to all zeroes",
2843 .category = FIO_OPT_C_IO,
2844 .group = FIO_OPT_G_IO_BUF,
2847 .name = "refill_buffers",
2848 .lname = "Refill I/O buffers",
2849 .type = FIO_OPT_STR_SET,
2850 .off1 = td_var_offset(refill_buffers),
2851 .help = "Refill IO buffers on every IO submit",
2852 .category = FIO_OPT_C_IO,
2853 .group = FIO_OPT_G_IO_BUF,
2856 .name = "scramble_buffers",
2857 .lname = "Scramble I/O buffers",
2858 .type = FIO_OPT_BOOL,
2859 .off1 = td_var_offset(scramble_buffers),
2860 .help = "Slightly scramble buffers on every IO submit",
2862 .category = FIO_OPT_C_IO,
2863 .group = FIO_OPT_G_IO_BUF,
2866 .name = "buffer_compress_percentage",
2867 .lname = "Buffer compression percentage",
2868 .type = FIO_OPT_INT,
2869 .off1 = td_var_offset(compress_percentage),
2872 .help = "How compressible the buffer is (approximately)",
2874 .category = FIO_OPT_C_IO,
2875 .group = FIO_OPT_G_IO_BUF,
2878 .name = "buffer_compress_chunk",
2879 .lname = "Buffer compression chunk size",
2880 .type = FIO_OPT_INT,
2881 .off1 = td_var_offset(compress_chunk),
2882 .parent = "buffer_compress_percentage",
2884 .help = "Size of compressible region in buffer",
2886 .category = FIO_OPT_C_IO,
2887 .group = FIO_OPT_G_IO_BUF,
2890 .name = "clat_percentiles",
2891 .lname = "Completion latency percentiles",
2892 .type = FIO_OPT_BOOL,
2893 .off1 = td_var_offset(clat_percentiles),
2894 .help = "Enable the reporting of completion latency percentiles",
2896 .category = FIO_OPT_C_STAT,
2897 .group = FIO_OPT_G_INVALID,
2900 .name = "percentile_list",
2901 .lname = "Completion latency percentile list",
2902 .type = FIO_OPT_FLOAT_LIST,
2903 .off1 = td_var_offset(percentile_list),
2904 .off2 = td_var_offset(percentile_precision),
2905 .help = "Specify a custom list of percentiles to report",
2906 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
2907 .maxlen = FIO_IO_U_LIST_MAX_LEN,
2910 .category = FIO_OPT_C_STAT,
2911 .group = FIO_OPT_G_INVALID,
2914 #ifdef FIO_HAVE_DISK_UTIL
2916 .name = "disk_util",
2917 .lname = "Disk utilization",
2918 .type = FIO_OPT_BOOL,
2919 .off1 = td_var_offset(do_disk_util),
2920 .help = "Log disk utilization statistics",
2922 .category = FIO_OPT_C_STAT,
2923 .group = FIO_OPT_G_INVALID,
2927 .name = "gtod_reduce",
2928 .lname = "Reduce gettimeofday() calls",
2929 .type = FIO_OPT_BOOL,
2930 .help = "Greatly reduce number of gettimeofday() calls",
2931 .cb = str_gtod_reduce_cb,
2934 .category = FIO_OPT_C_STAT,
2935 .group = FIO_OPT_G_INVALID,
2938 .name = "disable_lat",
2939 .lname = "Disable all latency stats",
2940 .type = FIO_OPT_BOOL,
2941 .off1 = td_var_offset(disable_lat),
2942 .help = "Disable latency numbers",
2943 .parent = "gtod_reduce",
2946 .category = FIO_OPT_C_STAT,
2947 .group = FIO_OPT_G_INVALID,
2950 .name = "disable_clat",
2951 .lname = "Disable completion latency stats",
2952 .type = FIO_OPT_BOOL,
2953 .off1 = td_var_offset(disable_clat),
2954 .help = "Disable completion latency numbers",
2955 .parent = "gtod_reduce",
2958 .category = FIO_OPT_C_STAT,
2959 .group = FIO_OPT_G_INVALID,
2962 .name = "disable_slat",
2963 .lname = "Disable submission latency stats",
2964 .type = FIO_OPT_BOOL,
2965 .off1 = td_var_offset(disable_slat),
2966 .help = "Disable submission latency numbers",
2967 .parent = "gtod_reduce",
2970 .category = FIO_OPT_C_STAT,
2971 .group = FIO_OPT_G_INVALID,
2974 .name = "disable_bw_measurement",
2975 .lname = "Disable bandwidth stats",
2976 .type = FIO_OPT_BOOL,
2977 .off1 = td_var_offset(disable_bw),
2978 .help = "Disable bandwidth logging",
2979 .parent = "gtod_reduce",
2982 .category = FIO_OPT_C_STAT,
2983 .group = FIO_OPT_G_INVALID,
2987 .lname = "Dedicated gettimeofday() CPU",
2988 .type = FIO_OPT_INT,
2989 .cb = str_gtod_cpu_cb,
2990 .help = "Set up dedicated gettimeofday() thread on this CPU",
2991 .verify = gtod_cpu_verify,
2992 .category = FIO_OPT_C_GENERAL,
2993 .group = FIO_OPT_G_CLOCK,
2996 .name = "unified_rw_reporting",
2997 .type = FIO_OPT_BOOL,
2998 .off1 = td_var_offset(unified_rw_rep),
2999 .help = "Unify reporting across data direction",
3001 .category = FIO_OPT_C_GENERAL,
3002 .group = FIO_OPT_G_INVALID,
3005 .name = "continue_on_error",
3006 .lname = "Continue on error",
3007 .type = FIO_OPT_STR,
3008 .off1 = td_var_offset(continue_on_error),
3009 .help = "Continue on non-fatal errors during IO",
3011 .category = FIO_OPT_C_GENERAL,
3012 .group = FIO_OPT_G_ERR,
3015 .oval = ERROR_TYPE_NONE,
3016 .help = "Exit when an error is encountered",
3019 .oval = ERROR_TYPE_READ,
3020 .help = "Continue on read errors only",
3023 .oval = ERROR_TYPE_WRITE,
3024 .help = "Continue on write errors only",
3027 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3028 .help = "Continue on any IO errors",
3031 .oval = ERROR_TYPE_VERIFY,
3032 .help = "Continue on verify errors only",
3035 .oval = ERROR_TYPE_ANY,
3036 .help = "Continue on all io and verify errors",
3039 .oval = ERROR_TYPE_NONE,
3040 .help = "Alias for 'none'",
3043 .oval = ERROR_TYPE_ANY,
3044 .help = "Alias for 'all'",
3049 .name = "ignore_error",
3050 .type = FIO_OPT_STR,
3051 .cb = str_ignore_error_cb,
3052 .help = "Set a specific list of errors to ignore",
3054 .category = FIO_OPT_C_GENERAL,
3055 .group = FIO_OPT_G_ERR,
3058 .name = "error_dump",
3059 .type = FIO_OPT_BOOL,
3060 .off1 = td_var_offset(error_dump),
3062 .help = "Dump info on each error",
3063 .category = FIO_OPT_C_GENERAL,
3064 .group = FIO_OPT_G_ERR,
3069 .type = FIO_OPT_STR_STORE,
3070 .off1 = td_var_offset(profile),
3071 .help = "Select a specific builtin performance test",
3072 .category = FIO_OPT_C_PROFILE,
3073 .group = FIO_OPT_G_INVALID,
3078 .type = FIO_OPT_STR_STORE,
3079 .off1 = td_var_offset(cgroup),
3080 .help = "Add job to cgroup of this name",
3081 .category = FIO_OPT_C_GENERAL,
3082 .group = FIO_OPT_G_CGROUP,
3085 .name = "cgroup_nodelete",
3086 .lname = "Cgroup no-delete",
3087 .type = FIO_OPT_BOOL,
3088 .off1 = td_var_offset(cgroup_nodelete),
3089 .help = "Do not delete cgroups after job completion",
3092 .category = FIO_OPT_C_GENERAL,
3093 .group = FIO_OPT_G_CGROUP,
3096 .name = "cgroup_weight",
3097 .lname = "Cgroup weight",
3098 .type = FIO_OPT_INT,
3099 .off1 = td_var_offset(cgroup_weight),
3100 .help = "Use given weight for cgroup",
3104 .category = FIO_OPT_C_GENERAL,
3105 .group = FIO_OPT_G_CGROUP,
3110 .type = FIO_OPT_INT,
3111 .off1 = td_var_offset(uid),
3112 .help = "Run job with this user ID",
3113 .category = FIO_OPT_C_GENERAL,
3114 .group = FIO_OPT_G_CRED,
3118 .lname = "Group ID",
3119 .type = FIO_OPT_INT,
3120 .off1 = td_var_offset(gid),
3121 .help = "Run job with this group ID",
3122 .category = FIO_OPT_C_GENERAL,
3123 .group = FIO_OPT_G_CRED,
3128 .type = FIO_OPT_INT,
3129 .off1 = td_var_offset(kb_base),
3135 .help = "Use 1024 as the K base",
3139 .help = "Use 1000 as the K base",
3142 .help = "How many bytes per KB for reporting (1000 or 1024)",
3143 .category = FIO_OPT_C_GENERAL,
3144 .group = FIO_OPT_G_INVALID,
3147 .name = "unit_base",
3148 .lname = "Base unit for reporting (Bits or Bytes)",
3149 .type = FIO_OPT_INT,
3150 .off1 = td_var_offset(unit_base),
3155 .help = "Auto-detect",
3159 .help = "Normal (byte based)",
3163 .help = "Bit based",
3166 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3167 .category = FIO_OPT_C_GENERAL,
3168 .group = FIO_OPT_G_INVALID,
3171 .name = "hugepage-size",
3172 .lname = "Hugepage size",
3173 .type = FIO_OPT_INT,
3174 .off1 = td_var_offset(hugepage_size),
3175 .help = "When using hugepages, specify size of each page",
3176 .def = __fio_stringify(FIO_HUGE_PAGE),
3177 .interval = 1024 * 1024,
3178 .category = FIO_OPT_C_GENERAL,
3179 .group = FIO_OPT_G_INVALID,
3183 .lname = "I/O flow ID",
3184 .type = FIO_OPT_INT,
3185 .off1 = td_var_offset(flow_id),
3186 .help = "The flow index ID to use",
3188 .category = FIO_OPT_C_IO,
3189 .group = FIO_OPT_G_IO_FLOW,
3193 .lname = "I/O flow weight",
3194 .type = FIO_OPT_INT,
3195 .off1 = td_var_offset(flow),
3196 .help = "Weight for flow control of this job",
3197 .parent = "flow_id",
3200 .category = FIO_OPT_C_IO,
3201 .group = FIO_OPT_G_IO_FLOW,
3204 .name = "flow_watermark",
3205 .lname = "I/O flow watermark",
3206 .type = FIO_OPT_INT,
3207 .off1 = td_var_offset(flow_watermark),
3208 .help = "High watermark for flow control. This option"
3209 " should be set to the same value for all threads"
3210 " with non-zero flow.",
3211 .parent = "flow_id",
3214 .category = FIO_OPT_C_IO,
3215 .group = FIO_OPT_G_IO_FLOW,
3218 .name = "flow_sleep",
3219 .lname = "I/O flow sleep",
3220 .type = FIO_OPT_INT,
3221 .off1 = td_var_offset(flow_sleep),
3222 .help = "How many microseconds to sleep after being held"
3223 " back by the flow control mechanism",
3224 .parent = "flow_id",
3227 .category = FIO_OPT_C_IO,
3228 .group = FIO_OPT_G_IO_FLOW,
3235 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3236 const char *name, int val)
3238 lopt->name = (char *) name;
3240 if (o->type == FIO_OPT_STR_SET)
3241 lopt->has_arg = no_argument;
3243 lopt->has_arg = required_argument;
3246 static void options_to_lopts(struct fio_option *opts,
3247 struct option *long_options,
3248 int i, int option_type)
3250 struct fio_option *o = &opts[0];
3252 add_to_lopt(&long_options[i], o, o->name, option_type);
3255 add_to_lopt(&long_options[i], o, o->alias, option_type);
3260 assert(i < FIO_NR_OPTIONS);
3264 void fio_options_set_ioengine_opts(struct option *long_options,
3265 struct thread_data *td)
3270 while (long_options[i].name) {
3271 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3272 memset(&long_options[i], 0, sizeof(*long_options));
3279 * Just clear out the prior ioengine options.
3284 options_to_lopts(td->io_ops->options, long_options, i,
3285 FIO_GETOPT_IOENGINE);
3288 void fio_options_dup_and_init(struct option *long_options)
3292 options_init(fio_options);
3295 while (long_options[i].name)
3298 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3301 struct fio_keyword {
3307 static struct fio_keyword fio_keywords[] = {
3309 .word = "$pagesize",
3310 .desc = "Page size in the system",
3313 .word = "$mb_memory",
3314 .desc = "Megabytes of memory online",
3318 .desc = "Number of CPUs online in the system",
3325 void fio_keywords_init(void)
3327 unsigned long long mb_memory;
3331 sprintf(buf, "%lu", (unsigned long) page_size);
3332 fio_keywords[0].replace = strdup(buf);
3334 mb_memory = os_phys_mem() / (1024 * 1024);
3335 sprintf(buf, "%llu", mb_memory);
3336 fio_keywords[1].replace = strdup(buf);
3339 sprintf(buf, "%lu", l);
3340 fio_keywords[2].replace = strdup(buf);
3345 static char *bc_calc(char *str)
3347 char buf[128], *tmp;
3352 * No math, just return string
3354 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3355 !strchr(str, '/')) || strchr(str, '\''))
3359 * Split option from value, we only need to calculate the value
3361 tmp = strchr(str, '=');
3368 * Prevent buffer overflows; such a case isn't reasonable anyway
3370 if (strlen(str) >= 128 || strlen(tmp) > 100)
3373 sprintf(buf, "which %s > /dev/null", BC_APP);
3375 log_err("fio: bc is needed for performing math\n");
3379 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3380 f = popen(buf, "r");
3384 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3389 buf[(tmp - str) + ret - 1] = '\0';
3390 memcpy(buf, str, tmp - str);
3396 * Return a copy of the input string with substrings of the form ${VARNAME}
3397 * substituted with the value of the environment variable VARNAME. The
3398 * substitution always occurs, even if VARNAME is empty or the corresponding
3399 * environment variable undefined.
3401 static char *option_dup_subs(const char *opt)
3403 char out[OPT_LEN_MAX+1];
3404 char in[OPT_LEN_MAX+1];
3407 char *ch1, *ch2, *env;
3408 ssize_t nchr = OPT_LEN_MAX;
3411 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3412 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3416 in[OPT_LEN_MAX] = '\0';
3417 strncpy(in, opt, OPT_LEN_MAX);
3419 while (*inptr && nchr > 0) {
3420 if (inptr[0] == '$' && inptr[1] == '{') {
3421 ch2 = strchr(inptr, '}');
3422 if (ch2 && inptr+1 < ch2) {
3429 envlen = strlen(env);
3430 if (envlen <= nchr) {
3431 memcpy(outptr, env, envlen);
3441 *outptr++ = *inptr++;
3450 * Look for reserved variable names and replace them with real values
3452 static char *fio_keyword_replace(char *opt)
3458 for (i = 0; fio_keywords[i].word != NULL; i++) {
3459 struct fio_keyword *kw = &fio_keywords[i];
3461 while ((s = strstr(opt, kw->word)) != NULL) {
3462 char *new = malloc(strlen(opt) + 1);
3468 * Copy part of the string before the keyword and
3469 * sprintf() the replacement after it.
3471 memcpy(new, opt, olen);
3472 len = sprintf(new + olen, "%s", kw->replace);
3475 * If there's more in the original string, copy that
3478 opt += strlen(kw->word) + olen;
3480 memcpy(new + olen + len, opt, opt - o_org - 1);
3483 * replace opt and free the old opt
3493 * Check for potential math and invoke bc, if possible
3501 static char **dup_and_sub_options(char **opts, int num_opts)
3504 char **opts_copy = malloc(num_opts * sizeof(*opts));
3505 for (i = 0; i < num_opts; i++) {
3506 opts_copy[i] = option_dup_subs(opts[i]);
3509 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3514 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
3516 int i, ret, unknown;
3519 sort_options(opts, fio_options, num_opts);
3520 opts_copy = dup_and_sub_options(opts, num_opts);
3522 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3523 struct fio_option *o;
3524 int newret = parse_option(opts_copy[i], opts[i], fio_options,
3533 opts_copy[i] = NULL;
3540 ret |= ioengine_load(td);
3542 sort_options(opts_copy, td->io_ops->options, num_opts);
3545 for (i = 0; i < num_opts; i++) {
3546 struct fio_option *o = NULL;
3552 newret = parse_option(opts_copy[i], opts[i],
3553 td->io_ops->options, &o,
3558 log_err("Bad option <%s>\n", opts[i]);
3561 opts_copy[i] = NULL;
3569 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3571 return parse_cmd_option(opt, val, fio_options, td);
3574 int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
3577 return parse_cmd_option(opt, val, td->io_ops->options, td);
3580 void fio_fill_default_options(struct thread_data *td)
3582 fill_default_options(td, fio_options);
3585 int fio_show_option_help(const char *opt)
3587 return show_cmd_help(fio_options, opt);
3590 void options_mem_dupe(void *data, struct fio_option *options)
3592 struct fio_option *o;
3595 for (o = &options[0]; o->name; o++) {
3596 if (o->type != FIO_OPT_STR_STORE)
3599 ptr = td_var(data, o->off1);
3601 *ptr = strdup(*ptr);
3606 * dupe FIO_OPT_STR_STORE options
3608 void fio_options_mem_dupe(struct thread_data *td)
3610 options_mem_dupe(&td->o, fio_options);
3612 if (td->eo && td->io_ops) {
3613 void *oldeo = td->eo;
3615 td->eo = malloc(td->io_ops->option_struct_size);
3616 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
3617 options_mem_dupe(td->eo, td->io_ops->options);
3621 unsigned int fio_get_kb_base(void *data)
3623 struct thread_options *o = data;
3624 unsigned int kb_base = 0;
3627 kb_base = o->kb_base;
3634 int add_option(struct fio_option *o)
3636 struct fio_option *__o;
3645 memcpy(&fio_options[opt_index], o, sizeof(*o));
3649 void invalidate_profile_options(const char *prof_name)
3651 struct fio_option *o;
3655 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
3656 o->type = FIO_OPT_INVALID;
3657 o->prof_name = NULL;
3663 void add_opt_posval(const char *optname, const char *ival, const char *help)
3665 struct fio_option *o;
3668 o = find_option(fio_options, optname);
3672 for (i = 0; i < PARSE_MAX_VP; i++) {
3673 if (o->posval[i].ival)
3676 o->posval[i].ival = ival;
3677 o->posval[i].help = help;
3682 void del_opt_posval(const char *optname, const char *ival)
3684 struct fio_option *o;
3687 o = find_option(fio_options, optname);
3691 for (i = 0; i < PARSE_MAX_VP; i++) {
3692 if (!o->posval[i].ival)
3694 if (strcmp(o->posval[i].ival, ival))
3697 o->posval[i].ival = NULL;
3698 o->posval[i].help = NULL;
3702 void fio_options_free(struct thread_data *td)
3704 options_free(fio_options, td);
3705 if (td->eo && td->io_ops && td->io_ops->options) {
3706 options_free(td->io_ops->options, td->eo);
3712 struct fio_option *fio_option_find(const char *name)
3714 return find_option(fio_options, name);