18 #include "crc/crc32c.h"
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
23 static char *get_opt_postfix(const char *str)
25 char *p = strstr(str, ":");
31 strip_blank_front(&p);
36 static int converthexchartoint(char a)
56 static int bs_cmp(const void *p1, const void *p2)
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
61 return bsp1->perc < bsp2->perc;
64 static int bssplit_ddir(struct thread_data *td, int ddir, char *str)
66 struct bssplit *bssplit;
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
72 td->o.bssplit_nr[ddir] = 4;
73 bssplit = malloc(4 * sizeof(struct bssplit));
78 while ((fname = strsep(&str, ":")) != NULL) {
85 * grow struct buffer, if needed
87 if (i == td->o.bssplit_nr[ddir]) {
88 td->o.bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, td->o.bssplit_nr[ddir]
90 * sizeof(struct bssplit));
93 perc_str = strstr(fname, "/");
97 perc = atoi(perc_str);
105 if (str_to_decimal(fname, &val, 1, td)) {
106 log_err("fio: bssplit conversion failed\n");
117 bssplit[i].perc = perc;
121 td->o.bssplit_nr[ddir] = i;
124 * Now check if the percentages add up, and how much is missing
126 perc = perc_missing = 0;
127 for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
128 struct bssplit *bsp = &bssplit[i];
130 if (bsp->perc == (unsigned char) -1)
137 log_err("fio: bssplit percentages add to more than 100%%\n");
142 * If values didn't have a percentage set, divide the remains between
146 for (i = 0; i < td->o.bssplit_nr[ddir]; i++) {
147 struct bssplit *bsp = &bssplit[i];
149 if (bsp->perc == (unsigned char) -1)
150 bsp->perc = (100 - perc) / perc_missing;
154 td->o.min_bs[ddir] = min_bs;
155 td->o.max_bs[ddir] = max_bs;
158 * now sort based on percentages, for ease of lookup
160 qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
161 td->o.bssplit[ddir] = bssplit;
166 static int str_bssplit_cb(void *data, const char *input)
168 struct thread_data *td = data;
169 char *str, *p, *odir;
172 p = str = strdup(input);
174 strip_blank_front(&str);
175 strip_blank_end(str);
177 odir = strchr(str, ',');
179 ret = bssplit_ddir(td, DDIR_WRITE, odir + 1);
182 ret = bssplit_ddir(td, DDIR_READ, str);
189 ret = bssplit_ddir(td, DDIR_READ, str);
191 ret = bssplit_ddir(td, DDIR_WRITE, op);
200 static int str_rw_cb(void *data, const char *str)
202 struct thread_data *td = data;
203 char *nr = get_opt_postfix(str);
205 td->o.ddir_seq_nr = 1;
207 td->o.ddir_seq_nr = atoi(nr);
214 static int str_mem_cb(void *data, const char *mem)
216 struct thread_data *td = data;
218 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
219 td->mmapfile = get_opt_postfix(mem);
220 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
221 log_err("fio: mmaphuge:/path/to/file\n");
229 static int str_verify_cb(void *data, const char *mem)
231 struct thread_data *td = data;
233 if (td->o.verify != VERIFY_CRC32C_INTEL)
236 if (!crc32c_intel_works()) {
237 log_info("fio: System does not support hw accelerated crc32c. Falling back to sw crc32c.\n");
238 td->o.verify = VERIFY_CRC32C;
244 static int fio_clock_source_cb(void *data, const char *str)
246 struct thread_data *td = data;
248 fio_clock_source = td->o.clocksource;
253 static int str_lockmem_cb(void fio_unused *data, unsigned long long *val)
259 static int str_rwmix_read_cb(void *data, unsigned long long *val)
261 struct thread_data *td = data;
263 td->o.rwmix[DDIR_READ] = *val;
264 td->o.rwmix[DDIR_WRITE] = 100 - *val;
268 static int str_rwmix_write_cb(void *data, unsigned long long *val)
270 struct thread_data *td = data;
272 td->o.rwmix[DDIR_WRITE] = *val;
273 td->o.rwmix[DDIR_READ] = 100 - *val;
277 #ifdef FIO_HAVE_IOPRIO
278 static int str_prioclass_cb(void *data, unsigned long long *val)
280 struct thread_data *td = data;
284 * mask off old class bits, str_prio_cb() may have set a default class
286 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
289 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
294 static int str_prio_cb(void *data, unsigned long long *val)
296 struct thread_data *td = data;
301 * If no class is set, assume BE
303 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
304 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
311 static int str_exitall_cb(void)
313 exitall_on_terminate = 1;
317 #ifdef FIO_HAVE_CPU_AFFINITY
318 static int str_cpumask_cb(void *data, unsigned long long *val)
320 struct thread_data *td = data;
325 ret = fio_cpuset_init(&td->o.cpumask);
327 log_err("fio: cpuset_init failed\n");
328 td_verror(td, ret, "fio_cpuset_init");
332 max_cpu = cpus_online();
334 for (i = 0; i < sizeof(int) * 8; i++) {
335 if ((1 << i) & *val) {
337 log_err("fio: CPU %d too large (max=%ld)\n", i,
341 dprint(FD_PARSE, "set cpu allowed %d\n", i);
342 fio_cpu_set(&td->o.cpumask, i);
346 td->o.cpumask_set = 1;
350 static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
357 ret = fio_cpuset_init(mask);
359 log_err("fio: cpuset_init failed\n");
360 td_verror(td, ret, "fio_cpuset_init");
364 p = str = strdup(input);
366 strip_blank_front(&str);
367 strip_blank_end(str);
369 max_cpu = cpus_online();
371 while ((cpu = strsep(&str, ",")) != NULL) {
380 while ((cpu2 = strsep(&str2, "-")) != NULL) {
390 while (icpu <= icpu2) {
391 if (icpu >= FIO_MAX_CPUS) {
392 log_err("fio: your OS only supports up to"
393 " %d CPUs\n", (int) FIO_MAX_CPUS);
397 if (icpu > max_cpu) {
398 log_err("fio: CPU %d too large (max=%ld)\n",
404 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
405 fio_cpu_set(mask, icpu);
414 td->o.cpumask_set = 1;
418 static int str_cpus_allowed_cb(void *data, const char *input)
420 struct thread_data *td = data;
423 ret = set_cpus_allowed(td, &td->o.cpumask, input);
425 td->o.cpumask_set = 1;
430 static int str_verify_cpus_allowed_cb(void *data, const char *input)
432 struct thread_data *td = data;
435 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
437 td->o.verify_cpumask_set = 1;
444 static int str_verify_trim_cb(void *data, unsigned long long *val)
446 struct thread_data *td = data;
448 td->o.trim_percentage = *val;
453 static int str_fst_cb(void *data, const char *str)
455 struct thread_data *td = data;
456 char *nr = get_opt_postfix(str);
458 td->file_service_nr = 1;
460 td->file_service_nr = atoi(nr);
467 #ifdef FIO_HAVE_SYNC_FILE_RANGE
468 static int str_sfr_cb(void *data, const char *str)
470 struct thread_data *td = data;
471 char *nr = get_opt_postfix(str);
473 td->sync_file_range_nr = 1;
475 td->sync_file_range_nr = atoi(nr);
483 static int check_dir(struct thread_data *td, char *fname)
486 char file[PATH_MAX], *dir;
489 if (td->o.directory) {
490 strcpy(file, td->o.directory);
495 sprintf(file + elen, "%s", fname);
501 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
502 * yet, so we can't do this check right here...
504 if (lstat(dir, &sb) < 0) {
507 log_err("fio: %s is not a directory\n", dir);
508 td_verror(td, ret, "lstat");
512 if (!S_ISDIR(sb.st_mode)) {
513 log_err("fio: %s is not a directory\n", dir);
523 * Return next file in the string. Files are separated with ':'. If the ':'
524 * is escaped with a '\', then that ':' is part of the filename and does not
525 * indicate a new file.
527 static char *get_next_file_name(char **ptr)
532 if (!str || !strlen(str))
538 * No colon, we are done
540 p = strchr(str, ':');
547 * We got a colon, but it's the first character. Skip and
555 if (*(p - 1) != '\\') {
561 memmove(p - 1, p, strlen(p) + 1);
568 static int str_filename_cb(void *data, const char *input)
570 struct thread_data *td = data;
571 char *fname, *str, *p;
573 p = str = strdup(input);
575 strip_blank_front(&str);
576 strip_blank_end(str);
578 if (!td->files_index)
581 while ((fname = get_next_file_name(&str)) != NULL) {
584 if (check_dir(td, fname)) {
596 static int str_directory_cb(void *data, const char fio_unused *str)
598 struct thread_data *td = data;
601 if (lstat(td->o.directory, &sb) < 0) {
604 log_err("fio: %s is not a directory\n", td->o.directory);
605 td_verror(td, ret, "lstat");
608 if (!S_ISDIR(sb.st_mode)) {
609 log_err("fio: %s is not a directory\n", td->o.directory);
616 static int str_opendir_cb(void *data, const char fio_unused *str)
618 struct thread_data *td = data;
620 if (!td->files_index)
623 return add_dir_files(td, td->o.opendir);
626 static int str_verify_offset_cb(void *data, unsigned long long *off)
628 struct thread_data *td = data;
630 if (*off && *off < sizeof(struct verify_header)) {
631 log_err("fio: verify_offset too small\n");
635 td->o.verify_offset = *off;
639 static int str_verify_pattern_cb(void *data, const char *input)
641 struct thread_data *td = data;
643 int i = 0, j = 0, len, k, base = 10;
646 loc1 = strstr(input, "0x");
647 loc2 = strstr(input, "0X");
650 off = strtol(input, NULL, base);
651 if (off != LONG_MAX || errno != ERANGE) {
653 td->o.verify_pattern[i] = off & 0xff;
662 j = loc1 - input + 2;
664 j = loc2 - input + 2;
667 if (len - j < MAX_PATTERN_SIZE * 2) {
669 off = converthexchartoint(input[k--]);
671 off += (converthexchartoint(input[k--])
673 td->o.verify_pattern[i++] = (char) off;
677 td->o.verify_pattern_bytes = i;
679 * VERIFY_META could already be set
681 if (td->o.verify == VERIFY_NONE)
682 td->o.verify = VERIFY_PATTERN;
686 static int str_lockfile_cb(void *data, const char *str)
688 struct thread_data *td = data;
689 char *nr = get_opt_postfix(str);
691 td->o.lockfile_batch = 1;
693 td->o.lockfile_batch = atoi(nr);
700 static int str_write_bw_log_cb(void *data, const char *str)
702 struct thread_data *td = data;
705 td->o.bw_log_file = strdup(str);
707 td->o.write_bw_log = 1;
711 static int str_write_lat_log_cb(void *data, const char *str)
713 struct thread_data *td = data;
716 td->o.lat_log_file = strdup(str);
718 td->o.write_lat_log = 1;
722 static int str_gtod_reduce_cb(void *data, int *il)
724 struct thread_data *td = data;
727 td->o.disable_lat = !!val;
728 td->o.disable_clat = !!val;
729 td->o.disable_slat = !!val;
730 td->o.disable_bw = !!val;
732 td->tv_cache_mask = 63;
737 static int str_gtod_cpu_cb(void *data, long long *il)
739 struct thread_data *td = data;
742 td->o.gtod_cpu = val;
743 td->o.gtod_offload = 1;
747 static int str_size_cb(void *data, unsigned long long *__val)
749 struct thread_data *td = data;
750 unsigned long long v = *__val;
752 if (parse_is_percent(v)) {
754 td->o.size_percent = -1ULL - v;
761 static int rw_verify(struct fio_option *o, void *data)
763 struct thread_data *td = data;
765 if (read_only && td_write(td)) {
766 log_err("fio: job <%s> has write bit set, but fio is in"
767 " read-only mode\n", td->o.name);
774 static int gtod_cpu_verify(struct fio_option *o, void *data)
776 #ifndef FIO_HAVE_CPU_AFFINITY
777 struct thread_data *td = data;
779 if (td->o.gtod_cpu) {
780 log_err("fio: platform must support CPU affinity for"
781 "gettimeofday() offloading\n");
789 static int kb_base_verify(struct fio_option *o, void *data)
791 struct thread_data *td = data;
793 if (td->o.kb_base != 1024 && td->o.kb_base != 1000) {
794 log_err("fio: kb_base set to nonsensical value: %u\n",
802 #define __stringify_1(x) #x
803 #define __stringify(x) __stringify_1(x)
806 * Map of job/command line options
808 static struct fio_option options[FIO_MAX_OPTS] = {
810 .name = "description",
811 .type = FIO_OPT_STR_STORE,
812 .off1 = td_var_offset(description),
813 .help = "Text job description",
817 .type = FIO_OPT_STR_STORE,
818 .off1 = td_var_offset(name),
819 .help = "Name of this job",
823 .type = FIO_OPT_STR_STORE,
824 .off1 = td_var_offset(directory),
825 .cb = str_directory_cb,
826 .help = "Directory to store files in",
830 .type = FIO_OPT_STR_STORE,
831 .off1 = td_var_offset(filename),
832 .cb = str_filename_cb,
833 .prio = -1, /* must come after "directory" */
834 .help = "File(s) to use for the workload",
839 .off1 = td_var_offset(kb_base),
840 .verify = kb_base_verify,
843 .help = "How many bytes per KB for reporting (1000 or 1024)",
848 .cb = str_lockfile_cb,
849 .off1 = td_var_offset(file_lock_mode),
850 .help = "Lock file when doing IO to it",
851 .parent = "filename",
855 .oval = FILE_LOCK_NONE,
856 .help = "No file locking",
858 { .ival = "exclusive",
859 .oval = FILE_LOCK_EXCLUSIVE,
860 .help = "Exclusive file lock",
864 .oval = FILE_LOCK_READWRITE,
865 .help = "Read vs write lock",
871 .type = FIO_OPT_STR_STORE,
872 .off1 = td_var_offset(opendir),
873 .cb = str_opendir_cb,
874 .help = "Recursively add files from this directory and down",
878 .alias = "readwrite",
881 .off1 = td_var_offset(td_ddir),
882 .help = "IO direction",
887 .oval = TD_DDIR_READ,
888 .help = "Sequential read",
891 .oval = TD_DDIR_WRITE,
892 .help = "Sequential write",
894 { .ival = "randread",
895 .oval = TD_DDIR_RANDREAD,
896 .help = "Random read",
898 { .ival = "randwrite",
899 .oval = TD_DDIR_RANDWRITE,
900 .help = "Random write",
904 .help = "Sequential read and write mix",
907 .oval = TD_DDIR_RANDRW,
908 .help = "Random read and write mix"
913 .name = "rw_sequencer",
915 .off1 = td_var_offset(rw_seq),
916 .help = "IO offset generator modifier",
919 { .ival = "sequential",
921 .help = "Generate sequential offsets",
923 { .ival = "identical",
924 .oval = RW_SEQ_IDENT,
925 .help = "Generate identical offsets",
932 .type = FIO_OPT_STR_STORE,
933 .off1 = td_var_offset(ioengine),
934 .help = "IO engine to use",
935 .def = FIO_PREFERRED_ENGINE,
938 .help = "Use read/write",
941 .help = "Use pread/pwrite",
944 .help = "Use readv/writev",
946 #ifdef FIO_HAVE_LIBAIO
948 .help = "Linux native asynchronous IO",
951 #ifdef FIO_HAVE_POSIXAIO
952 { .ival = "posixaio",
953 .help = "POSIX asynchronous IO",
956 #ifdef FIO_HAVE_SOLARISAIO
957 { .ival = "solarisaio",
958 .help = "Solaris native asynchronous IO",
961 #ifdef FIO_HAVE_WINDOWSAIO
962 { .ival = "windowsaio",
963 .help = "Windows native asynchronous IO"
967 .help = "Memory mapped IO"
969 #ifdef FIO_HAVE_SPLICE
971 .help = "splice/vmsplice based IO",
973 { .ival = "netsplice",
974 .help = "splice/vmsplice to/from the network",
979 .help = "SCSI generic v3 IO",
983 .help = "Testing engine (no data transfer)",
986 .help = "Network IO",
988 #ifdef FIO_HAVE_SYSLET
989 { .ival = "syslet-rw",
990 .help = "syslet enabled async pread/pwrite IO",
994 .help = "CPU cycle burner engine",
996 #ifdef FIO_HAVE_GUASI
998 .help = "GUASI IO engine",
1001 #ifdef FIO_HAVE_BINJECT
1002 { .ival = "binject",
1003 .help = "binject direct inject block engine",
1006 #ifdef FIO_HAVE_RDMA
1008 .help = "RDMA IO engine",
1011 { .ival = "external",
1012 .help = "Load external engine (append name)",
1018 .type = FIO_OPT_INT,
1019 .off1 = td_var_offset(iodepth),
1020 .help = "Number of IO buffers to keep in flight",
1025 .name = "iodepth_batch",
1026 .alias = "iodepth_batch_submit",
1027 .type = FIO_OPT_INT,
1028 .off1 = td_var_offset(iodepth_batch),
1029 .help = "Number of IO buffers to submit in one go",
1030 .parent = "iodepth",
1035 .name = "iodepth_batch_complete",
1036 .type = FIO_OPT_INT,
1037 .off1 = td_var_offset(iodepth_batch_complete),
1038 .help = "Number of IO buffers to retrieve in one go",
1039 .parent = "iodepth",
1044 .name = "iodepth_low",
1045 .type = FIO_OPT_INT,
1046 .off1 = td_var_offset(iodepth_low),
1047 .help = "Low water mark for queuing depth",
1048 .parent = "iodepth",
1052 .type = FIO_OPT_STR_VAL,
1054 .help = "Total size of device or files",
1057 .name = "fill_device",
1059 .type = FIO_OPT_BOOL,
1060 .off1 = td_var_offset(fill_device),
1061 .help = "Write until an ENOSPC error occurs",
1066 .type = FIO_OPT_STR_VAL,
1067 .off1 = td_var_offset(file_size_low),
1068 .off2 = td_var_offset(file_size_high),
1070 .help = "Size of individual files",
1074 .alias = "fileoffset",
1075 .type = FIO_OPT_STR_VAL,
1076 .off1 = td_var_offset(start_offset),
1077 .help = "Start IO from this offset",
1082 .alias = "blocksize",
1083 .type = FIO_OPT_INT,
1084 .off1 = td_var_offset(bs[DDIR_READ]),
1085 .off2 = td_var_offset(bs[DDIR_WRITE]),
1087 .help = "Block size unit",
1093 .alias = "blockalign",
1094 .type = FIO_OPT_INT,
1095 .off1 = td_var_offset(ba[DDIR_READ]),
1096 .off2 = td_var_offset(ba[DDIR_WRITE]),
1098 .help = "IO block offset alignment",
1103 .alias = "blocksize_range",
1104 .type = FIO_OPT_RANGE,
1105 .off1 = td_var_offset(min_bs[DDIR_READ]),
1106 .off2 = td_var_offset(max_bs[DDIR_READ]),
1107 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1108 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
1110 .help = "Set block size range (in more detail than bs)",
1115 .type = FIO_OPT_STR,
1116 .cb = str_bssplit_cb,
1117 .help = "Set a specific mix of block sizes",
1121 .name = "bs_unaligned",
1122 .alias = "blocksize_unaligned",
1123 .type = FIO_OPT_STR_SET,
1124 .off1 = td_var_offset(bs_unaligned),
1125 .help = "Don't sector align IO buffer sizes",
1129 .name = "randrepeat",
1130 .type = FIO_OPT_BOOL,
1131 .off1 = td_var_offset(rand_repeatable),
1132 .help = "Use repeatable random IO pattern",
1137 .name = "use_os_rand",
1138 .type = FIO_OPT_BOOL,
1139 .off1 = td_var_offset(use_os_rand),
1140 .help = "Set to use OS random generator",
1145 .name = "norandommap",
1146 .type = FIO_OPT_STR_SET,
1147 .off1 = td_var_offset(norandommap),
1148 .help = "Accept potential duplicate random blocks",
1152 .name = "softrandommap",
1153 .type = FIO_OPT_BOOL,
1154 .off1 = td_var_offset(softrandommap),
1155 .help = "Set norandommap if randommap allocation fails",
1156 .parent = "norandommap",
1161 .alias = "nr_files",
1162 .type = FIO_OPT_INT,
1163 .off1 = td_var_offset(nr_files),
1164 .help = "Split job workload between this number of files",
1168 .name = "openfiles",
1169 .type = FIO_OPT_INT,
1170 .off1 = td_var_offset(open_files),
1171 .help = "Number of files to keep open at the same time",
1174 .name = "file_service_type",
1175 .type = FIO_OPT_STR,
1177 .off1 = td_var_offset(file_service_type),
1178 .help = "How to select which file to service next",
1179 .def = "roundrobin",
1182 .oval = FIO_FSERVICE_RANDOM,
1183 .help = "Choose a file at random",
1185 { .ival = "roundrobin",
1186 .oval = FIO_FSERVICE_RR,
1187 .help = "Round robin select files",
1189 { .ival = "sequential",
1190 .oval = FIO_FSERVICE_SEQ,
1191 .help = "Finish one file before moving to the next",
1194 .parent = "nrfiles",
1196 #ifdef FIO_HAVE_FALLOCATE
1198 .name = "fallocate",
1199 .type = FIO_OPT_STR,
1200 .off1 = td_var_offset(fallocate_mode),
1201 .help = "Whether pre-allocation is performed when laying out files",
1205 .oval = FIO_FALLOCATE_NONE,
1206 .help = "Do not pre-allocate space",
1209 .oval = FIO_FALLOCATE_POSIX,
1210 .help = "Use posix_fallocate()",
1212 #ifdef FIO_HAVE_LINUX_FALLOCATE
1214 .oval = FIO_FALLOCATE_KEEP_SIZE,
1215 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1218 /* Compatibility with former boolean values */
1220 .oval = FIO_FALLOCATE_NONE,
1221 .help = "Alias for 'none'",
1224 .oval = FIO_FALLOCATE_POSIX,
1225 .help = "Alias for 'posix'",
1229 #endif /* FIO_HAVE_FALLOCATE */
1231 .name = "fadvise_hint",
1232 .type = FIO_OPT_BOOL,
1233 .off1 = td_var_offset(fadvise_hint),
1234 .help = "Use fadvise() to advise the kernel on IO pattern",
1239 .type = FIO_OPT_INT,
1240 .off1 = td_var_offset(fsync_blocks),
1241 .help = "Issue fsync for writes every given number of blocks",
1245 .name = "fdatasync",
1246 .type = FIO_OPT_INT,
1247 .off1 = td_var_offset(fdatasync_blocks),
1248 .help = "Issue fdatasync for writes every given number of blocks",
1252 .name = "write_barrier",
1253 .type = FIO_OPT_INT,
1254 .off1 = td_var_offset(barrier_blocks),
1255 .help = "Make every Nth write a barrier write",
1258 #ifdef FIO_HAVE_SYNC_FILE_RANGE
1260 .name = "sync_file_range",
1262 { .ival = "wait_before",
1263 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1264 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
1268 .oval = SYNC_FILE_RANGE_WRITE,
1269 .help = "SYNC_FILE_RANGE_WRITE",
1273 .ival = "wait_after",
1274 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1275 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
1279 .type = FIO_OPT_STR_MULTI,
1281 .off1 = td_var_offset(sync_file_range),
1282 .help = "Use sync_file_range()",
1287 .type = FIO_OPT_BOOL,
1288 .off1 = td_var_offset(odirect),
1289 .help = "Use O_DIRECT IO (negates buffered)",
1294 .type = FIO_OPT_BOOL,
1295 .off1 = td_var_offset(odirect),
1297 .help = "Use buffered IO (negates direct)",
1301 .name = "overwrite",
1302 .type = FIO_OPT_BOOL,
1303 .off1 = td_var_offset(overwrite),
1304 .help = "When writing, set whether to overwrite current data",
1309 .type = FIO_OPT_INT,
1310 .off1 = td_var_offset(loops),
1311 .help = "Number of times to run the job",
1316 .type = FIO_OPT_INT,
1317 .off1 = td_var_offset(numjobs),
1318 .help = "Duplicate this job this many times",
1322 .name = "startdelay",
1323 .type = FIO_OPT_STR_VAL_TIME,
1324 .off1 = td_var_offset(start_delay),
1325 .help = "Only start job when this period has passed",
1331 .type = FIO_OPT_STR_VAL_TIME,
1332 .off1 = td_var_offset(timeout),
1333 .help = "Stop workload when this amount of time has passed",
1337 .name = "time_based",
1338 .type = FIO_OPT_STR_SET,
1339 .off1 = td_var_offset(time_based),
1340 .help = "Keep running until runtime/timeout is met",
1343 .name = "ramp_time",
1344 .type = FIO_OPT_STR_VAL_TIME,
1345 .off1 = td_var_offset(ramp_time),
1346 .help = "Ramp up time before measuring performance",
1349 .name = "clocksource",
1350 .type = FIO_OPT_STR,
1351 .cb = fio_clock_source_cb,
1352 .off1 = td_var_offset(clocksource),
1353 .help = "What type of timing source to use",
1355 { .ival = "gettimeofday",
1357 .help = "Use gettimeofday(2) for timing",
1359 { .ival = "clock_gettime",
1360 .oval = CS_CGETTIME,
1361 .help = "Use clock_gettime(2) for timing",
1363 #ifdef ARCH_HAVE_CPU_CLOCK
1365 .oval = CS_CPUCLOCK,
1366 .help = "Use CPU private clock",
1374 .type = FIO_OPT_STR,
1376 .off1 = td_var_offset(mem_type),
1377 .help = "Backing type for IO buffers",
1382 .help = "Use malloc(3) for IO buffers",
1386 .help = "Use shared memory segments for IO buffers",
1388 #ifdef FIO_HAVE_HUGETLB
1389 { .ival = "shmhuge",
1390 .oval = MEM_SHMHUGE,
1391 .help = "Like shm, but use huge pages",
1396 .help = "Use mmap(2) (file or anon) for IO buffers",
1398 #ifdef FIO_HAVE_HUGETLB
1399 { .ival = "mmaphuge",
1400 .oval = MEM_MMAPHUGE,
1401 .help = "Like mmap, but use huge pages",
1407 .name = "iomem_align",
1408 .alias = "mem_align",
1409 .type = FIO_OPT_INT,
1410 .off1 = td_var_offset(mem_align),
1412 .help = "IO memory buffer offset alignment",
1418 .type = FIO_OPT_STR,
1419 .off1 = td_var_offset(verify),
1420 .help = "Verify data written",
1421 .cb = str_verify_cb,
1425 .oval = VERIFY_NONE,
1426 .help = "Don't do IO verification",
1430 .help = "Use md5 checksums for verification",
1433 .oval = VERIFY_CRC64,
1434 .help = "Use crc64 checksums for verification",
1437 .oval = VERIFY_CRC32,
1438 .help = "Use crc32 checksums for verification",
1440 { .ival = "crc32c-intel",
1441 .oval = VERIFY_CRC32C_INTEL,
1442 .help = "Use hw crc32c checksums for verification",
1445 .oval = VERIFY_CRC32C,
1446 .help = "Use crc32c checksums for verification",
1449 .oval = VERIFY_CRC16,
1450 .help = "Use crc16 checksums for verification",
1453 .oval = VERIFY_CRC7,
1454 .help = "Use crc7 checksums for verification",
1457 .oval = VERIFY_SHA1,
1458 .help = "Use sha1 checksums for verification",
1461 .oval = VERIFY_SHA256,
1462 .help = "Use sha256 checksums for verification",
1465 .oval = VERIFY_SHA512,
1466 .help = "Use sha512 checksums for verification",
1469 .oval = VERIFY_META,
1470 .help = "Use io information",
1474 .oval = VERIFY_NULL,
1475 .help = "Pretend to verify",
1480 .name = "do_verify",
1481 .type = FIO_OPT_BOOL,
1482 .off1 = td_var_offset(do_verify),
1483 .help = "Run verification stage after write",
1488 .name = "verifysort",
1489 .type = FIO_OPT_BOOL,
1490 .off1 = td_var_offset(verifysort),
1491 .help = "Sort written verify blocks for read back",
1496 .name = "verify_interval",
1497 .type = FIO_OPT_INT,
1498 .off1 = td_var_offset(verify_interval),
1499 .minval = 2 * sizeof(struct verify_header),
1500 .help = "Store verify buffer header every N bytes",
1504 .name = "verify_offset",
1505 .type = FIO_OPT_INT,
1506 .help = "Offset verify header location by N bytes",
1508 .cb = str_verify_offset_cb,
1512 .name = "verify_pattern",
1513 .type = FIO_OPT_STR,
1514 .cb = str_verify_pattern_cb,
1515 .help = "Fill pattern for IO buffers",
1519 .name = "verify_fatal",
1520 .type = FIO_OPT_BOOL,
1521 .off1 = td_var_offset(verify_fatal),
1523 .help = "Exit on a single verify failure, don't continue",
1527 .name = "verify_dump",
1528 .type = FIO_OPT_BOOL,
1529 .off1 = td_var_offset(verify_dump),
1531 .help = "Dump contents of good and bad blocks on failure",
1535 .name = "verify_async",
1536 .type = FIO_OPT_INT,
1537 .off1 = td_var_offset(verify_async),
1539 .help = "Number of async verifier threads to use",
1543 .name = "verify_backlog",
1544 .type = FIO_OPT_STR_VAL,
1545 .off1 = td_var_offset(verify_backlog),
1546 .help = "Verify after this number of blocks are written",
1550 .name = "verify_backlog_batch",
1551 .type = FIO_OPT_INT,
1552 .off1 = td_var_offset(verify_batch),
1553 .help = "Verify this number of IO blocks",
1556 #ifdef FIO_HAVE_CPU_AFFINITY
1558 .name = "verify_async_cpus",
1559 .type = FIO_OPT_STR,
1560 .cb = str_verify_cpus_allowed_cb,
1561 .help = "Set CPUs allowed for async verify threads",
1562 .parent = "verify_async",
1565 #ifdef FIO_HAVE_TRIM
1567 .name = "trim_percentage",
1568 .type = FIO_OPT_INT,
1569 .cb = str_verify_trim_cb,
1571 .help = "Number of verify blocks to discard/trim",
1576 .name = "trim_verify_zero",
1577 .type = FIO_OPT_INT,
1578 .help = "Verify that trim/discarded blocks are returned as zeroes",
1579 .off1 = td_var_offset(trim_zero),
1580 .parent = "trim_percentage",
1584 .name = "trim_backlog",
1585 .type = FIO_OPT_STR_VAL,
1586 .off1 = td_var_offset(trim_backlog),
1587 .help = "Trim after this number of blocks are written",
1588 .parent = "trim_percentage",
1591 .name = "trim_backlog_batch",
1592 .type = FIO_OPT_INT,
1593 .off1 = td_var_offset(trim_batch),
1594 .help = "Trim this number of IO blocks",
1595 .parent = "trim_percentage",
1599 .name = "write_iolog",
1600 .type = FIO_OPT_STR_STORE,
1601 .off1 = td_var_offset(write_iolog_file),
1602 .help = "Store IO pattern to file",
1605 .name = "read_iolog",
1606 .type = FIO_OPT_STR_STORE,
1607 .off1 = td_var_offset(read_iolog_file),
1608 .help = "Playback IO pattern from file",
1611 .name = "replay_no_stall",
1612 .type = FIO_OPT_INT,
1613 .off1 = td_var_offset(no_stall),
1615 .parent = "read_iolog",
1616 .help = "Playback IO pattern file as fast as possible without stalls",
1619 .name = "replay_redirect",
1620 .type = FIO_OPT_STR_STORE,
1621 .off1 = td_var_offset(replay_redirect),
1622 .parent = "read_iolog",
1623 .help = "Replay all I/O onto this device, regardless of trace device",
1626 .name = "exec_prerun",
1627 .type = FIO_OPT_STR_STORE,
1628 .off1 = td_var_offset(exec_prerun),
1629 .help = "Execute this file prior to running job",
1632 .name = "exec_postrun",
1633 .type = FIO_OPT_STR_STORE,
1634 .off1 = td_var_offset(exec_postrun),
1635 .help = "Execute this file after running job",
1637 #ifdef FIO_HAVE_IOSCHED_SWITCH
1639 .name = "ioscheduler",
1640 .type = FIO_OPT_STR_STORE,
1641 .off1 = td_var_offset(ioscheduler),
1642 .help = "Use this IO scheduler on the backing device",
1647 .type = FIO_OPT_STR_VAL,
1648 .off1 = td_var_offset(zone_size),
1649 .help = "Give size of an IO zone",
1654 .type = FIO_OPT_STR_VAL,
1655 .off1 = td_var_offset(zone_skip),
1656 .help = "Space between IO zones",
1661 .type = FIO_OPT_STR_VAL,
1662 .cb = str_lockmem_cb,
1663 .help = "Lock down this amount of memory",
1667 .name = "rwmixread",
1668 .type = FIO_OPT_INT,
1669 .cb = str_rwmix_read_cb,
1671 .help = "Percentage of mixed workload that is reads",
1675 .name = "rwmixwrite",
1676 .type = FIO_OPT_INT,
1677 .cb = str_rwmix_write_cb,
1679 .help = "Percentage of mixed workload that is writes",
1683 .name = "rwmixcycle",
1684 .type = FIO_OPT_DEPRECATED,
1688 .type = FIO_OPT_INT,
1689 .off1 = td_var_offset(nice),
1690 .help = "Set job CPU nice value",
1695 #ifdef FIO_HAVE_IOPRIO
1698 .type = FIO_OPT_INT,
1700 .help = "Set job IO priority value",
1705 .name = "prioclass",
1706 .type = FIO_OPT_INT,
1707 .cb = str_prioclass_cb,
1708 .help = "Set job IO priority class",
1714 .name = "thinktime",
1715 .type = FIO_OPT_INT,
1716 .off1 = td_var_offset(thinktime),
1717 .help = "Idle time between IO buffers (usec)",
1721 .name = "thinktime_spin",
1722 .type = FIO_OPT_INT,
1723 .off1 = td_var_offset(thinktime_spin),
1724 .help = "Start think time by spinning this amount (usec)",
1726 .parent = "thinktime",
1729 .name = "thinktime_blocks",
1730 .type = FIO_OPT_INT,
1731 .off1 = td_var_offset(thinktime_blocks),
1732 .help = "IO buffer period between 'thinktime'",
1734 .parent = "thinktime",
1738 .type = FIO_OPT_INT,
1739 .off1 = td_var_offset(rate[0]),
1740 .off2 = td_var_offset(rate[1]),
1741 .help = "Set bandwidth rate",
1745 .type = FIO_OPT_INT,
1746 .off1 = td_var_offset(ratemin[0]),
1747 .off2 = td_var_offset(ratemin[1]),
1748 .help = "Job must meet this rate or it will be shutdown",
1752 .name = "rate_iops",
1753 .type = FIO_OPT_INT,
1754 .off1 = td_var_offset(rate_iops[0]),
1755 .off2 = td_var_offset(rate_iops[1]),
1756 .help = "Limit IO used to this number of IO operations/sec",
1759 .name = "rate_iops_min",
1760 .type = FIO_OPT_INT,
1761 .off1 = td_var_offset(rate_iops_min[0]),
1762 .off2 = td_var_offset(rate_iops_min[1]),
1763 .help = "Job must meet this rate or it will be shut down",
1764 .parent = "rate_iops",
1767 .name = "ratecycle",
1768 .type = FIO_OPT_INT,
1769 .off1 = td_var_offset(ratecycle),
1770 .help = "Window average for rate limits (msec)",
1775 .name = "invalidate",
1776 .type = FIO_OPT_BOOL,
1777 .off1 = td_var_offset(invalidate_cache),
1778 .help = "Invalidate buffer/page cache prior to running job",
1783 .type = FIO_OPT_BOOL,
1784 .off1 = td_var_offset(sync_io),
1785 .help = "Use O_SYNC for buffered writes",
1787 .parent = "buffered",
1790 .name = "bwavgtime",
1791 .type = FIO_OPT_INT,
1792 .off1 = td_var_offset(bw_avg_time),
1793 .help = "Time window over which to calculate bandwidth"
1798 .name = "create_serialize",
1799 .type = FIO_OPT_BOOL,
1800 .off1 = td_var_offset(create_serialize),
1801 .help = "Serialize creating of job files",
1805 .name = "create_fsync",
1806 .type = FIO_OPT_BOOL,
1807 .off1 = td_var_offset(create_fsync),
1808 .help = "fsync file after creation",
1812 .name = "create_on_open",
1813 .type = FIO_OPT_BOOL,
1814 .off1 = td_var_offset(create_on_open),
1815 .help = "Create files when they are opened for IO",
1820 .type = FIO_OPT_BOOL,
1821 .off1 = td_var_offset(pre_read),
1822 .help = "Pre-read files before starting official testing",
1827 .type = FIO_OPT_INT,
1828 .off1 = td_var_offset(cpuload),
1829 .help = "Use this percentage of CPU",
1832 .name = "cpuchunks",
1833 .type = FIO_OPT_INT,
1834 .off1 = td_var_offset(cpucycle),
1835 .help = "Length of the CPU burn cycles (usecs)",
1837 .parent = "cpuload",
1839 #ifdef FIO_HAVE_CPU_AFFINITY
1842 .type = FIO_OPT_INT,
1843 .cb = str_cpumask_cb,
1844 .help = "CPU affinity mask",
1847 .name = "cpus_allowed",
1848 .type = FIO_OPT_STR,
1849 .cb = str_cpus_allowed_cb,
1850 .help = "Set CPUs allowed",
1854 .name = "end_fsync",
1855 .type = FIO_OPT_BOOL,
1856 .off1 = td_var_offset(end_fsync),
1857 .help = "Include fsync at the end of job",
1861 .name = "fsync_on_close",
1862 .type = FIO_OPT_BOOL,
1863 .off1 = td_var_offset(fsync_on_close),
1864 .help = "fsync files on close",
1869 .type = FIO_OPT_BOOL,
1870 .off1 = td_var_offset(unlink),
1871 .help = "Unlink created files after job has completed",
1876 .type = FIO_OPT_STR_SET,
1877 .cb = str_exitall_cb,
1878 .help = "Terminate all jobs when one exits",
1881 .name = "stonewall",
1882 .alias = "wait_for_previous",
1883 .type = FIO_OPT_STR_SET,
1884 .off1 = td_var_offset(stonewall),
1885 .help = "Insert a hard barrier between this job and previous",
1888 .name = "new_group",
1889 .type = FIO_OPT_STR_SET,
1890 .off1 = td_var_offset(new_group),
1891 .help = "Mark the start of a new group (for reporting)",
1895 .type = FIO_OPT_STR_SET,
1896 .off1 = td_var_offset(use_thread),
1897 .help = "Use threads instead of forks",
1900 .name = "write_bw_log",
1901 .type = FIO_OPT_STR,
1902 .off1 = td_var_offset(write_bw_log),
1903 .cb = str_write_bw_log_cb,
1904 .help = "Write log of bandwidth during run",
1907 .name = "write_lat_log",
1908 .type = FIO_OPT_STR,
1909 .off1 = td_var_offset(write_lat_log),
1910 .cb = str_write_lat_log_cb,
1911 .help = "Write log of latency during run",
1914 .name = "hugepage-size",
1915 .type = FIO_OPT_INT,
1916 .off1 = td_var_offset(hugepage_size),
1917 .help = "When using hugepages, specify size of each page",
1918 .def = __stringify(FIO_HUGE_PAGE),
1921 .name = "group_reporting",
1922 .type = FIO_OPT_STR_SET,
1923 .off1 = td_var_offset(group_reporting),
1924 .help = "Do reporting on a per-group basis",
1927 .name = "zero_buffers",
1928 .type = FIO_OPT_STR_SET,
1929 .off1 = td_var_offset(zero_buffers),
1930 .help = "Init IO buffers to all zeroes",
1933 .name = "refill_buffers",
1934 .type = FIO_OPT_STR_SET,
1935 .off1 = td_var_offset(refill_buffers),
1936 .help = "Refill IO buffers on every IO submit",
1939 .name = "clat_percentiles",
1940 .type = FIO_OPT_BOOL,
1941 .off1 = td_var_offset(clat_percentiles),
1942 .help = "Enable the reporting of completion latency percentiles",
1946 .name = "percentile_list",
1947 .type = FIO_OPT_FLOAT_LIST,
1948 .off1 = td_var_offset(percentile_list),
1949 .off2 = td_var_offset(overwrite_plist),
1950 .help = "Specify a custom list of percentiles to report",
1951 .maxlen = FIO_IO_U_LIST_MAX_LEN,
1956 #ifdef FIO_HAVE_DISK_UTIL
1958 .name = "disk_util",
1959 .type = FIO_OPT_BOOL,
1960 .off1 = td_var_offset(do_disk_util),
1961 .help = "Log disk utilization statistics",
1966 .name = "gtod_reduce",
1967 .type = FIO_OPT_BOOL,
1968 .help = "Greatly reduce number of gettimeofday() calls",
1969 .cb = str_gtod_reduce_cb,
1973 .name = "disable_lat",
1974 .type = FIO_OPT_BOOL,
1975 .off1 = td_var_offset(disable_lat),
1976 .help = "Disable latency numbers",
1977 .parent = "gtod_reduce",
1981 .name = "disable_clat",
1982 .type = FIO_OPT_BOOL,
1983 .off1 = td_var_offset(disable_clat),
1984 .help = "Disable completion latency numbers",
1985 .parent = "gtod_reduce",
1989 .name = "disable_slat",
1990 .type = FIO_OPT_BOOL,
1991 .off1 = td_var_offset(disable_slat),
1992 .help = "Disable submission latency numbers",
1993 .parent = "gtod_reduce",
1997 .name = "disable_bw_measurement",
1998 .type = FIO_OPT_BOOL,
1999 .off1 = td_var_offset(disable_bw),
2000 .help = "Disable bandwidth logging",
2001 .parent = "gtod_reduce",
2006 .type = FIO_OPT_INT,
2007 .cb = str_gtod_cpu_cb,
2008 .help = "Set up dedicated gettimeofday() thread on this CPU",
2009 .verify = gtod_cpu_verify,
2012 .name = "continue_on_error",
2013 .type = FIO_OPT_BOOL,
2014 .off1 = td_var_offset(continue_on_error),
2015 .help = "Continue on non-fatal errors during IO",
2020 .type = FIO_OPT_STR_STORE,
2021 .off1 = td_var_offset(profile),
2022 .help = "Select a specific builtin performance test",
2026 .type = FIO_OPT_STR_STORE,
2027 .off1 = td_var_offset(cgroup),
2028 .help = "Add job to cgroup of this name",
2031 .name = "cgroup_weight",
2032 .type = FIO_OPT_INT,
2033 .off1 = td_var_offset(cgroup_weight),
2034 .help = "Use given weight for cgroup",
2039 .name = "cgroup_nodelete",
2040 .type = FIO_OPT_BOOL,
2041 .off1 = td_var_offset(cgroup_nodelete),
2042 .help = "Do not delete cgroups after job completion",
2047 .type = FIO_OPT_INT,
2048 .off1 = td_var_offset(uid),
2049 .help = "Run job with this user ID",
2053 .type = FIO_OPT_INT,
2054 .off1 = td_var_offset(gid),
2055 .help = "Run job with this group ID",
2062 static void add_to_lopt(struct option *lopt, struct fio_option *o,
2065 lopt->name = (char *) name;
2066 lopt->val = FIO_GETOPT_JOB;
2067 if (o->type == FIO_OPT_STR_SET)
2068 lopt->has_arg = no_argument;
2070 lopt->has_arg = required_argument;
2073 void fio_options_dup_and_init(struct option *long_options)
2075 struct fio_option *o;
2078 options_init(options);
2081 while (long_options[i].name)
2086 add_to_lopt(&long_options[i], o, o->name);
2089 add_to_lopt(&long_options[i], o, o->alias);
2094 assert(i < FIO_NR_OPTIONS);
2098 struct fio_keyword {
2104 static struct fio_keyword fio_keywords[] = {
2106 .word = "$pagesize",
2107 .desc = "Page size in the system",
2110 .word = "$mb_memory",
2111 .desc = "Megabytes of memory online",
2115 .desc = "Number of CPUs online in the system",
2122 void fio_keywords_init(void)
2124 unsigned long long mb_memory;
2128 sprintf(buf, "%lu", page_size);
2129 fio_keywords[0].replace = strdup(buf);
2131 mb_memory = os_phys_mem() / (1024 * 1024);
2132 sprintf(buf, "%llu", mb_memory);
2133 fio_keywords[1].replace = strdup(buf);
2136 sprintf(buf, "%lu", l);
2137 fio_keywords[2].replace = strdup(buf);
2142 static char *bc_calc(char *str)
2144 char *buf, *tmp, opt[80];
2149 * No math, just return string
2151 if (!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
2156 * Split option from value, we only need to calculate the value
2158 tmp = strchr(str, '=');
2163 memset(opt, 0, sizeof(opt));
2164 strncpy(opt, str, tmp - str);
2168 sprintf(buf, "which %s > /dev/null", BC_APP);
2170 log_err("fio: bc is needed for performing math\n");
2175 sprintf(buf, "echo %s | %s", tmp, BC_APP);
2176 f = popen(buf, "r");
2182 ret = fread(buf, 1, 128, f);
2188 buf[ret - 1] = '\0';
2197 * Look for reserved variable names and replace them with real values
2199 static char *fio_keyword_replace(char *opt)
2204 for (i = 0; fio_keywords[i].word != NULL; i++) {
2205 struct fio_keyword *kw = &fio_keywords[i];
2207 while ((s = strstr(opt, kw->word)) != NULL) {
2208 char *new = malloc(strlen(opt) + 1);
2214 * Copy part of the string before the keyword and
2215 * sprintf() the replacement after it.
2217 memcpy(new, opt, olen);
2218 len = sprintf(new + olen, "%s", kw->replace);
2221 * If there's more in the original string, copy that
2224 opt += strlen(kw->word) + olen;
2226 memcpy(new + olen + len, opt, opt - o_org - 1);
2229 * replace opt and free the old opt
2235 * Check for potential math and invoke bc, if possible
2244 int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
2248 sort_options(opts, options, num_opts);
2250 for (ret = 0, i = 0; i < num_opts; i++) {
2251 opts[i] = fio_keyword_replace(opts[i]);
2252 ret |= parse_option(opts[i], options, td);
2258 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
2260 return parse_cmd_option(opt, val, options, td);
2263 void fio_fill_default_options(struct thread_data *td)
2265 fill_default_options(td, options);
2268 int fio_show_option_help(const char *opt)
2270 return show_cmd_help(options, opt);
2273 static void __options_mem(struct thread_data *td, int alloc)
2275 struct thread_options *o = &td->o;
2276 struct fio_option *opt;
2280 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
2281 if (opt->type != FIO_OPT_STR_STORE)
2284 ptr = (void *) o + opt->off1;
2287 *ptr = strdup(*ptr);
2297 * dupe FIO_OPT_STR_STORE options
2299 void options_mem_dupe(struct thread_data *td)
2301 __options_mem(td, 1);
2304 void options_mem_free(struct thread_data fio_unused *td)
2307 __options_mem(td, 0);
2311 unsigned int fio_get_kb_base(void *data)
2313 struct thread_data *td = data;
2314 unsigned int kb_base = 0;
2317 kb_base = td->o.kb_base;
2324 int add_option(struct fio_option *o)
2326 struct fio_option *__o;
2335 memcpy(&options[opt_index], o, sizeof(*o));
2339 void invalidate_profile_options(const char *prof_name)
2341 struct fio_option *o;
2345 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
2346 o->type = FIO_OPT_INVALID;
2347 o->prof_name = NULL;
2353 void add_opt_posval(const char *optname, const char *ival, const char *help)
2355 struct fio_option *o;
2358 o = find_option(options, optname);
2362 for (i = 0; i < PARSE_MAX_VP; i++) {
2363 if (o->posval[i].ival)
2366 o->posval[i].ival = ival;
2367 o->posval[i].help = help;
2372 void del_opt_posval(const char *optname, const char *ival)
2374 struct fio_option *o;
2377 o = find_option(options, optname);
2381 for (i = 0; i < PARSE_MAX_VP; i++) {
2382 if (!o->posval[i].ival)
2384 if (strcmp(o->posval[i].ival, ival))
2387 o->posval[i].ival = NULL;
2388 o->posval[i].help = NULL;