14 #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
17 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
19 static char *get_opt_postfix(const char *str)
21 char *p = strstr(str, ":");
27 strip_blank_front(&p);
32 static int bs_cmp(const void *p1, const void *p2)
34 const struct bssplit *bsp1 = p1;
35 const struct bssplit *bsp2 = p2;
37 return bsp1->perc < bsp2->perc;
40 static int str_bssplit_cb(void *data, const char *input)
42 struct thread_data *td = data;
43 char *fname, *str, *p;
44 unsigned int i, perc, perc_missing;
45 unsigned int max_bs, min_bs;
48 p = str = strdup(input);
50 strip_blank_front(&str);
54 td->o.bssplit = malloc(4 * sizeof(struct bssplit));
59 while ((fname = strsep(&str, ":")) != NULL) {
66 * grow struct buffer, if needed
68 if (i == td->o.bssplit_nr) {
69 td->o.bssplit_nr <<= 1;
70 td->o.bssplit = realloc(td->o.bssplit,
72 * sizeof(struct bssplit));
75 perc_str = strstr(fname, "/");
79 perc = atoi(perc_str);
87 if (str_to_decimal(fname, &val, 1)) {
88 log_err("fio: bssplit conversion failed\n");
98 td->o.bssplit[i].bs = val;
99 td->o.bssplit[i].perc = perc;
103 td->o.bssplit_nr = i;
106 * Now check if the percentages add up, and how much is missing
108 perc = perc_missing = 0;
109 for (i = 0; i < td->o.bssplit_nr; i++) {
110 struct bssplit *bsp = &td->o.bssplit[i];
112 if (bsp->perc == (unsigned char) -1)
119 log_err("fio: bssplit percentages add to more than 100%%\n");
124 * If values didn't have a percentage set, divide the remains between
128 for (i = 0; i < td->o.bssplit_nr; i++) {
129 struct bssplit *bsp = &td->o.bssplit[i];
131 if (bsp->perc == (unsigned char) -1)
132 bsp->perc = (100 - perc) / perc_missing;
136 td->o.min_bs[DDIR_READ] = td->o.min_bs[DDIR_WRITE] = min_bs;
137 td->o.max_bs[DDIR_READ] = td->o.max_bs[DDIR_WRITE] = max_bs;
140 * now sort based on percentages, for ease of lookup
142 qsort(td->o.bssplit, td->o.bssplit_nr, sizeof(struct bssplit), bs_cmp);
148 static int str_rw_cb(void *data, const char *str)
150 struct thread_data *td = data;
151 char *nr = get_opt_postfix(str);
155 td->o.ddir_nr = atoi(nr);
160 static int str_mem_cb(void *data, const char *mem)
162 struct thread_data *td = data;
164 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
165 td->mmapfile = get_opt_postfix(mem);
166 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
167 log_err("fio: mmaphuge:/path/to/file\n");
175 static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
181 #ifdef FIO_HAVE_IOPRIO
182 static int str_prioclass_cb(void *data, unsigned int *val)
184 struct thread_data *td = data;
188 * mask off old class bits, str_prio_cb() may have set a default class
190 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
193 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
198 static int str_prio_cb(void *data, unsigned int *val)
200 struct thread_data *td = data;
205 * If no class is set, assume BE
207 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
208 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
215 static int str_exitall_cb(void)
217 exitall_on_terminate = 1;
221 #ifdef FIO_HAVE_CPU_AFFINITY
222 static int str_cpumask_cb(void *data, unsigned int *val)
224 struct thread_data *td = data;
227 CPU_ZERO(&td->o.cpumask);
229 for (i = 0; i < sizeof(int) * 8; i++)
231 CPU_SET(*val, &td->o.cpumask);
233 td->o.cpumask_set = 1;
237 static int str_cpus_allowed_cb(void *data, const char *input)
239 struct thread_data *td = data;
242 CPU_ZERO(&td->o.cpumask);
244 p = str = strdup(input);
246 strip_blank_front(&str);
247 strip_blank_end(str);
249 while ((cpu = strsep(&str, ",")) != NULL) {
252 CPU_SET(atoi(cpu), &td->o.cpumask);
256 td->o.cpumask_set = 1;
261 static int str_fst_cb(void *data, const char *str)
263 struct thread_data *td = data;
264 char *nr = get_opt_postfix(str);
266 td->file_service_nr = 1;
268 td->file_service_nr = atoi(nr);
273 static int check_dir(struct thread_data *td, char *fname)
275 char file[PATH_MAX], *dir;
279 if (td->o.directory) {
280 strcpy(file, td->o.directory);
284 sprintf(file + elen, "/%s", fname);
287 if (lstat(dir, &sb) < 0) {
290 log_err("fio: %s is not a directory\n", dir);
291 td_verror(td, ret, "lstat");
295 if (!S_ISDIR(sb.st_mode)) {
296 log_err("fio: %s is not a directory\n", dir);
303 static int str_filename_cb(void *data, const char *input)
305 struct thread_data *td = data;
306 char *fname, *str, *p;
308 p = str = strdup(input);
310 strip_blank_front(&str);
311 strip_blank_end(str);
313 if (!td->files_index)
316 while ((fname = strsep(&str, ":")) != NULL) {
319 if (check_dir(td, fname)) {
331 static int str_directory_cb(void *data, const char fio_unused *str)
333 struct thread_data *td = data;
336 if (lstat(td->o.directory, &sb) < 0) {
339 log_err("fio: %s is not a directory\n", td->o.directory);
340 td_verror(td, ret, "lstat");
343 if (!S_ISDIR(sb.st_mode)) {
344 log_err("fio: %s is not a directory\n", td->o.directory);
351 static int str_opendir_cb(void *data, const char fio_unused *str)
353 struct thread_data *td = data;
355 if (!td->files_index)
358 return add_dir_files(td, td->o.opendir);
361 static int str_verify_offset_cb(void *data, unsigned int *off)
363 struct thread_data *td = data;
365 if (*off && *off < sizeof(struct verify_header)) {
366 log_err("fio: verify_offset too small\n");
370 td->o.verify_offset = *off;
374 static int str_verify_pattern_cb(void *data, unsigned int *off)
376 struct thread_data *td = data;
381 td->o.verify_pattern_bytes = 1;
383 td->o.verify_pattern_bytes = 2;
385 td->o.verify_pattern_bytes = 3;
387 td->o.verify_pattern_bytes = 4;
389 td->o.verify_pattern = *off;
393 static int str_lockfile_cb(void *data, const char *str)
395 struct thread_data *td = data;
396 char *nr = get_opt_postfix(str);
398 td->o.lockfile_batch = 1;
400 td->o.lockfile_batch = atoi(nr);
405 #define __stringify_1(x) #x
406 #define __stringify(x) __stringify_1(x)
409 * Map of job/command line options
411 static struct fio_option options[] = {
413 .name = "description",
414 .type = FIO_OPT_STR_STORE,
415 .off1 = td_var_offset(description),
416 .help = "Text job description",
420 .type = FIO_OPT_STR_STORE,
421 .off1 = td_var_offset(name),
422 .help = "Name of this job",
426 .type = FIO_OPT_STR_STORE,
427 .off1 = td_var_offset(directory),
428 .cb = str_directory_cb,
429 .help = "Directory to store files in",
433 .type = FIO_OPT_STR_STORE,
434 .off1 = td_var_offset(filename),
435 .cb = str_filename_cb,
436 .help = "File(s) to use for the workload",
441 .cb = str_lockfile_cb,
442 .off1 = td_var_offset(file_lock_mode),
443 .help = "Lock file when doing IO to it",
444 .parent = "filename",
448 .oval = FILE_LOCK_NONE,
449 .help = "No file locking",
451 { .ival = "exclusive",
452 .oval = FILE_LOCK_EXCLUSIVE,
453 .help = "Exclusive file lock",
457 .oval = FILE_LOCK_READWRITE,
458 .help = "Read vs write lock",
464 .type = FIO_OPT_STR_STORE,
465 .off1 = td_var_offset(opendir),
466 .cb = str_opendir_cb,
467 .help = "Recursively add files from this directory and down",
471 .alias = "readwrite",
474 .off1 = td_var_offset(td_ddir),
475 .help = "IO direction",
479 .oval = TD_DDIR_READ,
480 .help = "Sequential read",
483 .oval = TD_DDIR_WRITE,
484 .help = "Sequential write",
486 { .ival = "randread",
487 .oval = TD_DDIR_RANDREAD,
488 .help = "Random read",
490 { .ival = "randwrite",
491 .oval = TD_DDIR_RANDWRITE,
492 .help = "Random write",
496 .help = "Sequential read and write mix",
499 .oval = TD_DDIR_RANDRW,
500 .help = "Random read and write mix"
506 .type = FIO_OPT_STR_STORE,
507 .off1 = td_var_offset(ioengine),
508 .help = "IO engine to use",
512 .help = "Use read/write",
515 .help = "Use pread/pwrite",
518 .help = "Use readv/writev",
520 #ifdef FIO_HAVE_LIBAIO
522 .help = "Linux native asynchronous IO",
525 #ifdef FIO_HAVE_POSIXAIO
526 { .ival = "posixaio",
527 .help = "POSIX asynchronous IO",
531 .help = "Memory mapped IO",
533 #ifdef FIO_HAVE_SPLICE
535 .help = "splice/vmsplice based IO",
537 { .ival = "netsplice",
538 .help = "splice/vmsplice to/from the network",
543 .help = "SCSI generic v3 IO",
547 .help = "Testing engine (no data transfer)",
550 .help = "Network IO",
552 #ifdef FIO_HAVE_SYSLET
553 { .ival = "syslet-rw",
554 .help = "syslet enabled async pread/pwrite IO",
558 .help = "CPU cycler burner engine",
560 #ifdef FIO_HAVE_GUASI
562 .help = "GUASI IO engine",
565 { .ival = "external",
566 .help = "Load external engine (append name)",
573 .off1 = td_var_offset(iodepth),
574 .help = "Amount of IO buffers to keep in flight",
579 .name = "iodepth_batch",
581 .off1 = td_var_offset(iodepth_batch),
582 .help = "Number of IO to submit in one go",
588 .name = "iodepth_low",
590 .off1 = td_var_offset(iodepth_low),
591 .help = "Low water mark for queuing depth",
596 .type = FIO_OPT_STR_VAL,
597 .off1 = td_var_offset(size),
599 .help = "Total size of device or files",
602 .name = "fill_device",
603 .type = FIO_OPT_BOOL,
604 .off1 = td_var_offset(fill_device),
605 .help = "Write until an ENOSPC error occurs",
610 .type = FIO_OPT_STR_VAL,
611 .off1 = td_var_offset(file_size_low),
612 .off2 = td_var_offset(file_size_high),
614 .help = "Size of individual files",
618 .alias = "fileoffset",
619 .type = FIO_OPT_STR_VAL,
620 .off1 = td_var_offset(start_offset),
621 .help = "Start IO from this offset",
626 .alias = "blocksize",
627 .type = FIO_OPT_STR_VAL_INT,
628 .off1 = td_var_offset(bs[DDIR_READ]),
629 .off2 = td_var_offset(bs[DDIR_WRITE]),
631 .help = "Block size unit",
637 .alias = "blocksize_range",
638 .type = FIO_OPT_RANGE,
639 .off1 = td_var_offset(min_bs[DDIR_READ]),
640 .off2 = td_var_offset(max_bs[DDIR_READ]),
641 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
642 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
644 .help = "Set block size range (in more detail than bs)",
650 .cb = str_bssplit_cb,
651 .help = "Set a specific mix of block sizes",
655 .name = "bs_unaligned",
656 .alias = "blocksize_unaligned",
657 .type = FIO_OPT_STR_SET,
658 .off1 = td_var_offset(bs_unaligned),
659 .help = "Don't sector align IO buffer sizes",
663 .name = "randrepeat",
664 .type = FIO_OPT_BOOL,
665 .off1 = td_var_offset(rand_repeatable),
666 .help = "Use repeatable random IO pattern",
671 .name = "norandommap",
672 .type = FIO_OPT_STR_SET,
673 .off1 = td_var_offset(norandommap),
674 .help = "Accept potential duplicate random blocks",
678 .name = "softrandommap",
679 .type = FIO_OPT_BOOL,
680 .off1 = td_var_offset(softrandommap),
681 .help = "Allow randommap to fail and continue witout",
682 .parent = "norandommap",
688 .off1 = td_var_offset(nr_files),
689 .help = "Split job workload between this number of files",
695 .off1 = td_var_offset(open_files),
696 .help = "Number of files to keep open at the same time",
699 .name = "file_service_type",
702 .off1 = td_var_offset(file_service_type),
703 .help = "How to select which file to service next",
707 .oval = FIO_FSERVICE_RANDOM,
708 .help = "Choose a file at random",
710 { .ival = "roundrobin",
711 .oval = FIO_FSERVICE_RR,
712 .help = "Round robin select files",
718 .name = "fadvise_hint",
719 .type = FIO_OPT_BOOL,
720 .off1 = td_var_offset(fadvise_hint),
721 .help = "Use fadvise() to advise the kernel on IO pattern",
727 .off1 = td_var_offset(fsync_blocks),
728 .help = "Issue fsync for writes every given number of blocks",
733 .type = FIO_OPT_BOOL,
734 .off1 = td_var_offset(odirect),
735 .help = "Use O_DIRECT IO (negates buffered)",
740 .type = FIO_OPT_BOOL,
741 .off1 = td_var_offset(odirect),
743 .help = "Use buffered IO (negates direct)",
748 .type = FIO_OPT_BOOL,
749 .off1 = td_var_offset(overwrite),
750 .help = "When writing, set whether to overwrite current data",
756 .off1 = td_var_offset(loops),
757 .help = "Number of times to run the job",
763 .off1 = td_var_offset(numjobs),
764 .help = "Duplicate this job this many times",
768 .name = "startdelay",
770 .off1 = td_var_offset(start_delay),
771 .help = "Only start job when this period has passed",
777 .type = FIO_OPT_STR_VAL_TIME,
778 .off1 = td_var_offset(timeout),
779 .help = "Stop workload when this amount of time has passed",
783 .name = "time_based",
784 .type = FIO_OPT_STR_SET,
785 .off1 = td_var_offset(time_based),
786 .help = "Keep running until runtime/timeout is met",
793 .off1 = td_var_offset(mem_type),
794 .help = "Backing type for IO buffers",
799 .help = "Use malloc(3) for IO buffers",
803 .help = "Use shared memory segments for IO buffers",
805 #ifdef FIO_HAVE_HUGETLB
808 .help = "Like shm, but use huge pages",
813 .help = "Use mmap(2) (file or anon) for IO buffers",
815 #ifdef FIO_HAVE_HUGETLB
816 { .ival = "mmaphuge",
817 .oval = MEM_MMAPHUGE,
818 .help = "Like mmap, but use huge pages",
826 .off1 = td_var_offset(verify),
827 .help = "Verify data written",
832 .help = "Don't do IO verification",
836 .help = "Use md5 checksums for verification",
839 .oval = VERIFY_CRC64,
840 .help = "Use crc64 checksums for verification",
843 .oval = VERIFY_CRC32,
844 .help = "Use crc32 checksums for verification",
847 .oval = VERIFY_CRC16,
848 .help = "Use crc16 checksums for verification",
852 .help = "Use crc7 checksums for verification",
855 .oval = VERIFY_SHA256,
856 .help = "Use sha256 checksums for verification",
859 .oval = VERIFY_SHA512,
860 .help = "Use sha512 checksums for verification",
864 .help = "Use io information",
869 .help = "Pretend to verify",
875 .type = FIO_OPT_BOOL,
876 .off1 = td_var_offset(do_verify),
877 .help = "Run verification stage after write",
882 .name = "verifysort",
883 .type = FIO_OPT_BOOL,
884 .off1 = td_var_offset(verifysort),
885 .help = "Sort written verify blocks for read back",
890 .name = "verify_interval",
891 .type = FIO_OPT_STR_VAL_INT,
892 .off1 = td_var_offset(verify_interval),
893 .minval = 2 * sizeof(struct verify_header),
894 .help = "Store verify buffer header every N bytes",
898 .name = "verify_offset",
899 .type = FIO_OPT_STR_VAL_INT,
900 .help = "Offset verify header location by N bytes",
902 .cb = str_verify_offset_cb,
906 .name = "verify_pattern",
908 .cb = str_verify_pattern_cb,
909 .help = "Fill pattern for IO buffers",
913 .name = "verify_fatal",
914 .type = FIO_OPT_BOOL,
915 .off1 = td_var_offset(verify_fatal),
917 .help = "Exit on a single verify failure, don't continue",
921 .name = "write_iolog",
922 .type = FIO_OPT_STR_STORE,
923 .off1 = td_var_offset(write_iolog_file),
924 .help = "Store IO pattern to file",
927 .name = "read_iolog",
928 .type = FIO_OPT_STR_STORE,
929 .off1 = td_var_offset(read_iolog_file),
930 .help = "Playback IO pattern from file",
933 .name = "exec_prerun",
934 .type = FIO_OPT_STR_STORE,
935 .off1 = td_var_offset(exec_prerun),
936 .help = "Execute this file prior to running job",
939 .name = "exec_postrun",
940 .type = FIO_OPT_STR_STORE,
941 .off1 = td_var_offset(exec_postrun),
942 .help = "Execute this file after running job",
944 #ifdef FIO_HAVE_IOSCHED_SWITCH
946 .name = "ioscheduler",
947 .type = FIO_OPT_STR_STORE,
948 .off1 = td_var_offset(ioscheduler),
949 .help = "Use this IO scheduler on the backing device",
954 .type = FIO_OPT_STR_VAL,
955 .off1 = td_var_offset(zone_size),
956 .help = "Give size of an IO zone",
961 .type = FIO_OPT_STR_VAL,
962 .off1 = td_var_offset(zone_skip),
963 .help = "Space between IO zones",
968 .type = FIO_OPT_STR_VAL,
969 .cb = str_lockmem_cb,
970 .help = "Lock down this amount of memory",
976 .off1 = td_var_offset(rwmix[DDIR_READ]),
978 .help = "Percentage of mixed workload that is reads",
982 .name = "rwmixwrite",
984 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
986 .help = "Percentage of mixed workload that is writes",
990 .name = "rwmixcycle",
991 .type = FIO_OPT_DEPRECATED,
996 .off1 = td_var_offset(nice),
997 .help = "Set job CPU nice value",
1002 #ifdef FIO_HAVE_IOPRIO
1005 .type = FIO_OPT_INT,
1007 .help = "Set job IO priority value",
1012 .name = "prioclass",
1013 .type = FIO_OPT_INT,
1014 .cb = str_prioclass_cb,
1015 .help = "Set job IO priority class",
1021 .name = "thinktime",
1022 .type = FIO_OPT_INT,
1023 .off1 = td_var_offset(thinktime),
1024 .help = "Idle time between IO buffers (usec)",
1028 .name = "thinktime_spin",
1029 .type = FIO_OPT_INT,
1030 .off1 = td_var_offset(thinktime_spin),
1031 .help = "Start think time by spinning this amount (usec)",
1033 .parent = "thinktime",
1036 .name = "thinktime_blocks",
1037 .type = FIO_OPT_INT,
1038 .off1 = td_var_offset(thinktime_blocks),
1039 .help = "IO buffer period between 'thinktime'",
1041 .parent = "thinktime",
1045 .type = FIO_OPT_INT,
1046 .off1 = td_var_offset(rate),
1047 .help = "Set bandwidth rate",
1051 .type = FIO_OPT_INT,
1052 .off1 = td_var_offset(ratemin),
1053 .help = "Job must meet this rate or it will be shutdown",
1057 .name = "rate_iops",
1058 .type = FIO_OPT_INT,
1059 .off1 = td_var_offset(rate_iops),
1060 .help = "Limit IO used to this number of IO operations/sec",
1063 .name = "rate_iops_min",
1064 .type = FIO_OPT_INT,
1065 .off1 = td_var_offset(rate_iops_min),
1066 .help = "Job must meet this rate or it will be shutdown",
1067 .parent = "rate_iops",
1070 .name = "ratecycle",
1071 .type = FIO_OPT_INT,
1072 .off1 = td_var_offset(ratecycle),
1073 .help = "Window average for rate limits (msec)",
1078 .name = "invalidate",
1079 .type = FIO_OPT_BOOL,
1080 .off1 = td_var_offset(invalidate_cache),
1081 .help = "Invalidate buffer/page cache prior to running job",
1086 .type = FIO_OPT_BOOL,
1087 .off1 = td_var_offset(sync_io),
1088 .help = "Use O_SYNC for buffered writes",
1090 .parent = "buffered",
1093 .name = "bwavgtime",
1094 .type = FIO_OPT_INT,
1095 .off1 = td_var_offset(bw_avg_time),
1096 .help = "Time window over which to calculate bandwidth"
1101 .name = "create_serialize",
1102 .type = FIO_OPT_BOOL,
1103 .off1 = td_var_offset(create_serialize),
1104 .help = "Serialize creating of job files",
1108 .name = "create_fsync",
1109 .type = FIO_OPT_BOOL,
1110 .off1 = td_var_offset(create_fsync),
1111 .help = "Fsync file after creation",
1116 .type = FIO_OPT_INT,
1117 .off1 = td_var_offset(cpuload),
1118 .help = "Use this percentage of CPU",
1121 .name = "cpuchunks",
1122 .type = FIO_OPT_INT,
1123 .off1 = td_var_offset(cpucycle),
1124 .help = "Length of the CPU burn cycles (usecs)",
1126 .parent = "cpuload",
1128 #ifdef FIO_HAVE_CPU_AFFINITY
1131 .type = FIO_OPT_INT,
1132 .cb = str_cpumask_cb,
1133 .help = "CPU affinity mask",
1136 .name = "cpus_allowed",
1137 .type = FIO_OPT_STR,
1138 .cb = str_cpus_allowed_cb,
1139 .help = "Set CPUs allowed",
1143 .name = "end_fsync",
1144 .type = FIO_OPT_BOOL,
1145 .off1 = td_var_offset(end_fsync),
1146 .help = "Include fsync at the end of job",
1150 .name = "fsync_on_close",
1151 .type = FIO_OPT_BOOL,
1152 .off1 = td_var_offset(fsync_on_close),
1153 .help = "fsync files on close",
1158 .type = FIO_OPT_BOOL,
1159 .off1 = td_var_offset(unlink),
1160 .help = "Unlink created files after job has completed",
1165 .type = FIO_OPT_STR_SET,
1166 .cb = str_exitall_cb,
1167 .help = "Terminate all jobs when one exits",
1170 .name = "stonewall",
1171 .type = FIO_OPT_STR_SET,
1172 .off1 = td_var_offset(stonewall),
1173 .help = "Insert a hard barrier between this job and previous",
1176 .name = "new_group",
1177 .type = FIO_OPT_STR_SET,
1178 .off1 = td_var_offset(new_group),
1179 .help = "Mark the start of a new group (for reporting)",
1183 .type = FIO_OPT_STR_SET,
1184 .off1 = td_var_offset(use_thread),
1185 .help = "Use threads instead of forks",
1188 .name = "write_bw_log",
1189 .type = FIO_OPT_STR_SET,
1190 .off1 = td_var_offset(write_bw_log),
1191 .help = "Write log of bandwidth during run",
1194 .name = "write_lat_log",
1195 .type = FIO_OPT_STR_SET,
1196 .off1 = td_var_offset(write_lat_log),
1197 .help = "Write log of latency during run",
1200 .name = "hugepage-size",
1201 .type = FIO_OPT_STR_VAL_INT,
1202 .off1 = td_var_offset(hugepage_size),
1203 .help = "When using hugepages, specify size of each page",
1204 .def = __stringify(FIO_HUGE_PAGE),
1207 .name = "group_reporting",
1208 .type = FIO_OPT_STR_SET,
1209 .off1 = td_var_offset(group_reporting),
1210 .help = "Do reporting on a per-group basis",
1213 .name = "zero_buffers",
1214 .type = FIO_OPT_STR_SET,
1215 .off1 = td_var_offset(zero_buffers),
1216 .help = "Init IO buffers to all zeroes",
1219 .name = "refill_buffers",
1220 .type = FIO_OPT_STR_SET,
1221 .off1 = td_var_offset(refill_buffers),
1222 .help = "Refill IO buffers on every IO submit",
1224 #ifdef FIO_HAVE_DISK_UTIL
1226 .name = "disk_util",
1227 .type = FIO_OPT_BOOL,
1228 .off1 = td_var_offset(do_disk_util),
1229 .help = "Log disk utilization stats",
1238 void fio_options_dup_and_init(struct option *long_options)
1240 struct fio_option *o;
1243 options_init(options);
1246 while (long_options[i].name)
1251 long_options[i].name = o->name;
1252 long_options[i].val = FIO_GETOPT_JOB;
1253 if (o->type == FIO_OPT_STR_SET)
1254 long_options[i].has_arg = no_argument;
1256 long_options[i].has_arg = required_argument;
1260 assert(i < FIO_NR_OPTIONS);
1264 int fio_option_parse(struct thread_data *td, const char *opt)
1266 return parse_option(opt, options, td);
1269 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1271 return parse_cmd_option(opt, val, options, td);
1274 void fio_fill_default_options(struct thread_data *td)
1276 fill_default_options(td, options);
1279 int fio_show_option_help(const char *opt)
1281 return show_cmd_help(options, opt);
1284 static void __options_mem(struct thread_data *td, int alloc)
1286 struct thread_options *o = &td->o;
1287 struct fio_option *opt;
1291 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1292 if (opt->type != FIO_OPT_STR_STORE)
1295 ptr = (void *) o + opt->off1;
1298 *ptr = strdup(*ptr);
1308 * dupe FIO_OPT_STR_STORE options
1310 void options_mem_dupe(struct thread_data *td)
1312 __options_mem(td, 1);
1315 void options_mem_free(struct thread_data fio_unused *td)
1318 __options_mem(td, 0);