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;
281 if (lstat(dir, &sb) < 0) {
284 log_err("fio: %s is not a directory\n", dir);
285 td_verror(td, ret, "lstat");
289 if (!S_ISDIR(sb.st_mode)) {
290 log_err("fio: %s is not a directory\n", dir);
297 static int str_filename_cb(void *data, const char *input)
299 struct thread_data *td = data;
300 char *fname, *str, *p;
302 p = str = strdup(input);
304 strip_blank_front(&str);
305 strip_blank_end(str);
307 if (!td->files_index)
310 while ((fname = strsep(&str, ":")) != NULL) {
313 if (check_dir(td, fname)) {
325 static int str_directory_cb(void *data, const char fio_unused *str)
327 struct thread_data *td = data;
330 if (lstat(td->o.directory, &sb) < 0) {
333 log_err("fio: %s is not a directory\n", td->o.directory);
334 td_verror(td, ret, "lstat");
337 if (!S_ISDIR(sb.st_mode)) {
338 log_err("fio: %s is not a directory\n", td->o.directory);
345 static int str_opendir_cb(void *data, const char fio_unused *str)
347 struct thread_data *td = data;
349 if (!td->files_index)
352 return add_dir_files(td, td->o.opendir);
355 static int str_verify_offset_cb(void *data, unsigned int *off)
357 struct thread_data *td = data;
359 if (*off && *off < sizeof(struct verify_header)) {
360 log_err("fio: verify_offset too small\n");
364 td->o.verify_offset = *off;
368 static int str_verify_pattern_cb(void *data, unsigned int *off)
370 struct thread_data *td = data;
375 td->o.verify_pattern_bytes = 1;
377 td->o.verify_pattern_bytes = 2;
379 td->o.verify_pattern_bytes = 3;
381 td->o.verify_pattern_bytes = 4;
383 td->o.verify_pattern = *off;
387 static int str_lockfile_cb(void *data, const char *str)
389 struct thread_data *td = data;
390 char *nr = get_opt_postfix(str);
392 td->o.lockfile_batch = 1;
394 td->o.lockfile_batch = atoi(nr);
399 #define __stringify_1(x) #x
400 #define __stringify(x) __stringify_1(x)
403 * Map of job/command line options
405 static struct fio_option options[] = {
407 .name = "description",
408 .type = FIO_OPT_STR_STORE,
409 .off1 = td_var_offset(description),
410 .help = "Text job description",
414 .type = FIO_OPT_STR_STORE,
415 .off1 = td_var_offset(name),
416 .help = "Name of this job",
420 .type = FIO_OPT_STR_STORE,
421 .off1 = td_var_offset(directory),
422 .cb = str_directory_cb,
423 .help = "Directory to store files in",
427 .type = FIO_OPT_STR_STORE,
428 .off1 = td_var_offset(filename),
429 .cb = str_filename_cb,
430 .help = "File(s) to use for the workload",
435 .cb = str_lockfile_cb,
436 .off1 = td_var_offset(file_lock_mode),
437 .help = "Lock file when doing IO to it",
438 .parent = "filename",
442 .oval = FILE_LOCK_NONE,
443 .help = "No file locking",
445 { .ival = "exclusive",
446 .oval = FILE_LOCK_EXCLUSIVE,
447 .help = "Exclusive file lock",
451 .oval = FILE_LOCK_READWRITE,
452 .help = "Read vs write lock",
458 .type = FIO_OPT_STR_STORE,
459 .off1 = td_var_offset(opendir),
460 .cb = str_opendir_cb,
461 .help = "Recursively add files from this directory and down",
465 .alias = "readwrite",
468 .off1 = td_var_offset(td_ddir),
469 .help = "IO direction",
473 .oval = TD_DDIR_READ,
474 .help = "Sequential read",
477 .oval = TD_DDIR_WRITE,
478 .help = "Sequential write",
480 { .ival = "randread",
481 .oval = TD_DDIR_RANDREAD,
482 .help = "Random read",
484 { .ival = "randwrite",
485 .oval = TD_DDIR_RANDWRITE,
486 .help = "Random write",
490 .help = "Sequential read and write mix",
493 .oval = TD_DDIR_RANDRW,
494 .help = "Random read and write mix"
500 .type = FIO_OPT_STR_STORE,
501 .off1 = td_var_offset(ioengine),
502 .help = "IO engine to use",
506 .help = "Use read/write",
509 .help = "Use pread/pwrite",
512 .help = "Use readv/writev",
514 #ifdef FIO_HAVE_LIBAIO
516 .help = "Linux native asynchronous IO",
519 #ifdef FIO_HAVE_POSIXAIO
520 { .ival = "posixaio",
521 .help = "POSIX asynchronous IO",
525 .help = "Memory mapped IO",
527 #ifdef FIO_HAVE_SPLICE
529 .help = "splice/vmsplice based IO",
531 { .ival = "netsplice",
532 .help = "splice/vmsplice to/from the network",
537 .help = "SCSI generic v3 IO",
541 .help = "Testing engine (no data transfer)",
544 .help = "Network IO",
546 #ifdef FIO_HAVE_SYSLET
547 { .ival = "syslet-rw",
548 .help = "syslet enabled async pread/pwrite IO",
552 .help = "CPU cycler burner engine",
554 #ifdef FIO_HAVE_GUASI
556 .help = "GUASI IO engine",
559 { .ival = "external",
560 .help = "Load external engine (append name)",
567 .off1 = td_var_offset(iodepth),
568 .help = "Amount of IO buffers to keep in flight",
573 .name = "iodepth_batch",
575 .off1 = td_var_offset(iodepth_batch),
576 .help = "Number of IO to submit in one go",
582 .name = "iodepth_low",
584 .off1 = td_var_offset(iodepth_low),
585 .help = "Low water mark for queuing depth",
590 .type = FIO_OPT_STR_VAL,
591 .off1 = td_var_offset(size),
593 .help = "Total size of device or files",
596 .name = "fill_device",
597 .type = FIO_OPT_BOOL,
598 .off1 = td_var_offset(fill_device),
599 .help = "Write until an ENOSPC error occurs",
604 .type = FIO_OPT_STR_VAL,
605 .off1 = td_var_offset(file_size_low),
606 .off2 = td_var_offset(file_size_high),
608 .help = "Size of individual files",
612 .alias = "fileoffset",
613 .type = FIO_OPT_STR_VAL,
614 .off1 = td_var_offset(start_offset),
615 .help = "Start IO from this offset",
620 .alias = "blocksize",
621 .type = FIO_OPT_STR_VAL_INT,
622 .off1 = td_var_offset(bs[DDIR_READ]),
623 .off2 = td_var_offset(bs[DDIR_WRITE]),
625 .help = "Block size unit",
631 .alias = "blocksize_range",
632 .type = FIO_OPT_RANGE,
633 .off1 = td_var_offset(min_bs[DDIR_READ]),
634 .off2 = td_var_offset(max_bs[DDIR_READ]),
635 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
636 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
638 .help = "Set block size range (in more detail than bs)",
644 .cb = str_bssplit_cb,
645 .help = "Set a specific mix of block sizes",
649 .name = "bs_unaligned",
650 .alias = "blocksize_unaligned",
651 .type = FIO_OPT_STR_SET,
652 .off1 = td_var_offset(bs_unaligned),
653 .help = "Don't sector align IO buffer sizes",
657 .name = "randrepeat",
658 .type = FIO_OPT_BOOL,
659 .off1 = td_var_offset(rand_repeatable),
660 .help = "Use repeatable random IO pattern",
665 .name = "norandommap",
666 .type = FIO_OPT_STR_SET,
667 .off1 = td_var_offset(norandommap),
668 .help = "Accept potential duplicate random blocks",
672 .name = "softrandommap",
673 .type = FIO_OPT_BOOL,
674 .off1 = td_var_offset(softrandommap),
675 .help = "Allow randommap to fail and continue witout",
676 .parent = "norandommap",
682 .off1 = td_var_offset(nr_files),
683 .help = "Split job workload between this number of files",
689 .off1 = td_var_offset(open_files),
690 .help = "Number of files to keep open at the same time",
693 .name = "file_service_type",
696 .off1 = td_var_offset(file_service_type),
697 .help = "How to select which file to service next",
701 .oval = FIO_FSERVICE_RANDOM,
702 .help = "Choose a file at random",
704 { .ival = "roundrobin",
705 .oval = FIO_FSERVICE_RR,
706 .help = "Round robin select files",
712 .name = "fadvise_hint",
713 .type = FIO_OPT_BOOL,
714 .off1 = td_var_offset(fadvise_hint),
715 .help = "Use fadvise() to advise the kernel on IO pattern",
721 .off1 = td_var_offset(fsync_blocks),
722 .help = "Issue fsync for writes every given number of blocks",
727 .type = FIO_OPT_BOOL,
728 .off1 = td_var_offset(odirect),
729 .help = "Use O_DIRECT IO (negates buffered)",
734 .type = FIO_OPT_BOOL,
735 .off1 = td_var_offset(odirect),
737 .help = "Use buffered IO (negates direct)",
742 .type = FIO_OPT_BOOL,
743 .off1 = td_var_offset(overwrite),
744 .help = "When writing, set whether to overwrite current data",
750 .off1 = td_var_offset(loops),
751 .help = "Number of times to run the job",
757 .off1 = td_var_offset(numjobs),
758 .help = "Duplicate this job this many times",
762 .name = "startdelay",
764 .off1 = td_var_offset(start_delay),
765 .help = "Only start job when this period has passed",
771 .type = FIO_OPT_STR_VAL_TIME,
772 .off1 = td_var_offset(timeout),
773 .help = "Stop workload when this amount of time has passed",
777 .name = "time_based",
778 .type = FIO_OPT_STR_SET,
779 .off1 = td_var_offset(time_based),
780 .help = "Keep running until runtime/timeout is met",
787 .off1 = td_var_offset(mem_type),
788 .help = "Backing type for IO buffers",
793 .help = "Use malloc(3) for IO buffers",
797 .help = "Use shared memory segments for IO buffers",
799 #ifdef FIO_HAVE_HUGETLB
802 .help = "Like shm, but use huge pages",
807 .help = "Use mmap(2) (file or anon) for IO buffers",
809 #ifdef FIO_HAVE_HUGETLB
810 { .ival = "mmaphuge",
811 .oval = MEM_MMAPHUGE,
812 .help = "Like mmap, but use huge pages",
820 .off1 = td_var_offset(verify),
821 .help = "Verify data written",
826 .help = "Don't do IO verification",
830 .help = "Use md5 checksums for verification",
833 .oval = VERIFY_CRC64,
834 .help = "Use crc64 checksums for verification",
837 .oval = VERIFY_CRC32,
838 .help = "Use crc32 checksums for verification",
841 .oval = VERIFY_CRC16,
842 .help = "Use crc16 checksums for verification",
846 .help = "Use crc7 checksums for verification",
849 .oval = VERIFY_SHA256,
850 .help = "Use sha256 checksums for verification",
853 .oval = VERIFY_SHA512,
854 .help = "Use sha512 checksums for verification",
858 .help = "Use io information",
863 .help = "Pretend to verify",
869 .type = FIO_OPT_BOOL,
870 .off1 = td_var_offset(do_verify),
871 .help = "Run verification stage after write",
876 .name = "verifysort",
877 .type = FIO_OPT_BOOL,
878 .off1 = td_var_offset(verifysort),
879 .help = "Sort written verify blocks for read back",
884 .name = "verify_interval",
885 .type = FIO_OPT_STR_VAL_INT,
886 .off1 = td_var_offset(verify_interval),
887 .minval = 2 * sizeof(struct verify_header),
888 .help = "Store verify buffer header every N bytes",
892 .name = "verify_offset",
893 .type = FIO_OPT_STR_VAL_INT,
894 .help = "Offset verify header location by N bytes",
896 .cb = str_verify_offset_cb,
900 .name = "verify_pattern",
902 .cb = str_verify_pattern_cb,
903 .help = "Fill pattern for IO buffers",
907 .name = "verify_fatal",
908 .type = FIO_OPT_BOOL,
909 .off1 = td_var_offset(verify_fatal),
911 .help = "Exit on a single verify failure, don't continue",
915 .name = "write_iolog",
916 .type = FIO_OPT_STR_STORE,
917 .off1 = td_var_offset(write_iolog_file),
918 .help = "Store IO pattern to file",
921 .name = "read_iolog",
922 .type = FIO_OPT_STR_STORE,
923 .off1 = td_var_offset(read_iolog_file),
924 .help = "Playback IO pattern from file",
927 .name = "exec_prerun",
928 .type = FIO_OPT_STR_STORE,
929 .off1 = td_var_offset(exec_prerun),
930 .help = "Execute this file prior to running job",
933 .name = "exec_postrun",
934 .type = FIO_OPT_STR_STORE,
935 .off1 = td_var_offset(exec_postrun),
936 .help = "Execute this file after running job",
938 #ifdef FIO_HAVE_IOSCHED_SWITCH
940 .name = "ioscheduler",
941 .type = FIO_OPT_STR_STORE,
942 .off1 = td_var_offset(ioscheduler),
943 .help = "Use this IO scheduler on the backing device",
948 .type = FIO_OPT_STR_VAL,
949 .off1 = td_var_offset(zone_size),
950 .help = "Give size of an IO zone",
955 .type = FIO_OPT_STR_VAL,
956 .off1 = td_var_offset(zone_skip),
957 .help = "Space between IO zones",
962 .type = FIO_OPT_STR_VAL,
963 .cb = str_lockmem_cb,
964 .help = "Lock down this amount of memory",
970 .off1 = td_var_offset(rwmix[DDIR_READ]),
972 .help = "Percentage of mixed workload that is reads",
976 .name = "rwmixwrite",
978 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
980 .help = "Percentage of mixed workload that is writes",
984 .name = "rwmixcycle",
986 .off1 = td_var_offset(rwmixcycle),
987 .help = "Cycle period for mixed read/write workloads (msec)",
989 .parent = "rwmixread",
994 .off1 = td_var_offset(nice),
995 .help = "Set job CPU nice value",
1000 #ifdef FIO_HAVE_IOPRIO
1003 .type = FIO_OPT_INT,
1005 .help = "Set job IO priority value",
1010 .name = "prioclass",
1011 .type = FIO_OPT_INT,
1012 .cb = str_prioclass_cb,
1013 .help = "Set job IO priority class",
1019 .name = "thinktime",
1020 .type = FIO_OPT_INT,
1021 .off1 = td_var_offset(thinktime),
1022 .help = "Idle time between IO buffers (usec)",
1026 .name = "thinktime_spin",
1027 .type = FIO_OPT_INT,
1028 .off1 = td_var_offset(thinktime_spin),
1029 .help = "Start think time by spinning this amount (usec)",
1031 .parent = "thinktime",
1034 .name = "thinktime_blocks",
1035 .type = FIO_OPT_INT,
1036 .off1 = td_var_offset(thinktime_blocks),
1037 .help = "IO buffer period between 'thinktime'",
1039 .parent = "thinktime",
1043 .type = FIO_OPT_INT,
1044 .off1 = td_var_offset(rate),
1045 .help = "Set bandwidth rate",
1049 .type = FIO_OPT_INT,
1050 .off1 = td_var_offset(ratemin),
1051 .help = "Job must meet this rate or it will be shutdown",
1055 .name = "rate_iops",
1056 .type = FIO_OPT_INT,
1057 .off1 = td_var_offset(rate_iops),
1058 .help = "Limit IO used to this number of IO operations/sec",
1061 .name = "rate_iops_min",
1062 .type = FIO_OPT_INT,
1063 .off1 = td_var_offset(rate_iops_min),
1064 .help = "Job must meet this rate or it will be shutdown",
1065 .parent = "rate_iops",
1068 .name = "ratecycle",
1069 .type = FIO_OPT_INT,
1070 .off1 = td_var_offset(ratecycle),
1071 .help = "Window average for rate limits (msec)",
1076 .name = "invalidate",
1077 .type = FIO_OPT_BOOL,
1078 .off1 = td_var_offset(invalidate_cache),
1079 .help = "Invalidate buffer/page cache prior to running job",
1084 .type = FIO_OPT_BOOL,
1085 .off1 = td_var_offset(sync_io),
1086 .help = "Use O_SYNC for buffered writes",
1088 .parent = "buffered",
1091 .name = "bwavgtime",
1092 .type = FIO_OPT_INT,
1093 .off1 = td_var_offset(bw_avg_time),
1094 .help = "Time window over which to calculate bandwidth"
1099 .name = "create_serialize",
1100 .type = FIO_OPT_BOOL,
1101 .off1 = td_var_offset(create_serialize),
1102 .help = "Serialize creating of job files",
1106 .name = "create_fsync",
1107 .type = FIO_OPT_BOOL,
1108 .off1 = td_var_offset(create_fsync),
1109 .help = "Fsync file after creation",
1114 .type = FIO_OPT_INT,
1115 .off1 = td_var_offset(cpuload),
1116 .help = "Use this percentage of CPU",
1119 .name = "cpuchunks",
1120 .type = FIO_OPT_INT,
1121 .off1 = td_var_offset(cpucycle),
1122 .help = "Length of the CPU burn cycles (usecs)",
1124 .parent = "cpuload",
1126 #ifdef FIO_HAVE_CPU_AFFINITY
1129 .type = FIO_OPT_INT,
1130 .cb = str_cpumask_cb,
1131 .help = "CPU affinity mask",
1134 .name = "cpus_allowed",
1135 .type = FIO_OPT_STR,
1136 .cb = str_cpus_allowed_cb,
1137 .help = "Set CPUs allowed",
1141 .name = "end_fsync",
1142 .type = FIO_OPT_BOOL,
1143 .off1 = td_var_offset(end_fsync),
1144 .help = "Include fsync at the end of job",
1148 .name = "fsync_on_close",
1149 .type = FIO_OPT_BOOL,
1150 .off1 = td_var_offset(fsync_on_close),
1151 .help = "fsync files on close",
1156 .type = FIO_OPT_BOOL,
1157 .off1 = td_var_offset(unlink),
1158 .help = "Unlink created files after job has completed",
1163 .type = FIO_OPT_STR_SET,
1164 .cb = str_exitall_cb,
1165 .help = "Terminate all jobs when one exits",
1168 .name = "stonewall",
1169 .type = FIO_OPT_STR_SET,
1170 .off1 = td_var_offset(stonewall),
1171 .help = "Insert a hard barrier between this job and previous",
1174 .name = "new_group",
1175 .type = FIO_OPT_STR_SET,
1176 .off1 = td_var_offset(new_group),
1177 .help = "Mark the start of a new group (for reporting)",
1181 .type = FIO_OPT_STR_SET,
1182 .off1 = td_var_offset(use_thread),
1183 .help = "Use threads instead of forks",
1186 .name = "write_bw_log",
1187 .type = FIO_OPT_STR_SET,
1188 .off1 = td_var_offset(write_bw_log),
1189 .help = "Write log of bandwidth during run",
1192 .name = "write_lat_log",
1193 .type = FIO_OPT_STR_SET,
1194 .off1 = td_var_offset(write_lat_log),
1195 .help = "Write log of latency during run",
1198 .name = "hugepage-size",
1199 .type = FIO_OPT_STR_VAL_INT,
1200 .off1 = td_var_offset(hugepage_size),
1201 .help = "When using hugepages, specify size of each page",
1202 .def = __stringify(FIO_HUGE_PAGE),
1205 .name = "group_reporting",
1206 .type = FIO_OPT_STR_SET,
1207 .off1 = td_var_offset(group_reporting),
1208 .help = "Do reporting on a per-group basis",
1211 .name = "zero_buffers",
1212 .type = FIO_OPT_STR_SET,
1213 .off1 = td_var_offset(zero_buffers),
1214 .help = "Init IO buffers to all zeroes",
1216 #ifdef FIO_HAVE_DISK_UTIL
1218 .name = "disk_util",
1219 .type = FIO_OPT_BOOL,
1220 .off1 = td_var_offset(do_disk_util),
1221 .help = "Log disk utilization stats",
1230 void fio_options_dup_and_init(struct option *long_options)
1232 struct fio_option *o;
1235 options_init(options);
1238 while (long_options[i].name)
1243 long_options[i].name = o->name;
1244 long_options[i].val = FIO_GETOPT_JOB;
1245 if (o->type == FIO_OPT_STR_SET)
1246 long_options[i].has_arg = no_argument;
1248 long_options[i].has_arg = required_argument;
1252 assert(i < FIO_NR_OPTIONS);
1256 int fio_option_parse(struct thread_data *td, const char *opt)
1258 return parse_option(opt, options, td);
1261 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1263 return parse_cmd_option(opt, val, options, td);
1266 void fio_fill_default_options(struct thread_data *td)
1268 fill_default_options(td, options);
1271 int fio_show_option_help(const char *opt)
1273 return show_cmd_help(options, opt);
1276 static void __options_mem(struct thread_data *td, int alloc)
1278 struct thread_options *o = &td->o;
1279 struct fio_option *opt;
1283 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1284 if (opt->type != FIO_OPT_STR_STORE)
1287 ptr = (void *) o + opt->off1;
1290 *ptr = strdup(*ptr);
1300 * dupe FIO_OPT_STR_STORE options
1302 void options_mem_dupe(struct thread_data *td)
1304 __options_mem(td, 1);
1307 void options_mem_free(struct thread_data fio_unused *td)
1310 __options_mem(td, 0);