18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 o->bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 o->bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == -1U)
136 if (perc > 100 && perc_missing > 1) {
137 log_err("fio: bssplit percentages add to more than 100%%\n");
143 * If values didn't have a percentage set, divide the remains between
147 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
149 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
150 struct bssplit *bsp = &bssplit[i];
152 if (bsp->perc == -1U)
153 bsp->perc = (100 - perc) / perc_missing;
157 o->min_bs[ddir] = min_bs;
158 o->max_bs[ddir] = max_bs;
161 * now sort based on percentages, for ease of lookup
163 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
164 o->bssplit[ddir] = bssplit;
168 static int str_bssplit_cb(void *data, const char *input)
170 struct thread_data *td = data;
171 char *str, *p, *odir, *ddir;
177 p = str = strdup(input);
179 strip_blank_front(&str);
180 strip_blank_end(str);
182 odir = strchr(str, ',');
184 ddir = strchr(odir + 1, ',');
186 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
192 op = strdup(odir + 1);
193 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
198 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
201 ret = bssplit_ddir(&td->o, DDIR_READ, str);
207 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
212 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
215 ret = bssplit_ddir(&td->o, DDIR_READ, str);
222 static int str2error(char *str)
224 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
225 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
226 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
227 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
228 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
229 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
230 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
231 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
232 int i = 0, num = sizeof(err) / sizeof(void *);
235 if (!strcmp(err[i], str))
242 static int ignore_error_type(struct thread_data *td, int etype, char *str)
248 if (etype >= ERROR_TYPE_CNT) {
249 log_err("Illegal error type\n");
253 td->o.ignore_error_nr[etype] = 4;
254 error = malloc(4 * sizeof(struct bssplit));
257 while ((fname = strsep(&str, ":")) != NULL) {
263 * grow struct buffer, if needed
265 if (i == td->o.ignore_error_nr[etype]) {
266 td->o.ignore_error_nr[etype] <<= 1;
267 error = realloc(error, td->o.ignore_error_nr[etype]
270 if (fname[0] == 'E') {
271 error[i] = str2error(fname);
273 error[i] = atoi(fname);
275 error[i] = -error[i];
278 log_err("Unknown error %s, please use number value \n",
286 td->o.continue_on_error |= 1 << etype;
287 td->o.ignore_error_nr[etype] = i;
288 td->o.ignore_error[etype] = error;
296 static int str_ignore_error_cb(void *data, const char *input)
298 struct thread_data *td = data;
300 int type = 0, ret = 1;
305 p = str = strdup(input);
307 strip_blank_front(&str);
308 strip_blank_end(str);
314 ret = ignore_error_type(td, type, p);
324 static int str_rw_cb(void *data, const char *str)
326 struct thread_data *td = data;
327 struct thread_options *o = &td->o;
336 nr = get_opt_postfix(str);
341 o->ddir_seq_nr = atoi(nr);
345 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
346 log_err("fio: rw postfix parsing failed\n");
351 o->ddir_seq_add = val;
358 static int str_mem_cb(void *data, const char *mem)
360 struct thread_data *td = data;
362 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
363 td->o.mmapfile = get_opt_postfix(mem);
368 static int fio_clock_source_cb(void *data, const char *str)
370 struct thread_data *td = data;
372 fio_clock_source = td->o.clocksource;
373 fio_clock_source_set = 1;
378 static int str_rwmix_read_cb(void *data, unsigned long long *val)
380 struct thread_data *td = data;
382 td->o.rwmix[DDIR_READ] = *val;
383 td->o.rwmix[DDIR_WRITE] = 100 - *val;
387 static int str_rwmix_write_cb(void *data, unsigned long long *val)
389 struct thread_data *td = data;
391 td->o.rwmix[DDIR_WRITE] = *val;
392 td->o.rwmix[DDIR_READ] = 100 - *val;
396 static int str_exitall_cb(void)
398 exitall_on_terminate = 1;
402 #ifdef FIO_HAVE_CPU_AFFINITY
403 int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
405 unsigned int i, index, cpus_in_mask;
406 const long max_cpu = cpus_online();
408 cpus_in_mask = fio_cpu_count(mask);
409 cpu_index = cpu_index % cpus_in_mask;
412 for (i = 0; i < max_cpu; i++) {
413 if (!fio_cpu_isset(mask, i))
416 if (cpu_index != index)
417 fio_cpu_clear(mask, i);
422 return fio_cpu_count(mask);
425 static int str_cpumask_cb(void *data, unsigned long long *val)
427 struct thread_data *td = data;
435 ret = fio_cpuset_init(&td->o.cpumask);
437 log_err("fio: cpuset_init failed\n");
438 td_verror(td, ret, "fio_cpuset_init");
442 max_cpu = cpus_online();
444 for (i = 0; i < sizeof(int) * 8; i++) {
445 if ((1 << i) & *val) {
447 log_err("fio: CPU %d too large (max=%ld)\n", i,
451 dprint(FD_PARSE, "set cpu allowed %d\n", i);
452 fio_cpu_set(&td->o.cpumask, i);
459 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
466 ret = fio_cpuset_init(mask);
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
473 p = str = strdup(input);
475 strip_blank_front(&str);
476 strip_blank_end(str);
478 max_cpu = cpus_online();
480 while ((cpu = strsep(&str, ",")) != NULL) {
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
499 while (icpu <= icpu2) {
500 if (icpu >= FIO_MAX_CPUS) {
501 log_err("fio: your OS only supports up to"
502 " %d CPUs\n", (int) FIO_MAX_CPUS);
506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
514 fio_cpu_set(mask, icpu);
525 static int str_cpus_allowed_cb(void *data, const char *input)
527 struct thread_data *td = data;
532 return set_cpus_allowed(td, &td->o.cpumask, input);
535 static int str_verify_cpus_allowed_cb(void *data, const char *input)
537 struct thread_data *td = data;
539 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
543 #ifdef CONFIG_LIBNUMA
544 static int str_numa_cpunodes_cb(void *data, char *input)
546 struct thread_data *td = data;
547 struct bitmask *verify_bitmask;
552 /* numa_parse_nodestring() parses a character string list
553 * of nodes into a bit mask. The bit mask is allocated by
554 * numa_allocate_nodemask(), so it should be freed by
555 * numa_free_nodemask().
557 verify_bitmask = numa_parse_nodestring(input);
558 if (verify_bitmask == NULL) {
559 log_err("fio: numa_parse_nodestring failed\n");
560 td_verror(td, 1, "str_numa_cpunodes_cb");
563 numa_free_nodemask(verify_bitmask);
565 td->o.numa_cpunodes = strdup(input);
569 static int str_numa_mpol_cb(void *data, char *input)
571 struct thread_data *td = data;
572 const char * const policy_types[] =
573 { "default", "prefer", "bind", "interleave", "local", NULL };
576 struct bitmask *verify_bitmask;
581 nodelist = strchr(input, ':');
583 /* NUL-terminate mode */
587 for (i = 0; i <= MPOL_LOCAL; i++) {
588 if (!strcmp(input, policy_types[i])) {
589 td->o.numa_mem_mode = i;
593 if (i > MPOL_LOCAL) {
594 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
598 switch (td->o.numa_mem_mode) {
601 * Insist on a nodelist of one node only
604 char *rest = nodelist;
605 while (isdigit(*rest))
608 log_err("fio: one node only for \'prefer\'\n");
612 log_err("fio: one node is needed for \'prefer\'\n");
616 case MPOL_INTERLEAVE:
618 * Default to online nodes with memory if no nodelist
621 nodelist = strdup("all");
626 * Don't allow a nodelist
629 log_err("fio: NO nodelist for \'local\'\n");
635 * Insist on a nodelist
638 log_err("fio: a nodelist is needed for \'bind\'\n");
645 /* numa_parse_nodestring() parses a character string list
646 * of nodes into a bit mask. The bit mask is allocated by
647 * numa_allocate_nodemask(), so it should be freed by
648 * numa_free_nodemask().
650 switch (td->o.numa_mem_mode) {
652 td->o.numa_mem_prefer_node = atoi(nodelist);
654 case MPOL_INTERLEAVE:
656 verify_bitmask = numa_parse_nodestring(nodelist);
657 if (verify_bitmask == NULL) {
658 log_err("fio: numa_parse_nodestring failed\n");
659 td_verror(td, 1, "str_numa_memnodes_cb");
662 td->o.numa_memnodes = strdup(nodelist);
663 numa_free_nodemask(verify_bitmask);
678 static int str_fst_cb(void *data, const char *str)
680 struct thread_data *td = data;
681 char *nr = get_opt_postfix(str);
683 td->file_service_nr = 1;
685 td->file_service_nr = atoi(nr);
692 #ifdef CONFIG_SYNC_FILE_RANGE
693 static int str_sfr_cb(void *data, const char *str)
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
698 td->sync_file_range_nr = 1;
700 td->sync_file_range_nr = atoi(nr);
708 static int str_random_distribution_cb(void *data, const char *str)
710 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)
720 val = FIO_DEF_PARETO;
721 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
726 nr = get_opt_postfix(str);
727 if (nr && !str_to_float(nr, &val, 0)) {
728 log_err("fio: random postfix parsing failed\n");
735 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
737 log_err("fio: zipf theta must different than 1.0\n");
740 td->o.zipf_theta.u.f = val;
741 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
742 if (val <= 0.00 || val >= 1.00) {
743 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
746 td->o.pareto_h.u.f = val;
748 if (val <= 0.00 || val >= 100.0) {
749 log_err("fio: normal deviation out of range (0 < input < 100.0)\n");
752 td->o.gauss_dev = val;
759 * Return next name in the string. Files are separated with ':'. If the ':'
760 * is escaped with a '\', then that ':' is part of the filename and does not
761 * indicate a new file.
763 static char *get_next_name(char **ptr)
768 if (!str || !strlen(str))
774 * No colon, we are done
776 p = strchr(str, ':');
783 * We got a colon, but it's the first character. Skip and
791 if (*(p - 1) != '\\') {
797 memmove(p - 1, p, strlen(p) + 1);
805 static int get_max_name_idx(char *input)
807 unsigned int cur_idx;
810 p = str = strdup(input);
811 for (cur_idx = 0; ; cur_idx++)
812 if (get_next_name(&str) == NULL)
820 * Returns the directory at the index, indexes > entires will be
821 * assigned via modulo division of the index
823 int set_name_idx(char *target, char *input, int index)
825 unsigned int cur_idx;
827 char *fname, *str, *p;
829 p = str = strdup(input);
831 index %= get_max_name_idx(input);
832 for (cur_idx = 0; cur_idx <= index; cur_idx++)
833 fname = get_next_name(&str);
835 len = sprintf(target, "%s/", fname);
841 static int str_filename_cb(void *data, const char *input)
843 struct thread_data *td = data;
844 char *fname, *str, *p;
846 p = str = strdup(input);
848 strip_blank_front(&str);
849 strip_blank_end(str);
851 if (!td->files_index)
854 while ((fname = get_next_name(&str)) != NULL) {
857 add_file(td, fname, 0, 1);
864 static int str_directory_cb(void *data, const char fio_unused *unused)
866 struct thread_data *td = data;
868 char *dirname, *str, *p;
874 p = str = strdup(td->o.directory);
875 while ((dirname = get_next_name(&str)) != NULL) {
876 if (lstat(dirname, &sb) < 0) {
879 log_err("fio: %s is not a directory\n", dirname);
880 td_verror(td, ret, "lstat");
883 if (!S_ISDIR(sb.st_mode)) {
884 log_err("fio: %s is not a directory\n", dirname);
895 static int str_opendir_cb(void *data, const char fio_unused *str)
897 struct thread_data *td = data;
902 if (!td->files_index)
905 return add_dir_files(td, td->o.opendir);
908 static int pattern_cb(char *pattern, unsigned int max_size,
909 const char *input, unsigned int *pattern_bytes)
912 int i = 0, j = 0, len, k, base = 10;
913 uint32_t pattern_length;
917 * Check if it's a string input
919 loc1 = strchr(input, '\"');
923 if (*loc1 == '\0' || *loc1 == '\"')
928 } while (i < max_size);
937 * No string, find out if it's decimal or hexidecimal
939 loc1 = strstr(input, "0x");
940 loc2 = strstr(input, "0X");
943 off = strtol(input, NULL, base);
944 if (off != LONG_MAX || errno != ERANGE) {
946 pattern[i] = off & 0xff;
955 j = loc1 - input + 2;
957 j = loc2 - input + 2;
960 if (len - j < max_size * 2) {
962 off = converthexchartoint(input[k--]);
964 off += (converthexchartoint(input[k--])
966 pattern[i++] = (char) off;
972 * Fill the pattern all the way to the end. This greatly reduces
973 * the number of memcpy's we have to do when verifying the IO.
977 while (i > 1 && i * 2 <= max_size) {
978 memcpy(&pattern[i], &pattern[0], i);
983 * Fill remainder, if the pattern multiple ends up not being
986 while (i > 1 && i < max_size) {
987 unsigned int b = min(pattern_length, max_size - i);
989 memcpy(&pattern[i], &pattern[0], b);
995 * The code in verify_io_u_pattern assumes a single byte
996 * pattern fills the whole verify pattern buffer.
998 memset(pattern, pattern[0], max_size);
1005 static int str_buffer_pattern_cb(void *data, const char *input)
1007 struct thread_data *td = data;
1010 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1011 &td->o.buffer_pattern_bytes);
1013 if (!ret && td->o.buffer_pattern_bytes) {
1014 if (!td->o.compress_percentage)
1015 td->o.refill_buffers = 0;
1016 td->o.scramble_buffers = 0;
1017 td->o.zero_buffers = 0;
1019 log_err("fio: failed parsing pattern `%s`\n", input);
1026 static int str_buffer_compress_cb(void *data, unsigned long long *il)
1028 struct thread_data *td = data;
1030 td->flags |= TD_F_COMPRESS;
1031 td->o.compress_percentage = *il;
1035 static int str_dedupe_cb(void *data, unsigned long long *il)
1037 struct thread_data *td = data;
1039 td->flags |= TD_F_COMPRESS;
1040 td->o.dedupe_percentage = *il;
1041 td->o.refill_buffers = 1;
1045 static int str_verify_pattern_cb(void *data, const char *input)
1047 struct thread_data *td = data;
1050 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1051 &td->o.verify_pattern_bytes);
1054 * VERIFY_META could already be set
1056 if (!ret && td->o.verify == VERIFY_NONE)
1057 td->o.verify = VERIFY_PATTERN;
1062 static int str_gtod_reduce_cb(void *data, int *il)
1064 struct thread_data *td = data;
1067 td->o.disable_lat = !!val;
1068 td->o.disable_clat = !!val;
1069 td->o.disable_slat = !!val;
1070 td->o.disable_bw = !!val;
1071 td->o.clat_percentiles = !val;
1073 td->tv_cache_mask = 63;
1078 static int str_size_cb(void *data, unsigned long long *__val)
1080 struct thread_data *td = data;
1081 unsigned long long v = *__val;
1083 if (parse_is_percent(v)) {
1085 td->o.size_percent = -1ULL - v;
1092 static int rw_verify(struct fio_option *o, void *data)
1094 struct thread_data *td = data;
1096 if (read_only && td_write(td)) {
1097 log_err("fio: job <%s> has write bit set, but fio is in"
1098 " read-only mode\n", td->o.name);
1105 static int gtod_cpu_verify(struct fio_option *o, void *data)
1107 #ifndef FIO_HAVE_CPU_AFFINITY
1108 struct thread_data *td = data;
1110 if (td->o.gtod_cpu) {
1111 log_err("fio: platform must support CPU affinity for"
1112 "gettimeofday() offloading\n");
1123 static struct opt_group fio_opt_groups[] = {
1126 .mask = FIO_OPT_C_GENERAL,
1130 .mask = FIO_OPT_C_IO,
1134 .mask = FIO_OPT_C_FILE,
1137 .name = "Statistics",
1138 .mask = FIO_OPT_C_STAT,
1142 .mask = FIO_OPT_C_LOG,
1146 .mask = FIO_OPT_C_PROFILE,
1153 static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1154 unsigned int inv_mask)
1156 struct opt_group *og;
1159 if (*mask == inv_mask || !*mask)
1162 for (i = 0; ogs[i].name; i++) {
1165 if (*mask & og->mask) {
1166 *mask &= ~(og->mask);
1174 struct opt_group *opt_group_from_mask(unsigned int *mask)
1176 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1179 static struct opt_group fio_opt_cat_groups[] = {
1181 .name = "Latency profiling",
1182 .mask = FIO_OPT_G_LATPROF,
1186 .mask = FIO_OPT_G_RATE,
1190 .mask = FIO_OPT_G_ZONE,
1193 .name = "Read/write mix",
1194 .mask = FIO_OPT_G_RWMIX,
1198 .mask = FIO_OPT_G_VERIFY,
1202 .mask = FIO_OPT_G_TRIM,
1205 .name = "I/O Logging",
1206 .mask = FIO_OPT_G_IOLOG,
1209 .name = "I/O Depth",
1210 .mask = FIO_OPT_G_IO_DEPTH,
1214 .mask = FIO_OPT_G_IO_FLOW,
1217 .name = "Description",
1218 .mask = FIO_OPT_G_DESC,
1222 .mask = FIO_OPT_G_FILENAME,
1225 .name = "General I/O",
1226 .mask = FIO_OPT_G_IO_BASIC,
1230 .mask = FIO_OPT_G_CGROUP,
1234 .mask = FIO_OPT_G_RUNTIME,
1238 .mask = FIO_OPT_G_PROCESS,
1241 .name = "Job credentials / priority",
1242 .mask = FIO_OPT_G_CRED,
1245 .name = "Clock settings",
1246 .mask = FIO_OPT_G_CLOCK,
1250 .mask = FIO_OPT_G_IO_TYPE,
1253 .name = "I/O Thinktime",
1254 .mask = FIO_OPT_G_THINKTIME,
1257 .name = "Randomizations",
1258 .mask = FIO_OPT_G_RANDOM,
1261 .name = "I/O buffers",
1262 .mask = FIO_OPT_G_IO_BUF,
1265 .name = "Tiobench profile",
1266 .mask = FIO_OPT_G_TIOBENCH,
1274 struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
1276 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
1280 * Map of job/command line options
1282 struct fio_option fio_options[FIO_MAX_OPTS] = {
1284 .name = "description",
1285 .lname = "Description of job",
1286 .type = FIO_OPT_STR_STORE,
1287 .off1 = td_var_offset(description),
1288 .help = "Text job description",
1289 .category = FIO_OPT_C_GENERAL,
1290 .group = FIO_OPT_G_DESC,
1294 .lname = "Job name",
1295 .type = FIO_OPT_STR_STORE,
1296 .off1 = td_var_offset(name),
1297 .help = "Name of this job",
1298 .category = FIO_OPT_C_GENERAL,
1299 .group = FIO_OPT_G_DESC,
1303 .lname = "Filename(s)",
1304 .type = FIO_OPT_STR_STORE,
1305 .off1 = td_var_offset(filename),
1306 .cb = str_filename_cb,
1307 .prio = -1, /* must come after "directory" */
1308 .help = "File(s) to use for the workload",
1309 .category = FIO_OPT_C_FILE,
1310 .group = FIO_OPT_G_FILENAME,
1313 .name = "directory",
1314 .lname = "Directory",
1315 .type = FIO_OPT_STR_STORE,
1316 .off1 = td_var_offset(directory),
1317 .cb = str_directory_cb,
1318 .help = "Directory to store files in",
1319 .category = FIO_OPT_C_FILE,
1320 .group = FIO_OPT_G_FILENAME,
1323 .name = "filename_format",
1324 .type = FIO_OPT_STR_STORE,
1325 .off1 = td_var_offset(filename_format),
1326 .prio = -1, /* must come after "directory" */
1327 .help = "Override default $jobname.$jobnum.$filenum naming",
1328 .def = "$jobname.$jobnum.$filenum",
1329 .category = FIO_OPT_C_FILE,
1330 .group = FIO_OPT_G_FILENAME,
1334 .lname = "Lockfile",
1335 .type = FIO_OPT_STR,
1336 .off1 = td_var_offset(file_lock_mode),
1337 .help = "Lock file when doing IO to it",
1339 .parent = "filename",
1342 .category = FIO_OPT_C_FILE,
1343 .group = FIO_OPT_G_FILENAME,
1346 .oval = FILE_LOCK_NONE,
1347 .help = "No file locking",
1349 { .ival = "exclusive",
1350 .oval = FILE_LOCK_EXCLUSIVE,
1351 .help = "Exclusive file lock",
1354 .ival = "readwrite",
1355 .oval = FILE_LOCK_READWRITE,
1356 .help = "Read vs write lock",
1362 .lname = "Open directory",
1363 .type = FIO_OPT_STR_STORE,
1364 .off1 = td_var_offset(opendir),
1365 .cb = str_opendir_cb,
1366 .help = "Recursively add files from this directory and down",
1367 .category = FIO_OPT_C_FILE,
1368 .group = FIO_OPT_G_FILENAME,
1372 .lname = "Read/write",
1373 .alias = "readwrite",
1374 .type = FIO_OPT_STR,
1376 .off1 = td_var_offset(td_ddir),
1377 .help = "IO direction",
1379 .verify = rw_verify,
1380 .category = FIO_OPT_C_IO,
1381 .group = FIO_OPT_G_IO_BASIC,
1384 .oval = TD_DDIR_READ,
1385 .help = "Sequential read",
1388 .oval = TD_DDIR_WRITE,
1389 .help = "Sequential write",
1392 .oval = TD_DDIR_TRIM,
1393 .help = "Sequential trim",
1395 { .ival = "randread",
1396 .oval = TD_DDIR_RANDREAD,
1397 .help = "Random read",
1399 { .ival = "randwrite",
1400 .oval = TD_DDIR_RANDWRITE,
1401 .help = "Random write",
1403 { .ival = "randtrim",
1404 .oval = TD_DDIR_RANDTRIM,
1405 .help = "Random trim",
1409 .help = "Sequential read and write mix",
1411 { .ival = "readwrite",
1413 .help = "Sequential read and write mix",
1416 .oval = TD_DDIR_RANDRW,
1417 .help = "Random read and write mix"
1422 .name = "rw_sequencer",
1423 .lname = "RW Sequencer",
1424 .type = FIO_OPT_STR,
1425 .off1 = td_var_offset(rw_seq),
1426 .help = "IO offset generator modifier",
1427 .def = "sequential",
1428 .category = FIO_OPT_C_IO,
1429 .group = FIO_OPT_G_IO_BASIC,
1431 { .ival = "sequential",
1433 .help = "Generate sequential offsets",
1435 { .ival = "identical",
1436 .oval = RW_SEQ_IDENT,
1437 .help = "Generate identical offsets",
1444 .lname = "IO Engine",
1445 .type = FIO_OPT_STR_STORE,
1446 .off1 = td_var_offset(ioengine),
1447 .help = "IO engine to use",
1448 .def = FIO_PREFERRED_ENGINE,
1449 .category = FIO_OPT_C_IO,
1450 .group = FIO_OPT_G_IO_BASIC,
1453 .help = "Use read/write",
1456 .help = "Use pread/pwrite",
1459 .help = "Use readv/writev",
1461 #ifdef CONFIG_PWRITEV
1463 .help = "Use preadv/pwritev",
1466 #ifdef CONFIG_LIBAIO
1468 .help = "Linux native asynchronous IO",
1471 #ifdef CONFIG_POSIXAIO
1472 { .ival = "posixaio",
1473 .help = "POSIX asynchronous IO",
1476 #ifdef CONFIG_SOLARISAIO
1477 { .ival = "solarisaio",
1478 .help = "Solaris native asynchronous IO",
1481 #ifdef CONFIG_WINDOWSAIO
1482 { .ival = "windowsaio",
1483 .help = "Windows native asynchronous IO"
1488 .help = "Rados Block Device asynchronous IO"
1492 .help = "Memory mapped IO"
1494 #ifdef CONFIG_LINUX_SPLICE
1496 .help = "splice/vmsplice based IO",
1498 { .ival = "netsplice",
1499 .help = "splice/vmsplice to/from the network",
1502 #ifdef FIO_HAVE_SGIO
1504 .help = "SCSI generic v3 IO",
1508 .help = "Testing engine (no data transfer)",
1511 .help = "Network IO",
1514 .help = "CPU cycle burner engine",
1518 .help = "GUASI IO engine",
1521 #ifdef FIO_HAVE_BINJECT
1522 { .ival = "binject",
1523 .help = "binject direct inject block engine",
1528 .help = "RDMA IO engine",
1531 #ifdef CONFIG_FUSION_AW
1532 { .ival = "fusion-aw-sync",
1533 .help = "Fusion-io atomic write engine",
1536 #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1537 { .ival = "e4defrag",
1538 .help = "ext4 defrag engine",
1541 #ifdef CONFIG_LINUX_FALLOCATE
1543 .help = "fallocate() file based engine",
1548 .help = "Glusterfs libgfapi(sync) based engine"
1550 { .ival = "gfapi_async",
1551 .help = "Glusterfs libgfapi(async) based engine"
1554 #ifdef CONFIG_LIBHDFS
1555 { .ival = "libhdfs",
1556 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1559 { .ival = "external",
1560 .help = "Load external engine (append name)",
1566 .lname = "IO Depth",
1567 .type = FIO_OPT_INT,
1568 .off1 = td_var_offset(iodepth),
1569 .help = "Number of IO buffers to keep in flight",
1573 .category = FIO_OPT_C_IO,
1574 .group = FIO_OPT_G_IO_BASIC,
1577 .name = "iodepth_batch",
1578 .lname = "IO Depth batch",
1579 .alias = "iodepth_batch_submit",
1580 .type = FIO_OPT_INT,
1581 .off1 = td_var_offset(iodepth_batch),
1582 .help = "Number of IO buffers to submit in one go",
1583 .parent = "iodepth",
1588 .category = FIO_OPT_C_IO,
1589 .group = FIO_OPT_G_IO_BASIC,
1592 .name = "iodepth_batch_complete",
1593 .lname = "IO Depth batch complete",
1594 .type = FIO_OPT_INT,
1595 .off1 = td_var_offset(iodepth_batch_complete),
1596 .help = "Number of IO buffers to retrieve in one go",
1597 .parent = "iodepth",
1602 .category = FIO_OPT_C_IO,
1603 .group = FIO_OPT_G_IO_BASIC,
1606 .name = "iodepth_low",
1607 .lname = "IO Depth batch low",
1608 .type = FIO_OPT_INT,
1609 .off1 = td_var_offset(iodepth_low),
1610 .help = "Low water mark for queuing depth",
1611 .parent = "iodepth",
1614 .category = FIO_OPT_C_IO,
1615 .group = FIO_OPT_G_IO_BASIC,
1620 .type = FIO_OPT_STR_VAL,
1622 .off1 = td_var_offset(size),
1623 .help = "Total size of device or files",
1624 .interval = 1024 * 1024,
1625 .category = FIO_OPT_C_IO,
1626 .group = FIO_OPT_G_INVALID,
1630 .alias = "io_limit",
1632 .type = FIO_OPT_STR_VAL,
1633 .off1 = td_var_offset(io_limit),
1634 .interval = 1024 * 1024,
1635 .category = FIO_OPT_C_IO,
1636 .group = FIO_OPT_G_INVALID,
1639 .name = "fill_device",
1640 .lname = "Fill device",
1642 .type = FIO_OPT_BOOL,
1643 .off1 = td_var_offset(fill_device),
1644 .help = "Write until an ENOSPC error occurs",
1646 .category = FIO_OPT_C_FILE,
1647 .group = FIO_OPT_G_INVALID,
1651 .lname = "File size",
1652 .type = FIO_OPT_STR_VAL,
1653 .off1 = td_var_offset(file_size_low),
1654 .off2 = td_var_offset(file_size_high),
1656 .help = "Size of individual files",
1657 .interval = 1024 * 1024,
1658 .category = FIO_OPT_C_FILE,
1659 .group = FIO_OPT_G_INVALID,
1662 .name = "file_append",
1663 .lname = "File append",
1664 .type = FIO_OPT_BOOL,
1665 .off1 = td_var_offset(file_append),
1666 .help = "IO will start at the end of the file(s)",
1668 .category = FIO_OPT_C_FILE,
1669 .group = FIO_OPT_G_INVALID,
1673 .lname = "IO offset",
1674 .alias = "fileoffset",
1675 .type = FIO_OPT_STR_VAL,
1676 .off1 = td_var_offset(start_offset),
1677 .help = "Start IO from this offset",
1679 .interval = 1024 * 1024,
1680 .category = FIO_OPT_C_IO,
1681 .group = FIO_OPT_G_INVALID,
1684 .name = "offset_increment",
1685 .lname = "IO offset increment",
1686 .type = FIO_OPT_STR_VAL,
1687 .off1 = td_var_offset(offset_increment),
1688 .help = "What is the increment from one offset to the next",
1692 .interval = 1024 * 1024,
1693 .category = FIO_OPT_C_IO,
1694 .group = FIO_OPT_G_INVALID,
1697 .name = "number_ios",
1698 .lname = "Number of IOs to perform",
1699 .type = FIO_OPT_STR_VAL,
1700 .off1 = td_var_offset(number_ios),
1701 .help = "Force job completion after this number of IOs",
1703 .category = FIO_OPT_C_IO,
1704 .group = FIO_OPT_G_INVALID,
1708 .lname = "Block size",
1709 .alias = "blocksize",
1710 .type = FIO_OPT_INT,
1711 .off1 = td_var_offset(bs[DDIR_READ]),
1712 .off2 = td_var_offset(bs[DDIR_WRITE]),
1713 .off3 = td_var_offset(bs[DDIR_TRIM]),
1715 .help = "Block size unit",
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
1725 .lname = "Block size align",
1726 .alias = "blockalign",
1727 .type = FIO_OPT_INT,
1728 .off1 = td_var_offset(ba[DDIR_READ]),
1729 .off2 = td_var_offset(ba[DDIR_WRITE]),
1730 .off3 = td_var_offset(ba[DDIR_TRIM]),
1732 .help = "IO block offset alignment",
1736 .category = FIO_OPT_C_IO,
1737 .group = FIO_OPT_G_INVALID,
1741 .lname = "Block size range",
1742 .alias = "blocksize_range",
1743 .type = FIO_OPT_RANGE,
1744 .off1 = td_var_offset(min_bs[DDIR_READ]),
1745 .off2 = td_var_offset(max_bs[DDIR_READ]),
1746 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1747 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1748 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1749 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
1751 .help = "Set block size range (in more detail than bs)",
1755 .category = FIO_OPT_C_IO,
1756 .group = FIO_OPT_G_INVALID,
1760 .lname = "Block size split",
1761 .type = FIO_OPT_STR,
1762 .cb = str_bssplit_cb,
1763 .off1 = td_var_offset(bssplit),
1764 .help = "Set a specific mix of block sizes",
1767 .category = FIO_OPT_C_IO,
1768 .group = FIO_OPT_G_INVALID,
1771 .name = "bs_unaligned",
1772 .lname = "Block size unaligned",
1773 .alias = "blocksize_unaligned",
1774 .type = FIO_OPT_STR_SET,
1775 .off1 = td_var_offset(bs_unaligned),
1776 .help = "Don't sector align IO buffer sizes",
1779 .category = FIO_OPT_C_IO,
1780 .group = FIO_OPT_G_INVALID,
1783 .name = "bs_is_seq_rand",
1784 .lname = "Block size division is seq/random (not read/write)",
1785 .type = FIO_OPT_BOOL,
1786 .off1 = td_var_offset(bs_is_seq_rand),
1787 .help = "Consider any blocksize setting to be sequential,random",
1789 .parent = "blocksize",
1790 .category = FIO_OPT_C_IO,
1791 .group = FIO_OPT_G_INVALID,
1794 .name = "randrepeat",
1795 .lname = "Random repeatable",
1796 .type = FIO_OPT_BOOL,
1797 .off1 = td_var_offset(rand_repeatable),
1798 .help = "Use repeatable random IO pattern",
1802 .category = FIO_OPT_C_IO,
1803 .group = FIO_OPT_G_RANDOM,
1807 .lname = "The random generator seed",
1808 .type = FIO_OPT_STR_VAL,
1809 .off1 = td_var_offset(rand_seed),
1810 .help = "Set the random generator seed value",
1812 .category = FIO_OPT_C_IO,
1813 .group = FIO_OPT_G_RANDOM,
1816 .name = "use_os_rand",
1817 .lname = "Use OS random",
1818 .type = FIO_OPT_DEPRECATED,
1819 .off1 = td_var_offset(dep_use_os_rand),
1820 .category = FIO_OPT_C_IO,
1821 .group = FIO_OPT_G_RANDOM,
1824 .name = "norandommap",
1825 .lname = "No randommap",
1826 .type = FIO_OPT_STR_SET,
1827 .off1 = td_var_offset(norandommap),
1828 .help = "Accept potential duplicate random blocks",
1832 .category = FIO_OPT_C_IO,
1833 .group = FIO_OPT_G_RANDOM,
1836 .name = "softrandommap",
1837 .lname = "Soft randommap",
1838 .type = FIO_OPT_BOOL,
1839 .off1 = td_var_offset(softrandommap),
1840 .help = "Set norandommap if randommap allocation fails",
1841 .parent = "norandommap",
1844 .category = FIO_OPT_C_IO,
1845 .group = FIO_OPT_G_RANDOM,
1848 .name = "random_generator",
1849 .type = FIO_OPT_STR,
1850 .off1 = td_var_offset(random_generator),
1851 .help = "Type of random number generator to use",
1852 .def = "tausworthe",
1854 { .ival = "tausworthe",
1855 .oval = FIO_RAND_GEN_TAUSWORTHE,
1856 .help = "Strong Tausworthe generator",
1859 .oval = FIO_RAND_GEN_LFSR,
1860 .help = "Variable length LFSR",
1863 .category = FIO_OPT_C_IO,
1864 .group = FIO_OPT_G_RANDOM,
1867 .name = "random_distribution",
1868 .type = FIO_OPT_STR,
1869 .off1 = td_var_offset(random_distribution),
1870 .cb = str_random_distribution_cb,
1871 .help = "Random offset distribution generator",
1875 .oval = FIO_RAND_DIST_RANDOM,
1876 .help = "Completely random",
1879 .oval = FIO_RAND_DIST_ZIPF,
1880 .help = "Zipf distribution",
1883 .oval = FIO_RAND_DIST_PARETO,
1884 .help = "Pareto distribution",
1887 .oval = FIO_RAND_DIST_GAUSS,
1888 .help = "Normal (gaussian) distribution",
1891 .category = FIO_OPT_C_IO,
1892 .group = FIO_OPT_G_RANDOM,
1895 .name = "percentage_random",
1896 .lname = "Percentage Random",
1897 .type = FIO_OPT_INT,
1898 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1899 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1900 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
1902 .help = "Percentage of seq/random mix that should be random",
1903 .def = "100,100,100",
1905 .inverse = "percentage_sequential",
1906 .category = FIO_OPT_C_IO,
1907 .group = FIO_OPT_G_RANDOM,
1910 .name = "percentage_sequential",
1911 .lname = "Percentage Sequential",
1912 .type = FIO_OPT_DEPRECATED,
1913 .category = FIO_OPT_C_IO,
1914 .group = FIO_OPT_G_RANDOM,
1917 .name = "allrandrepeat",
1918 .type = FIO_OPT_BOOL,
1919 .off1 = td_var_offset(allrand_repeatable),
1920 .help = "Use repeatable random numbers for everything",
1922 .category = FIO_OPT_C_IO,
1923 .group = FIO_OPT_G_RANDOM,
1927 .lname = "Number of files",
1928 .alias = "nr_files",
1929 .type = FIO_OPT_INT,
1930 .off1 = td_var_offset(nr_files),
1931 .help = "Split job workload between this number of files",
1934 .category = FIO_OPT_C_FILE,
1935 .group = FIO_OPT_G_INVALID,
1938 .name = "openfiles",
1939 .lname = "Number of open files",
1940 .type = FIO_OPT_INT,
1941 .off1 = td_var_offset(open_files),
1942 .help = "Number of files to keep open at the same time",
1943 .category = FIO_OPT_C_FILE,
1944 .group = FIO_OPT_G_INVALID,
1947 .name = "file_service_type",
1948 .lname = "File service type",
1949 .type = FIO_OPT_STR,
1951 .off1 = td_var_offset(file_service_type),
1952 .help = "How to select which file to service next",
1953 .def = "roundrobin",
1954 .category = FIO_OPT_C_FILE,
1955 .group = FIO_OPT_G_INVALID,
1958 .oval = FIO_FSERVICE_RANDOM,
1959 .help = "Choose a file at random",
1961 { .ival = "roundrobin",
1962 .oval = FIO_FSERVICE_RR,
1963 .help = "Round robin select files",
1965 { .ival = "sequential",
1966 .oval = FIO_FSERVICE_SEQ,
1967 .help = "Finish one file before moving to the next",
1970 .parent = "nrfiles",
1973 #ifdef CONFIG_POSIX_FALLOCATE
1975 .name = "fallocate",
1976 .lname = "Fallocate",
1977 .type = FIO_OPT_STR,
1978 .off1 = td_var_offset(fallocate_mode),
1979 .help = "Whether pre-allocation is performed when laying out files",
1981 .category = FIO_OPT_C_FILE,
1982 .group = FIO_OPT_G_INVALID,
1985 .oval = FIO_FALLOCATE_NONE,
1986 .help = "Do not pre-allocate space",
1989 .oval = FIO_FALLOCATE_POSIX,
1990 .help = "Use posix_fallocate()",
1992 #ifdef CONFIG_LINUX_FALLOCATE
1994 .oval = FIO_FALLOCATE_KEEP_SIZE,
1995 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1998 /* Compatibility with former boolean values */
2000 .oval = FIO_FALLOCATE_NONE,
2001 .help = "Alias for 'none'",
2004 .oval = FIO_FALLOCATE_POSIX,
2005 .help = "Alias for 'posix'",
2009 #endif /* CONFIG_POSIX_FALLOCATE */
2011 .name = "fadvise_hint",
2012 .lname = "Fadvise hint",
2013 .type = FIO_OPT_BOOL,
2014 .off1 = td_var_offset(fadvise_hint),
2015 .help = "Use fadvise() to advise the kernel on IO pattern",
2017 .category = FIO_OPT_C_FILE,
2018 .group = FIO_OPT_G_INVALID,
2020 #ifdef FIO_HAVE_STREAMID
2022 .name = "fadvise_stream",
2023 .lname = "Fadvise stream",
2024 .type = FIO_OPT_INT,
2025 .off1 = td_var_offset(fadvise_stream),
2026 .help = "Use fadvise() to set stream ID",
2027 .category = FIO_OPT_C_FILE,
2028 .group = FIO_OPT_G_INVALID,
2034 .type = FIO_OPT_INT,
2035 .off1 = td_var_offset(fsync_blocks),
2036 .help = "Issue fsync for writes every given number of blocks",
2039 .category = FIO_OPT_C_FILE,
2040 .group = FIO_OPT_G_INVALID,
2043 .name = "fdatasync",
2044 .lname = "Fdatasync",
2045 .type = FIO_OPT_INT,
2046 .off1 = td_var_offset(fdatasync_blocks),
2047 .help = "Issue fdatasync for writes every given number of blocks",
2050 .category = FIO_OPT_C_FILE,
2051 .group = FIO_OPT_G_INVALID,
2054 .name = "write_barrier",
2055 .lname = "Write barrier",
2056 .type = FIO_OPT_INT,
2057 .off1 = td_var_offset(barrier_blocks),
2058 .help = "Make every Nth write a barrier write",
2061 .category = FIO_OPT_C_IO,
2062 .group = FIO_OPT_G_INVALID,
2064 #ifdef CONFIG_SYNC_FILE_RANGE
2066 .name = "sync_file_range",
2067 .lname = "Sync file range",
2069 { .ival = "wait_before",
2070 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2071 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
2075 .oval = SYNC_FILE_RANGE_WRITE,
2076 .help = "SYNC_FILE_RANGE_WRITE",
2080 .ival = "wait_after",
2081 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2082 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
2086 .type = FIO_OPT_STR_MULTI,
2088 .off1 = td_var_offset(sync_file_range),
2089 .help = "Use sync_file_range()",
2090 .category = FIO_OPT_C_FILE,
2091 .group = FIO_OPT_G_INVALID,
2096 .lname = "Direct I/O",
2097 .type = FIO_OPT_BOOL,
2098 .off1 = td_var_offset(odirect),
2099 .help = "Use O_DIRECT IO (negates buffered)",
2101 .inverse = "buffered",
2102 .category = FIO_OPT_C_IO,
2103 .group = FIO_OPT_G_IO_TYPE,
2107 .lname = "Atomic I/O",
2108 .type = FIO_OPT_BOOL,
2109 .off1 = td_var_offset(oatomic),
2110 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2112 .category = FIO_OPT_C_IO,
2113 .group = FIO_OPT_G_IO_TYPE,
2117 .lname = "Buffered I/O",
2118 .type = FIO_OPT_BOOL,
2119 .off1 = td_var_offset(odirect),
2121 .help = "Use buffered IO (negates direct)",
2123 .inverse = "direct",
2124 .category = FIO_OPT_C_IO,
2125 .group = FIO_OPT_G_IO_TYPE,
2128 .name = "overwrite",
2129 .lname = "Overwrite",
2130 .type = FIO_OPT_BOOL,
2131 .off1 = td_var_offset(overwrite),
2132 .help = "When writing, set whether to overwrite current data",
2134 .category = FIO_OPT_C_FILE,
2135 .group = FIO_OPT_G_INVALID,
2140 .type = FIO_OPT_INT,
2141 .off1 = td_var_offset(loops),
2142 .help = "Number of times to run the job",
2145 .category = FIO_OPT_C_GENERAL,
2146 .group = FIO_OPT_G_RUNTIME,
2150 .lname = "Number of jobs",
2151 .type = FIO_OPT_INT,
2152 .off1 = td_var_offset(numjobs),
2153 .help = "Duplicate this job this many times",
2156 .category = FIO_OPT_C_GENERAL,
2157 .group = FIO_OPT_G_RUNTIME,
2160 .name = "startdelay",
2161 .lname = "Start delay",
2162 .type = FIO_OPT_STR_VAL_TIME,
2163 .off1 = td_var_offset(start_delay),
2164 .off2 = td_var_offset(start_delay_high),
2165 .help = "Only start job when this period has passed",
2169 .category = FIO_OPT_C_GENERAL,
2170 .group = FIO_OPT_G_RUNTIME,
2176 .type = FIO_OPT_STR_VAL_TIME,
2177 .off1 = td_var_offset(timeout),
2178 .help = "Stop workload when this amount of time has passed",
2182 .category = FIO_OPT_C_GENERAL,
2183 .group = FIO_OPT_G_RUNTIME,
2186 .name = "time_based",
2187 .lname = "Time based",
2188 .type = FIO_OPT_STR_SET,
2189 .off1 = td_var_offset(time_based),
2190 .help = "Keep running until runtime/timeout is met",
2191 .category = FIO_OPT_C_GENERAL,
2192 .group = FIO_OPT_G_RUNTIME,
2195 .name = "verify_only",
2196 .lname = "Verify only",
2197 .type = FIO_OPT_STR_SET,
2198 .off1 = td_var_offset(verify_only),
2199 .help = "Verifies previously written data is still valid",
2200 .category = FIO_OPT_C_GENERAL,
2201 .group = FIO_OPT_G_RUNTIME,
2204 .name = "ramp_time",
2205 .lname = "Ramp time",
2206 .type = FIO_OPT_STR_VAL_TIME,
2207 .off1 = td_var_offset(ramp_time),
2208 .help = "Ramp up time before measuring performance",
2211 .category = FIO_OPT_C_GENERAL,
2212 .group = FIO_OPT_G_RUNTIME,
2215 .name = "clocksource",
2216 .lname = "Clock source",
2217 .type = FIO_OPT_STR,
2218 .cb = fio_clock_source_cb,
2219 .off1 = td_var_offset(clocksource),
2220 .help = "What type of timing source to use",
2221 .category = FIO_OPT_C_GENERAL,
2222 .group = FIO_OPT_G_CLOCK,
2224 #ifdef CONFIG_GETTIMEOFDAY
2225 { .ival = "gettimeofday",
2227 .help = "Use gettimeofday(2) for timing",
2230 #ifdef CONFIG_CLOCK_GETTIME
2231 { .ival = "clock_gettime",
2232 .oval = CS_CGETTIME,
2233 .help = "Use clock_gettime(2) for timing",
2236 #ifdef ARCH_HAVE_CPU_CLOCK
2238 .oval = CS_CPUCLOCK,
2239 .help = "Use CPU private clock",
2247 .lname = "I/O Memory",
2248 .type = FIO_OPT_STR,
2250 .off1 = td_var_offset(mem_type),
2251 .help = "Backing type for IO buffers",
2253 .category = FIO_OPT_C_IO,
2254 .group = FIO_OPT_G_INVALID,
2258 .help = "Use malloc(3) for IO buffers",
2260 #ifndef CONFIG_NO_SHM
2263 .help = "Use shared memory segments for IO buffers",
2265 #ifdef FIO_HAVE_HUGETLB
2266 { .ival = "shmhuge",
2267 .oval = MEM_SHMHUGE,
2268 .help = "Like shm, but use huge pages",
2274 .help = "Use mmap(2) (file or anon) for IO buffers",
2276 #ifdef FIO_HAVE_HUGETLB
2277 { .ival = "mmaphuge",
2278 .oval = MEM_MMAPHUGE,
2279 .help = "Like mmap, but use huge pages",
2285 .name = "iomem_align",
2286 .alias = "mem_align",
2287 .lname = "I/O memory alignment",
2288 .type = FIO_OPT_INT,
2289 .off1 = td_var_offset(mem_align),
2291 .help = "IO memory buffer offset alignment",
2295 .category = FIO_OPT_C_IO,
2296 .group = FIO_OPT_G_INVALID,
2301 .type = FIO_OPT_STR,
2302 .off1 = td_var_offset(verify),
2303 .help = "Verify data written",
2305 .category = FIO_OPT_C_IO,
2306 .group = FIO_OPT_G_VERIFY,
2309 .oval = VERIFY_NONE,
2310 .help = "Don't do IO verification",
2314 .help = "Use md5 checksums for verification",
2317 .oval = VERIFY_CRC64,
2318 .help = "Use crc64 checksums for verification",
2321 .oval = VERIFY_CRC32,
2322 .help = "Use crc32 checksums for verification",
2324 { .ival = "crc32c-intel",
2325 .oval = VERIFY_CRC32C,
2326 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2329 .oval = VERIFY_CRC32C,
2330 .help = "Use crc32c checksums for verification (hw assisted, if available)",
2333 .oval = VERIFY_CRC16,
2334 .help = "Use crc16 checksums for verification",
2337 .oval = VERIFY_CRC7,
2338 .help = "Use crc7 checksums for verification",
2341 .oval = VERIFY_SHA1,
2342 .help = "Use sha1 checksums for verification",
2345 .oval = VERIFY_SHA256,
2346 .help = "Use sha256 checksums for verification",
2349 .oval = VERIFY_SHA512,
2350 .help = "Use sha512 checksums for verification",
2353 .oval = VERIFY_XXHASH,
2354 .help = "Use xxhash checksums for verification",
2357 .oval = VERIFY_META,
2358 .help = "Use io information",
2362 .oval = VERIFY_NULL,
2363 .help = "Pretend to verify",
2368 .name = "do_verify",
2369 .lname = "Perform verify step",
2370 .type = FIO_OPT_BOOL,
2371 .off1 = td_var_offset(do_verify),
2372 .help = "Run verification stage after write",
2376 .category = FIO_OPT_C_IO,
2377 .group = FIO_OPT_G_VERIFY,
2380 .name = "verifysort",
2381 .lname = "Verify sort",
2382 .type = FIO_OPT_BOOL,
2383 .off1 = td_var_offset(verifysort),
2384 .help = "Sort written verify blocks for read back",
2388 .category = FIO_OPT_C_IO,
2389 .group = FIO_OPT_G_VERIFY,
2392 .name = "verifysort_nr",
2393 .type = FIO_OPT_INT,
2394 .off1 = td_var_offset(verifysort_nr),
2395 .help = "Pre-load and sort verify blocks for a read workload",
2400 .category = FIO_OPT_C_IO,
2401 .group = FIO_OPT_G_VERIFY,
2404 .name = "verify_interval",
2405 .lname = "Verify interval",
2406 .type = FIO_OPT_INT,
2407 .off1 = td_var_offset(verify_interval),
2408 .minval = 2 * sizeof(struct verify_header),
2409 .help = "Store verify buffer header every N bytes",
2412 .interval = 2 * sizeof(struct verify_header),
2413 .category = FIO_OPT_C_IO,
2414 .group = FIO_OPT_G_VERIFY,
2417 .name = "verify_offset",
2418 .lname = "Verify offset",
2419 .type = FIO_OPT_INT,
2420 .help = "Offset verify header location by N bytes",
2421 .off1 = td_var_offset(verify_offset),
2422 .minval = sizeof(struct verify_header),
2425 .category = FIO_OPT_C_IO,
2426 .group = FIO_OPT_G_VERIFY,
2429 .name = "verify_pattern",
2430 .lname = "Verify pattern",
2431 .type = FIO_OPT_STR,
2432 .cb = str_verify_pattern_cb,
2433 .off1 = td_var_offset(verify_pattern),
2434 .help = "Fill pattern for IO buffers",
2437 .category = FIO_OPT_C_IO,
2438 .group = FIO_OPT_G_VERIFY,
2441 .name = "verify_fatal",
2442 .lname = "Verify fatal",
2443 .type = FIO_OPT_BOOL,
2444 .off1 = td_var_offset(verify_fatal),
2446 .help = "Exit on a single verify failure, don't continue",
2449 .category = FIO_OPT_C_IO,
2450 .group = FIO_OPT_G_VERIFY,
2453 .name = "verify_dump",
2454 .lname = "Verify dump",
2455 .type = FIO_OPT_BOOL,
2456 .off1 = td_var_offset(verify_dump),
2458 .help = "Dump contents of good and bad blocks on failure",
2461 .category = FIO_OPT_C_IO,
2462 .group = FIO_OPT_G_VERIFY,
2465 .name = "verify_async",
2466 .lname = "Verify asynchronously",
2467 .type = FIO_OPT_INT,
2468 .off1 = td_var_offset(verify_async),
2470 .help = "Number of async verifier threads to use",
2473 .category = FIO_OPT_C_IO,
2474 .group = FIO_OPT_G_VERIFY,
2477 .name = "verify_backlog",
2478 .lname = "Verify backlog",
2479 .type = FIO_OPT_STR_VAL,
2480 .off1 = td_var_offset(verify_backlog),
2481 .help = "Verify after this number of blocks are written",
2484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_VERIFY,
2488 .name = "verify_backlog_batch",
2489 .lname = "Verify backlog batch",
2490 .type = FIO_OPT_INT,
2491 .off1 = td_var_offset(verify_batch),
2492 .help = "Verify this number of IO blocks",
2495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_VERIFY,
2498 #ifdef FIO_HAVE_CPU_AFFINITY
2500 .name = "verify_async_cpus",
2501 .lname = "Async verify CPUs",
2502 .type = FIO_OPT_STR,
2503 .cb = str_verify_cpus_allowed_cb,
2504 .off1 = td_var_offset(verify_cpumask),
2505 .help = "Set CPUs allowed for async verify threads",
2506 .parent = "verify_async",
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
2513 .name = "experimental_verify",
2514 .off1 = td_var_offset(experimental_verify),
2515 .type = FIO_OPT_BOOL,
2516 .help = "Enable experimental verification",
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_VERIFY,
2522 .name = "verify_state_load",
2523 .lname = "Load verify state",
2524 .off1 = td_var_offset(verify_state),
2525 .type = FIO_OPT_BOOL,
2526 .help = "Load verify termination state",
2528 .category = FIO_OPT_C_IO,
2529 .group = FIO_OPT_G_VERIFY,
2532 .name = "verify_state_save",
2533 .lname = "Save verify state",
2534 .off1 = td_var_offset(verify_state_save),
2535 .type = FIO_OPT_BOOL,
2537 .help = "Save verify state on termination",
2539 .category = FIO_OPT_C_IO,
2540 .group = FIO_OPT_G_VERIFY,
2542 #ifdef FIO_HAVE_TRIM
2544 .name = "trim_percentage",
2545 .lname = "Trim percentage",
2546 .type = FIO_OPT_INT,
2547 .off1 = td_var_offset(trim_percentage),
2550 .help = "Number of verify blocks to discard/trim",
2555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_TRIM,
2559 .name = "trim_verify_zero",
2560 .lname = "Verify trim zero",
2561 .type = FIO_OPT_BOOL,
2562 .help = "Verify that trim/discarded blocks are returned as zeroes",
2563 .off1 = td_var_offset(trim_zero),
2564 .parent = "trim_percentage",
2567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_TRIM,
2571 .name = "trim_backlog",
2572 .lname = "Trim backlog",
2573 .type = FIO_OPT_STR_VAL,
2574 .off1 = td_var_offset(trim_backlog),
2575 .help = "Trim after this number of blocks are written",
2576 .parent = "trim_percentage",
2579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_TRIM,
2583 .name = "trim_backlog_batch",
2584 .lname = "Trim backlog batch",
2585 .type = FIO_OPT_INT,
2586 .off1 = td_var_offset(trim_batch),
2587 .help = "Trim this number of IO blocks",
2588 .parent = "trim_percentage",
2591 .category = FIO_OPT_C_IO,
2592 .group = FIO_OPT_G_TRIM,
2596 .name = "write_iolog",
2597 .lname = "Write I/O log",
2598 .type = FIO_OPT_STR_STORE,
2599 .off1 = td_var_offset(write_iolog_file),
2600 .help = "Store IO pattern to file",
2601 .category = FIO_OPT_C_IO,
2602 .group = FIO_OPT_G_IOLOG,
2605 .name = "read_iolog",
2606 .lname = "Read I/O log",
2607 .type = FIO_OPT_STR_STORE,
2608 .off1 = td_var_offset(read_iolog_file),
2609 .help = "Playback IO pattern from file",
2610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_IOLOG,
2614 .name = "replay_no_stall",
2615 .lname = "Don't stall on replay",
2616 .type = FIO_OPT_BOOL,
2617 .off1 = td_var_offset(no_stall),
2619 .parent = "read_iolog",
2621 .help = "Playback IO pattern file as fast as possible without stalls",
2622 .category = FIO_OPT_C_IO,
2623 .group = FIO_OPT_G_IOLOG,
2626 .name = "replay_redirect",
2627 .lname = "Redirect device for replay",
2628 .type = FIO_OPT_STR_STORE,
2629 .off1 = td_var_offset(replay_redirect),
2630 .parent = "read_iolog",
2632 .help = "Replay all I/O onto this device, regardless of trace device",
2633 .category = FIO_OPT_C_IO,
2634 .group = FIO_OPT_G_IOLOG,
2637 .name = "exec_prerun",
2638 .lname = "Pre-execute runnable",
2639 .type = FIO_OPT_STR_STORE,
2640 .off1 = td_var_offset(exec_prerun),
2641 .help = "Execute this file prior to running job",
2642 .category = FIO_OPT_C_GENERAL,
2643 .group = FIO_OPT_G_INVALID,
2646 .name = "exec_postrun",
2647 .lname = "Post-execute runnable",
2648 .type = FIO_OPT_STR_STORE,
2649 .off1 = td_var_offset(exec_postrun),
2650 .help = "Execute this file after running job",
2651 .category = FIO_OPT_C_GENERAL,
2652 .group = FIO_OPT_G_INVALID,
2654 #ifdef FIO_HAVE_IOSCHED_SWITCH
2656 .name = "ioscheduler",
2657 .lname = "I/O scheduler",
2658 .type = FIO_OPT_STR_STORE,
2659 .off1 = td_var_offset(ioscheduler),
2660 .help = "Use this IO scheduler on the backing device",
2661 .category = FIO_OPT_C_FILE,
2662 .group = FIO_OPT_G_INVALID,
2667 .lname = "Zone size",
2668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_size),
2670 .help = "Amount of data to read per zone",
2672 .interval = 1024 * 1024,
2673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_ZONE,
2677 .name = "zonerange",
2678 .lname = "Zone range",
2679 .type = FIO_OPT_STR_VAL,
2680 .off1 = td_var_offset(zone_range),
2681 .help = "Give size of an IO zone",
2683 .interval = 1024 * 1024,
2684 .category = FIO_OPT_C_IO,
2685 .group = FIO_OPT_G_ZONE,
2689 .lname = "Zone skip",
2690 .type = FIO_OPT_STR_VAL,
2691 .off1 = td_var_offset(zone_skip),
2692 .help = "Space between IO zones",
2694 .interval = 1024 * 1024,
2695 .category = FIO_OPT_C_IO,
2696 .group = FIO_OPT_G_ZONE,
2700 .lname = "Lock memory",
2701 .type = FIO_OPT_STR_VAL,
2702 .off1 = td_var_offset(lockmem),
2703 .help = "Lock down this amount of memory (per worker)",
2705 .interval = 1024 * 1024,
2706 .category = FIO_OPT_C_GENERAL,
2707 .group = FIO_OPT_G_INVALID,
2710 .name = "rwmixread",
2711 .lname = "Read/write mix read",
2712 .type = FIO_OPT_INT,
2713 .cb = str_rwmix_read_cb,
2714 .off1 = td_var_offset(rwmix[DDIR_READ]),
2716 .help = "Percentage of mixed workload that is reads",
2719 .inverse = "rwmixwrite",
2720 .category = FIO_OPT_C_IO,
2721 .group = FIO_OPT_G_RWMIX,
2724 .name = "rwmixwrite",
2725 .lname = "Read/write mix write",
2726 .type = FIO_OPT_INT,
2727 .cb = str_rwmix_write_cb,
2728 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
2730 .help = "Percentage of mixed workload that is writes",
2733 .inverse = "rwmixread",
2734 .category = FIO_OPT_C_IO,
2735 .group = FIO_OPT_G_RWMIX,
2738 .name = "rwmixcycle",
2739 .lname = "Read/write mix cycle",
2740 .type = FIO_OPT_DEPRECATED,
2741 .category = FIO_OPT_C_IO,
2742 .group = FIO_OPT_G_RWMIX,
2747 .type = FIO_OPT_INT,
2748 .off1 = td_var_offset(nice),
2749 .help = "Set job CPU nice value",
2754 .category = FIO_OPT_C_GENERAL,
2755 .group = FIO_OPT_G_CRED,
2757 #ifdef FIO_HAVE_IOPRIO
2760 .lname = "I/O nice priority",
2761 .type = FIO_OPT_INT,
2762 .off1 = td_var_offset(ioprio),
2763 .help = "Set job IO priority value",
2767 .category = FIO_OPT_C_GENERAL,
2768 .group = FIO_OPT_G_CRED,
2771 .name = "prioclass",
2772 .lname = "I/O nice priority class",
2773 .type = FIO_OPT_INT,
2774 .off1 = td_var_offset(ioprio_class),
2775 .help = "Set job IO priority class",
2779 .category = FIO_OPT_C_GENERAL,
2780 .group = FIO_OPT_G_CRED,
2784 .name = "thinktime",
2785 .lname = "Thinktime",
2786 .type = FIO_OPT_INT,
2787 .off1 = td_var_offset(thinktime),
2788 .help = "Idle time between IO buffers (usec)",
2791 .category = FIO_OPT_C_IO,
2792 .group = FIO_OPT_G_THINKTIME,
2795 .name = "thinktime_spin",
2796 .lname = "Thinktime spin",
2797 .type = FIO_OPT_INT,
2798 .off1 = td_var_offset(thinktime_spin),
2799 .help = "Start think time by spinning this amount (usec)",
2802 .parent = "thinktime",
2804 .category = FIO_OPT_C_IO,
2805 .group = FIO_OPT_G_THINKTIME,
2808 .name = "thinktime_blocks",
2809 .lname = "Thinktime blocks",
2810 .type = FIO_OPT_INT,
2811 .off1 = td_var_offset(thinktime_blocks),
2812 .help = "IO buffer period between 'thinktime'",
2814 .parent = "thinktime",
2816 .category = FIO_OPT_C_IO,
2817 .group = FIO_OPT_G_THINKTIME,
2821 .lname = "I/O rate",
2822 .type = FIO_OPT_INT,
2823 .off1 = td_var_offset(rate[DDIR_READ]),
2824 .off2 = td_var_offset(rate[DDIR_WRITE]),
2825 .off3 = td_var_offset(rate[DDIR_TRIM]),
2826 .help = "Set bandwidth rate",
2827 .category = FIO_OPT_C_IO,
2828 .group = FIO_OPT_G_RATE,
2832 .lname = "I/O min rate",
2833 .type = FIO_OPT_INT,
2834 .off1 = td_var_offset(ratemin[DDIR_READ]),
2835 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2836 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
2837 .help = "Job must meet this rate or it will be shutdown",
2840 .category = FIO_OPT_C_IO,
2841 .group = FIO_OPT_G_RATE,
2844 .name = "rate_iops",
2845 .lname = "I/O rate IOPS",
2846 .type = FIO_OPT_INT,
2847 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2848 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2849 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
2850 .help = "Limit IO used to this number of IO operations/sec",
2852 .category = FIO_OPT_C_IO,
2853 .group = FIO_OPT_G_RATE,
2856 .name = "rate_iops_min",
2857 .lname = "I/O min rate IOPS",
2858 .type = FIO_OPT_INT,
2859 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2860 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2861 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
2862 .help = "Job must meet this rate or it will be shut down",
2863 .parent = "rate_iops",
2865 .category = FIO_OPT_C_IO,
2866 .group = FIO_OPT_G_RATE,
2869 .name = "ratecycle",
2870 .lname = "I/O rate cycle",
2871 .type = FIO_OPT_INT,
2872 .off1 = td_var_offset(ratecycle),
2873 .help = "Window average for rate limits (msec)",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_RATE,
2881 .name = "max_latency",
2882 .type = FIO_OPT_INT,
2883 .off1 = td_var_offset(max_latency),
2884 .help = "Maximum tolerated IO latency (usec)",
2886 .category = FIO_OPT_C_IO,
2887 .group = FIO_OPT_G_LATPROF,
2890 .name = "latency_target",
2891 .lname = "Latency Target (usec)",
2892 .type = FIO_OPT_STR_VAL_TIME,
2893 .off1 = td_var_offset(latency_target),
2894 .help = "Ramp to max queue depth supporting this latency",
2896 .category = FIO_OPT_C_IO,
2897 .group = FIO_OPT_G_LATPROF,
2900 .name = "latency_window",
2901 .lname = "Latency Window (usec)",
2902 .type = FIO_OPT_STR_VAL_TIME,
2903 .off1 = td_var_offset(latency_window),
2904 .help = "Time to sustain latency_target",
2906 .category = FIO_OPT_C_IO,
2907 .group = FIO_OPT_G_LATPROF,
2910 .name = "latency_percentile",
2911 .lname = "Latency Percentile",
2912 .type = FIO_OPT_FLOAT_LIST,
2913 .off1 = td_var_offset(latency_percentile),
2914 .help = "Percentile of IOs must be below latency_target",
2919 .category = FIO_OPT_C_IO,
2920 .group = FIO_OPT_G_LATPROF,
2923 .name = "invalidate",
2924 .lname = "Cache invalidate",
2925 .type = FIO_OPT_BOOL,
2926 .off1 = td_var_offset(invalidate_cache),
2927 .help = "Invalidate buffer/page cache prior to running job",
2929 .category = FIO_OPT_C_IO,
2930 .group = FIO_OPT_G_IO_TYPE,
2934 .lname = "Synchronous I/O",
2935 .type = FIO_OPT_BOOL,
2936 .off1 = td_var_offset(sync_io),
2937 .help = "Use O_SYNC for buffered writes",
2939 .parent = "buffered",
2941 .category = FIO_OPT_C_IO,
2942 .group = FIO_OPT_G_IO_TYPE,
2945 .name = "create_serialize",
2946 .lname = "Create serialize",
2947 .type = FIO_OPT_BOOL,
2948 .off1 = td_var_offset(create_serialize),
2949 .help = "Serialize creating of job files",
2951 .category = FIO_OPT_C_FILE,
2952 .group = FIO_OPT_G_INVALID,
2955 .name = "create_fsync",
2956 .lname = "Create fsync",
2957 .type = FIO_OPT_BOOL,
2958 .off1 = td_var_offset(create_fsync),
2959 .help = "fsync file after creation",
2961 .category = FIO_OPT_C_FILE,
2962 .group = FIO_OPT_G_INVALID,
2965 .name = "create_on_open",
2966 .lname = "Create on open",
2967 .type = FIO_OPT_BOOL,
2968 .off1 = td_var_offset(create_on_open),
2969 .help = "Create files when they are opened for IO",
2971 .category = FIO_OPT_C_FILE,
2972 .group = FIO_OPT_G_INVALID,
2975 .name = "create_only",
2976 .type = FIO_OPT_BOOL,
2977 .off1 = td_var_offset(create_only),
2978 .help = "Only perform file creation phase",
2979 .category = FIO_OPT_C_FILE,
2984 .lname = "Pre-read files",
2985 .type = FIO_OPT_BOOL,
2986 .off1 = td_var_offset(pre_read),
2987 .help = "Pre-read files before starting official testing",
2989 .category = FIO_OPT_C_FILE,
2990 .group = FIO_OPT_G_INVALID,
2992 #ifdef FIO_HAVE_CPU_AFFINITY
2995 .lname = "CPU mask",
2996 .type = FIO_OPT_INT,
2997 .cb = str_cpumask_cb,
2998 .off1 = td_var_offset(cpumask),
2999 .help = "CPU affinity mask",
3000 .category = FIO_OPT_C_GENERAL,
3001 .group = FIO_OPT_G_CRED,
3004 .name = "cpus_allowed",
3005 .lname = "CPUs allowed",
3006 .type = FIO_OPT_STR,
3007 .cb = str_cpus_allowed_cb,
3008 .off1 = td_var_offset(cpumask),
3009 .help = "Set CPUs allowed",
3010 .category = FIO_OPT_C_GENERAL,
3011 .group = FIO_OPT_G_CRED,
3014 .name = "cpus_allowed_policy",
3015 .lname = "CPUs allowed distribution policy",
3016 .type = FIO_OPT_STR,
3017 .off1 = td_var_offset(cpus_allowed_policy),
3018 .help = "Distribution policy for cpus_allowed",
3019 .parent = "cpus_allowed",
3023 .oval = FIO_CPUS_SHARED,
3024 .help = "Mask shared between threads",
3027 .oval = FIO_CPUS_SPLIT,
3028 .help = "Mask split between threads",
3031 .category = FIO_OPT_C_GENERAL,
3032 .group = FIO_OPT_G_CRED,
3035 #ifdef CONFIG_LIBNUMA
3037 .name = "numa_cpu_nodes",
3038 .type = FIO_OPT_STR,
3039 .cb = str_numa_cpunodes_cb,
3040 .off1 = td_var_offset(numa_cpunodes),
3041 .help = "NUMA CPU nodes bind",
3042 .category = FIO_OPT_C_GENERAL,
3043 .group = FIO_OPT_G_INVALID,
3046 .name = "numa_mem_policy",
3047 .type = FIO_OPT_STR,
3048 .cb = str_numa_mpol_cb,
3049 .off1 = td_var_offset(numa_memnodes),
3050 .help = "NUMA memory policy setup",
3051 .category = FIO_OPT_C_GENERAL,
3052 .group = FIO_OPT_G_INVALID,
3056 .name = "end_fsync",
3057 .lname = "End fsync",
3058 .type = FIO_OPT_BOOL,
3059 .off1 = td_var_offset(end_fsync),
3060 .help = "Include fsync at the end of job",
3062 .category = FIO_OPT_C_FILE,
3063 .group = FIO_OPT_G_INVALID,
3066 .name = "fsync_on_close",
3067 .lname = "Fsync on close",
3068 .type = FIO_OPT_BOOL,
3069 .off1 = td_var_offset(fsync_on_close),
3070 .help = "fsync files on close",
3072 .category = FIO_OPT_C_FILE,
3073 .group = FIO_OPT_G_INVALID,
3077 .lname = "Unlink file",
3078 .type = FIO_OPT_BOOL,
3079 .off1 = td_var_offset(unlink),
3080 .help = "Unlink created files after job has completed",
3082 .category = FIO_OPT_C_FILE,
3083 .group = FIO_OPT_G_INVALID,
3087 .lname = "Exit-all on terminate",
3088 .type = FIO_OPT_STR_SET,
3089 .cb = str_exitall_cb,
3090 .help = "Terminate all jobs when one exits",
3091 .category = FIO_OPT_C_GENERAL,
3092 .group = FIO_OPT_G_PROCESS,
3095 .name = "stonewall",
3096 .lname = "Wait for previous",
3097 .alias = "wait_for_previous",
3098 .type = FIO_OPT_STR_SET,
3099 .off1 = td_var_offset(stonewall),
3100 .help = "Insert a hard barrier between this job and previous",
3101 .category = FIO_OPT_C_GENERAL,
3102 .group = FIO_OPT_G_PROCESS,
3105 .name = "new_group",
3106 .lname = "New group",
3107 .type = FIO_OPT_STR_SET,
3108 .off1 = td_var_offset(new_group),
3109 .help = "Mark the start of a new group (for reporting)",
3110 .category = FIO_OPT_C_GENERAL,
3111 .group = FIO_OPT_G_PROCESS,
3116 .type = FIO_OPT_STR_SET,
3117 .off1 = td_var_offset(use_thread),
3118 .help = "Use threads instead of processes",
3119 #ifdef CONFIG_NO_SHM
3123 .category = FIO_OPT_C_GENERAL,
3124 .group = FIO_OPT_G_PROCESS,
3127 .name = "write_bw_log",
3128 .lname = "Write bandwidth log",
3129 .type = FIO_OPT_STR_STORE,
3130 .off1 = td_var_offset(bw_log_file),
3131 .help = "Write log of bandwidth during run",
3132 .category = FIO_OPT_C_LOG,
3133 .group = FIO_OPT_G_INVALID,
3136 .name = "write_lat_log",
3137 .lname = "Write latency log",
3138 .type = FIO_OPT_STR_STORE,
3139 .off1 = td_var_offset(lat_log_file),
3140 .help = "Write log of latency during run",
3141 .category = FIO_OPT_C_LOG,
3142 .group = FIO_OPT_G_INVALID,
3145 .name = "write_iops_log",
3146 .lname = "Write IOPS log",
3147 .type = FIO_OPT_STR_STORE,
3148 .off1 = td_var_offset(iops_log_file),
3149 .help = "Write log of IOPS during run",
3150 .category = FIO_OPT_C_LOG,
3151 .group = FIO_OPT_G_INVALID,
3154 .name = "log_avg_msec",
3155 .lname = "Log averaging (msec)",
3156 .type = FIO_OPT_INT,
3157 .off1 = td_var_offset(log_avg_msec),
3158 .help = "Average bw/iops/lat logs over this period of time",
3160 .category = FIO_OPT_C_LOG,
3161 .group = FIO_OPT_G_INVALID,
3164 .name = "log_offset",
3165 .lname = "Log offset of IO",
3166 .type = FIO_OPT_BOOL,
3167 .off1 = td_var_offset(log_offset),
3168 .help = "Include offset of IO for each log entry",
3170 .category = FIO_OPT_C_LOG,
3171 .group = FIO_OPT_G_INVALID,
3175 .name = "log_compression",
3176 .lname = "Log compression",
3177 .type = FIO_OPT_INT,
3178 .off1 = td_var_offset(log_gz),
3179 .help = "Log in compressed chunks of this size",
3180 .minval = 32 * 1024 * 1024ULL,
3181 .maxval = 512 * 1024 * 1024ULL,
3182 .category = FIO_OPT_C_LOG,
3183 .group = FIO_OPT_G_INVALID,
3186 .name = "log_store_compressed",
3187 .lname = "Log store compressed",
3188 .type = FIO_OPT_BOOL,
3189 .off1 = td_var_offset(log_gz_store),
3190 .help = "Store logs in a compressed format",
3191 .category = FIO_OPT_C_LOG,
3192 .group = FIO_OPT_G_INVALID,
3196 .name = "bwavgtime",
3197 .lname = "Bandwidth average time",
3198 .type = FIO_OPT_INT,
3199 .off1 = td_var_offset(bw_avg_time),
3200 .help = "Time window over which to calculate bandwidth"
3203 .parent = "write_bw_log",
3206 .category = FIO_OPT_C_LOG,
3207 .group = FIO_OPT_G_INVALID,
3210 .name = "iopsavgtime",
3211 .lname = "IOPS average time",
3212 .type = FIO_OPT_INT,
3213 .off1 = td_var_offset(iops_avg_time),
3214 .help = "Time window over which to calculate IOPS (msec)",
3216 .parent = "write_iops_log",
3219 .category = FIO_OPT_C_LOG,
3220 .group = FIO_OPT_G_INVALID,
3223 .name = "group_reporting",
3224 .lname = "Group reporting",
3225 .type = FIO_OPT_STR_SET,
3226 .off1 = td_var_offset(group_reporting),
3227 .help = "Do reporting on a per-group basis",
3228 .category = FIO_OPT_C_STAT,
3229 .group = FIO_OPT_G_INVALID,
3232 .name = "zero_buffers",
3233 .lname = "Zero I/O buffers",
3234 .type = FIO_OPT_STR_SET,
3235 .off1 = td_var_offset(zero_buffers),
3236 .help = "Init IO buffers to all zeroes",
3237 .category = FIO_OPT_C_IO,
3238 .group = FIO_OPT_G_IO_BUF,
3241 .name = "refill_buffers",
3242 .lname = "Refill I/O buffers",
3243 .type = FIO_OPT_STR_SET,
3244 .off1 = td_var_offset(refill_buffers),
3245 .help = "Refill IO buffers on every IO submit",
3246 .category = FIO_OPT_C_IO,
3247 .group = FIO_OPT_G_IO_BUF,
3250 .name = "scramble_buffers",
3251 .lname = "Scramble I/O buffers",
3252 .type = FIO_OPT_BOOL,
3253 .off1 = td_var_offset(scramble_buffers),
3254 .help = "Slightly scramble buffers on every IO submit",
3256 .category = FIO_OPT_C_IO,
3257 .group = FIO_OPT_G_IO_BUF,
3260 .name = "buffer_pattern",
3261 .lname = "Buffer pattern",
3262 .type = FIO_OPT_STR,
3263 .cb = str_buffer_pattern_cb,
3264 .off1 = td_var_offset(buffer_pattern),
3265 .help = "Fill pattern for IO buffers",
3266 .category = FIO_OPT_C_IO,
3267 .group = FIO_OPT_G_IO_BUF,
3270 .name = "buffer_compress_percentage",
3271 .lname = "Buffer compression percentage",
3272 .type = FIO_OPT_INT,
3273 .cb = str_buffer_compress_cb,
3274 .off1 = td_var_offset(compress_percentage),
3277 .help = "How compressible the buffer is (approximately)",
3279 .category = FIO_OPT_C_IO,
3280 .group = FIO_OPT_G_IO_BUF,
3283 .name = "buffer_compress_chunk",
3284 .lname = "Buffer compression chunk size",
3285 .type = FIO_OPT_INT,
3286 .off1 = td_var_offset(compress_chunk),
3287 .parent = "buffer_compress_percentage",
3289 .help = "Size of compressible region in buffer",
3291 .category = FIO_OPT_C_IO,
3292 .group = FIO_OPT_G_IO_BUF,
3295 .name = "dedupe_percentage",
3296 .lname = "Dedupe percentage",
3297 .type = FIO_OPT_INT,
3298 .cb = str_dedupe_cb,
3299 .off1 = td_var_offset(dedupe_percentage),
3302 .help = "Percentage of buffers that are dedupable",
3304 .category = FIO_OPT_C_IO,
3305 .group = FIO_OPT_G_IO_BUF,
3308 .name = "clat_percentiles",
3309 .lname = "Completion latency percentiles",
3310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(clat_percentiles),
3312 .help = "Enable the reporting of completion latency percentiles",
3314 .category = FIO_OPT_C_STAT,
3315 .group = FIO_OPT_G_INVALID,
3318 .name = "percentile_list",
3319 .lname = "Completion latency percentile list",
3320 .type = FIO_OPT_FLOAT_LIST,
3321 .off1 = td_var_offset(percentile_list),
3322 .off2 = td_var_offset(percentile_precision),
3323 .help = "Specify a custom list of percentiles to report",
3324 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
3325 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3328 .category = FIO_OPT_C_STAT,
3329 .group = FIO_OPT_G_INVALID,
3332 #ifdef FIO_HAVE_DISK_UTIL
3334 .name = "disk_util",
3335 .lname = "Disk utilization",
3336 .type = FIO_OPT_BOOL,
3337 .off1 = td_var_offset(do_disk_util),
3338 .help = "Log disk utilization statistics",
3340 .category = FIO_OPT_C_STAT,
3341 .group = FIO_OPT_G_INVALID,
3345 .name = "gtod_reduce",
3346 .lname = "Reduce gettimeofday() calls",
3347 .type = FIO_OPT_BOOL,
3348 .help = "Greatly reduce number of gettimeofday() calls",
3349 .cb = str_gtod_reduce_cb,
3352 .category = FIO_OPT_C_STAT,
3353 .group = FIO_OPT_G_INVALID,
3356 .name = "disable_lat",
3357 .lname = "Disable all latency stats",
3358 .type = FIO_OPT_BOOL,
3359 .off1 = td_var_offset(disable_lat),
3360 .help = "Disable latency numbers",
3361 .parent = "gtod_reduce",
3364 .category = FIO_OPT_C_STAT,
3365 .group = FIO_OPT_G_INVALID,
3368 .name = "disable_clat",
3369 .lname = "Disable completion latency stats",
3370 .type = FIO_OPT_BOOL,
3371 .off1 = td_var_offset(disable_clat),
3372 .help = "Disable completion latency numbers",
3373 .parent = "gtod_reduce",
3376 .category = FIO_OPT_C_STAT,
3377 .group = FIO_OPT_G_INVALID,
3380 .name = "disable_slat",
3381 .lname = "Disable submission latency stats",
3382 .type = FIO_OPT_BOOL,
3383 .off1 = td_var_offset(disable_slat),
3384 .help = "Disable submission latency numbers",
3385 .parent = "gtod_reduce",
3388 .category = FIO_OPT_C_STAT,
3389 .group = FIO_OPT_G_INVALID,
3392 .name = "disable_bw_measurement",
3393 .lname = "Disable bandwidth stats",
3394 .type = FIO_OPT_BOOL,
3395 .off1 = td_var_offset(disable_bw),
3396 .help = "Disable bandwidth logging",
3397 .parent = "gtod_reduce",
3400 .category = FIO_OPT_C_STAT,
3401 .group = FIO_OPT_G_INVALID,
3405 .lname = "Dedicated gettimeofday() CPU",
3406 .type = FIO_OPT_INT,
3407 .off1 = td_var_offset(gtod_cpu),
3408 .help = "Set up dedicated gettimeofday() thread on this CPU",
3409 .verify = gtod_cpu_verify,
3410 .category = FIO_OPT_C_GENERAL,
3411 .group = FIO_OPT_G_CLOCK,
3414 .name = "unified_rw_reporting",
3415 .type = FIO_OPT_BOOL,
3416 .off1 = td_var_offset(unified_rw_rep),
3417 .help = "Unify reporting across data direction",
3419 .category = FIO_OPT_C_GENERAL,
3420 .group = FIO_OPT_G_INVALID,
3423 .name = "continue_on_error",
3424 .lname = "Continue on error",
3425 .type = FIO_OPT_STR,
3426 .off1 = td_var_offset(continue_on_error),
3427 .help = "Continue on non-fatal errors during IO",
3429 .category = FIO_OPT_C_GENERAL,
3430 .group = FIO_OPT_G_ERR,
3433 .oval = ERROR_TYPE_NONE,
3434 .help = "Exit when an error is encountered",
3437 .oval = ERROR_TYPE_READ,
3438 .help = "Continue on read errors only",
3441 .oval = ERROR_TYPE_WRITE,
3442 .help = "Continue on write errors only",
3445 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3446 .help = "Continue on any IO errors",
3449 .oval = ERROR_TYPE_VERIFY,
3450 .help = "Continue on verify errors only",
3453 .oval = ERROR_TYPE_ANY,
3454 .help = "Continue on all io and verify errors",
3457 .oval = ERROR_TYPE_NONE,
3458 .help = "Alias for 'none'",
3461 .oval = ERROR_TYPE_ANY,
3462 .help = "Alias for 'all'",
3467 .name = "ignore_error",
3468 .type = FIO_OPT_STR,
3469 .cb = str_ignore_error_cb,
3470 .off1 = td_var_offset(ignore_error_nr),
3471 .help = "Set a specific list of errors to ignore",
3473 .category = FIO_OPT_C_GENERAL,
3474 .group = FIO_OPT_G_ERR,
3477 .name = "error_dump",
3478 .type = FIO_OPT_BOOL,
3479 .off1 = td_var_offset(error_dump),
3481 .help = "Dump info on each error",
3482 .category = FIO_OPT_C_GENERAL,
3483 .group = FIO_OPT_G_ERR,
3488 .type = FIO_OPT_STR_STORE,
3489 .off1 = td_var_offset(profile),
3490 .help = "Select a specific builtin performance test",
3491 .category = FIO_OPT_C_PROFILE,
3492 .group = FIO_OPT_G_INVALID,
3497 .type = FIO_OPT_STR_STORE,
3498 .off1 = td_var_offset(cgroup),
3499 .help = "Add job to cgroup of this name",
3500 .category = FIO_OPT_C_GENERAL,
3501 .group = FIO_OPT_G_CGROUP,
3504 .name = "cgroup_nodelete",
3505 .lname = "Cgroup no-delete",
3506 .type = FIO_OPT_BOOL,
3507 .off1 = td_var_offset(cgroup_nodelete),
3508 .help = "Do not delete cgroups after job completion",
3511 .category = FIO_OPT_C_GENERAL,
3512 .group = FIO_OPT_G_CGROUP,
3515 .name = "cgroup_weight",
3516 .lname = "Cgroup weight",
3517 .type = FIO_OPT_INT,
3518 .off1 = td_var_offset(cgroup_weight),
3519 .help = "Use given weight for cgroup",
3523 .category = FIO_OPT_C_GENERAL,
3524 .group = FIO_OPT_G_CGROUP,
3529 .type = FIO_OPT_INT,
3530 .off1 = td_var_offset(uid),
3531 .help = "Run job with this user ID",
3532 .category = FIO_OPT_C_GENERAL,
3533 .group = FIO_OPT_G_CRED,
3537 .lname = "Group ID",
3538 .type = FIO_OPT_INT,
3539 .off1 = td_var_offset(gid),
3540 .help = "Run job with this group ID",
3541 .category = FIO_OPT_C_GENERAL,
3542 .group = FIO_OPT_G_CRED,
3547 .type = FIO_OPT_INT,
3548 .off1 = td_var_offset(kb_base),
3554 .help = "Use 1024 as the K base",
3558 .help = "Use 1000 as the K base",
3561 .help = "How many bytes per KB for reporting (1000 or 1024)",
3562 .category = FIO_OPT_C_GENERAL,
3563 .group = FIO_OPT_G_INVALID,
3566 .name = "unit_base",
3567 .lname = "Base unit for reporting (Bits or Bytes)",
3568 .type = FIO_OPT_INT,
3569 .off1 = td_var_offset(unit_base),
3574 .help = "Auto-detect",
3578 .help = "Normal (byte based)",
3582 .help = "Bit based",
3585 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3586 .category = FIO_OPT_C_GENERAL,
3587 .group = FIO_OPT_G_INVALID,
3590 .name = "hugepage-size",
3591 .lname = "Hugepage size",
3592 .type = FIO_OPT_INT,
3593 .off1 = td_var_offset(hugepage_size),
3594 .help = "When using hugepages, specify size of each page",
3595 .def = __fio_stringify(FIO_HUGE_PAGE),
3596 .interval = 1024 * 1024,
3597 .category = FIO_OPT_C_GENERAL,
3598 .group = FIO_OPT_G_INVALID,
3602 .lname = "I/O flow ID",
3603 .type = FIO_OPT_INT,
3604 .off1 = td_var_offset(flow_id),
3605 .help = "The flow index ID to use",
3607 .category = FIO_OPT_C_IO,
3608 .group = FIO_OPT_G_IO_FLOW,
3612 .lname = "I/O flow weight",
3613 .type = FIO_OPT_INT,
3614 .off1 = td_var_offset(flow),
3615 .help = "Weight for flow control of this job",
3616 .parent = "flow_id",
3619 .category = FIO_OPT_C_IO,
3620 .group = FIO_OPT_G_IO_FLOW,
3623 .name = "flow_watermark",
3624 .lname = "I/O flow watermark",
3625 .type = FIO_OPT_INT,
3626 .off1 = td_var_offset(flow_watermark),
3627 .help = "High watermark for flow control. This option"
3628 " should be set to the same value for all threads"
3629 " with non-zero flow.",
3630 .parent = "flow_id",
3633 .category = FIO_OPT_C_IO,
3634 .group = FIO_OPT_G_IO_FLOW,
3637 .name = "flow_sleep",
3638 .lname = "I/O flow sleep",
3639 .type = FIO_OPT_INT,
3640 .off1 = td_var_offset(flow_sleep),
3641 .help = "How many microseconds to sleep after being held"
3642 " back by the flow control mechanism",
3643 .parent = "flow_id",
3646 .category = FIO_OPT_C_IO,
3647 .group = FIO_OPT_G_IO_FLOW,
3654 static void add_to_lopt(struct option *lopt, struct fio_option *o,
3655 const char *name, int val)
3657 lopt->name = (char *) name;
3659 if (o->type == FIO_OPT_STR_SET)
3660 lopt->has_arg = optional_argument;
3662 lopt->has_arg = required_argument;
3665 static void options_to_lopts(struct fio_option *opts,
3666 struct option *long_options,
3667 int i, int option_type)
3669 struct fio_option *o = &opts[0];
3671 add_to_lopt(&long_options[i], o, o->name, option_type);
3674 add_to_lopt(&long_options[i], o, o->alias, option_type);
3679 assert(i < FIO_NR_OPTIONS);
3683 void fio_options_set_ioengine_opts(struct option *long_options,
3684 struct thread_data *td)
3689 while (long_options[i].name) {
3690 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3691 memset(&long_options[i], 0, sizeof(*long_options));
3698 * Just clear out the prior ioengine options.
3703 options_to_lopts(td->io_ops->options, long_options, i,
3704 FIO_GETOPT_IOENGINE);
3707 void fio_options_dup_and_init(struct option *long_options)
3711 options_init(fio_options);
3714 while (long_options[i].name)
3717 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
3720 struct fio_keyword {
3726 static struct fio_keyword fio_keywords[] = {
3728 .word = "$pagesize",
3729 .desc = "Page size in the system",
3732 .word = "$mb_memory",
3733 .desc = "Megabytes of memory online",
3737 .desc = "Number of CPUs online in the system",
3744 void fio_keywords_init(void)
3746 unsigned long long mb_memory;
3750 sprintf(buf, "%lu", (unsigned long) page_size);
3751 fio_keywords[0].replace = strdup(buf);
3753 mb_memory = os_phys_mem() / (1024 * 1024);
3754 sprintf(buf, "%llu", mb_memory);
3755 fio_keywords[1].replace = strdup(buf);
3758 sprintf(buf, "%lu", l);
3759 fio_keywords[2].replace = strdup(buf);
3764 static char *bc_calc(char *str)
3766 char buf[128], *tmp;
3771 * No math, just return string
3773 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3774 !strchr(str, '/')) || strchr(str, '\''))
3778 * Split option from value, we only need to calculate the value
3780 tmp = strchr(str, '=');
3787 * Prevent buffer overflows; such a case isn't reasonable anyway
3789 if (strlen(str) >= 128 || strlen(tmp) > 100)
3792 sprintf(buf, "which %s > /dev/null", BC_APP);
3794 log_err("fio: bc is needed for performing math\n");
3798 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
3799 f = popen(buf, "r");
3803 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
3810 buf[(tmp - str) + ret - 1] = '\0';
3811 memcpy(buf, str, tmp - str);
3817 * Return a copy of the input string with substrings of the form ${VARNAME}
3818 * substituted with the value of the environment variable VARNAME. The
3819 * substitution always occurs, even if VARNAME is empty or the corresponding
3820 * environment variable undefined.
3822 static char *option_dup_subs(const char *opt)
3824 char out[OPT_LEN_MAX+1];
3825 char in[OPT_LEN_MAX+1];
3828 char *ch1, *ch2, *env;
3829 ssize_t nchr = OPT_LEN_MAX;
3832 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3833 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3837 in[OPT_LEN_MAX] = '\0';
3838 strncpy(in, opt, OPT_LEN_MAX);
3840 while (*inptr && nchr > 0) {
3841 if (inptr[0] == '$' && inptr[1] == '{') {
3842 ch2 = strchr(inptr, '}');
3843 if (ch2 && inptr+1 < ch2) {
3850 envlen = strlen(env);
3851 if (envlen <= nchr) {
3852 memcpy(outptr, env, envlen);
3862 *outptr++ = *inptr++;
3871 * Look for reserved variable names and replace them with real values
3873 static char *fio_keyword_replace(char *opt)
3879 for (i = 0; fio_keywords[i].word != NULL; i++) {
3880 struct fio_keyword *kw = &fio_keywords[i];
3882 while ((s = strstr(opt, kw->word)) != NULL) {
3883 char *new = malloc(strlen(opt) + 1);
3889 * Copy part of the string before the keyword and
3890 * sprintf() the replacement after it.
3892 memcpy(new, opt, olen);
3893 len = sprintf(new + olen, "%s", kw->replace);
3896 * If there's more in the original string, copy that
3899 opt += strlen(kw->word) + olen;
3901 memcpy(new + olen + len, opt, opt - o_org - 1);
3904 * replace opt and free the old opt
3914 * Check for potential math and invoke bc, if possible
3922 static char **dup_and_sub_options(char **opts, int num_opts)
3925 char **opts_copy = malloc(num_opts *