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;
278 if (td->o.directory) {
279 strcpy(file, td->o.directory);
284 sprintf(file + elen, "%s", fname);
291 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
292 * yet, so we can't do this check right here...
294 if (lstat(dir, &sb) < 0) {
297 log_err("fio: %s is not a directory\n", dir);
298 td_verror(td, ret, "lstat");
302 if (!S_ISDIR(sb.st_mode)) {
303 log_err("fio: %s is not a directory\n", dir);
312 static int str_filename_cb(void *data, const char *input)
314 struct thread_data *td = data;
315 char *fname, *str, *p;
317 p = str = strdup(input);
319 strip_blank_front(&str);
320 strip_blank_end(str);
322 if (!td->files_index)
325 while ((fname = strsep(&str, ":")) != NULL) {
328 if (check_dir(td, fname)) {
340 static int str_directory_cb(void *data, const char fio_unused *str)
342 struct thread_data *td = data;
345 if (lstat(td->o.directory, &sb) < 0) {
348 log_err("fio: %s is not a directory\n", td->o.directory);
349 td_verror(td, ret, "lstat");
352 if (!S_ISDIR(sb.st_mode)) {
353 log_err("fio: %s is not a directory\n", td->o.directory);
360 static int str_opendir_cb(void *data, const char fio_unused *str)
362 struct thread_data *td = data;
364 if (!td->files_index)
367 return add_dir_files(td, td->o.opendir);
370 static int str_verify_offset_cb(void *data, unsigned int *off)
372 struct thread_data *td = data;
374 if (*off && *off < sizeof(struct verify_header)) {
375 log_err("fio: verify_offset too small\n");
379 td->o.verify_offset = *off;
383 static int str_verify_pattern_cb(void *data, unsigned int *off)
385 struct thread_data *td = data;
390 td->o.verify_pattern_bytes = 1;
392 td->o.verify_pattern_bytes = 2;
394 td->o.verify_pattern_bytes = 3;
396 td->o.verify_pattern_bytes = 4;
398 td->o.verify_pattern = *off;
402 static int str_lockfile_cb(void *data, const char *str)
404 struct thread_data *td = data;
405 char *nr = get_opt_postfix(str);
407 td->o.lockfile_batch = 1;
409 td->o.lockfile_batch = atoi(nr);
414 #define __stringify_1(x) #x
415 #define __stringify(x) __stringify_1(x)
418 * Map of job/command line options
420 static struct fio_option options[] = {
422 .name = "description",
423 .type = FIO_OPT_STR_STORE,
424 .off1 = td_var_offset(description),
425 .help = "Text job description",
429 .type = FIO_OPT_STR_STORE,
430 .off1 = td_var_offset(name),
431 .help = "Name of this job",
435 .type = FIO_OPT_STR_STORE,
436 .off1 = td_var_offset(directory),
437 .cb = str_directory_cb,
438 .help = "Directory to store files in",
442 .type = FIO_OPT_STR_STORE,
443 .off1 = td_var_offset(filename),
444 .cb = str_filename_cb,
445 .help = "File(s) to use for the workload",
450 .cb = str_lockfile_cb,
451 .off1 = td_var_offset(file_lock_mode),
452 .help = "Lock file when doing IO to it",
453 .parent = "filename",
457 .oval = FILE_LOCK_NONE,
458 .help = "No file locking",
460 { .ival = "exclusive",
461 .oval = FILE_LOCK_EXCLUSIVE,
462 .help = "Exclusive file lock",
466 .oval = FILE_LOCK_READWRITE,
467 .help = "Read vs write lock",
473 .type = FIO_OPT_STR_STORE,
474 .off1 = td_var_offset(opendir),
475 .cb = str_opendir_cb,
476 .help = "Recursively add files from this directory and down",
480 .alias = "readwrite",
483 .off1 = td_var_offset(td_ddir),
484 .help = "IO direction",
488 .oval = TD_DDIR_READ,
489 .help = "Sequential read",
492 .oval = TD_DDIR_WRITE,
493 .help = "Sequential write",
495 { .ival = "randread",
496 .oval = TD_DDIR_RANDREAD,
497 .help = "Random read",
499 { .ival = "randwrite",
500 .oval = TD_DDIR_RANDWRITE,
501 .help = "Random write",
505 .help = "Sequential read and write mix",
508 .oval = TD_DDIR_RANDRW,
509 .help = "Random read and write mix"
515 .type = FIO_OPT_STR_STORE,
516 .off1 = td_var_offset(ioengine),
517 .help = "IO engine to use",
521 .help = "Use read/write",
524 .help = "Use pread/pwrite",
527 .help = "Use readv/writev",
529 #ifdef FIO_HAVE_LIBAIO
531 .help = "Linux native asynchronous IO",
534 #ifdef FIO_HAVE_POSIXAIO
535 { .ival = "posixaio",
536 .help = "POSIX asynchronous IO",
540 .help = "Memory mapped IO",
542 #ifdef FIO_HAVE_SPLICE
544 .help = "splice/vmsplice based IO",
546 { .ival = "netsplice",
547 .help = "splice/vmsplice to/from the network",
552 .help = "SCSI generic v3 IO",
556 .help = "Testing engine (no data transfer)",
559 .help = "Network IO",
561 #ifdef FIO_HAVE_SYSLET
562 { .ival = "syslet-rw",
563 .help = "syslet enabled async pread/pwrite IO",
567 .help = "CPU cycler burner engine",
569 #ifdef FIO_HAVE_GUASI
571 .help = "GUASI IO engine",
574 { .ival = "external",
575 .help = "Load external engine (append name)",
582 .off1 = td_var_offset(iodepth),
583 .help = "Amount of IO buffers to keep in flight",
588 .name = "iodepth_batch",
590 .off1 = td_var_offset(iodepth_batch),
591 .help = "Number of IO to submit in one go",
597 .name = "iodepth_low",
599 .off1 = td_var_offset(iodepth_low),
600 .help = "Low water mark for queuing depth",
605 .type = FIO_OPT_STR_VAL,
606 .off1 = td_var_offset(size),
608 .help = "Total size of device or files",
611 .name = "fill_device",
612 .type = FIO_OPT_BOOL,
613 .off1 = td_var_offset(fill_device),
614 .help = "Write until an ENOSPC error occurs",
619 .type = FIO_OPT_STR_VAL,
620 .off1 = td_var_offset(file_size_low),
621 .off2 = td_var_offset(file_size_high),
623 .help = "Size of individual files",
627 .alias = "fileoffset",
628 .type = FIO_OPT_STR_VAL,
629 .off1 = td_var_offset(start_offset),
630 .help = "Start IO from this offset",
635 .alias = "blocksize",
636 .type = FIO_OPT_STR_VAL_INT,
637 .off1 = td_var_offset(bs[DDIR_READ]),
638 .off2 = td_var_offset(bs[DDIR_WRITE]),
640 .help = "Block size unit",
646 .alias = "blocksize_range",
647 .type = FIO_OPT_RANGE,
648 .off1 = td_var_offset(min_bs[DDIR_READ]),
649 .off2 = td_var_offset(max_bs[DDIR_READ]),
650 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
651 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
653 .help = "Set block size range (in more detail than bs)",
659 .cb = str_bssplit_cb,
660 .help = "Set a specific mix of block sizes",
664 .name = "bs_unaligned",
665 .alias = "blocksize_unaligned",
666 .type = FIO_OPT_STR_SET,
667 .off1 = td_var_offset(bs_unaligned),
668 .help = "Don't sector align IO buffer sizes",
672 .name = "randrepeat",
673 .type = FIO_OPT_BOOL,
674 .off1 = td_var_offset(rand_repeatable),
675 .help = "Use repeatable random IO pattern",
680 .name = "norandommap",
681 .type = FIO_OPT_STR_SET,
682 .off1 = td_var_offset(norandommap),
683 .help = "Accept potential duplicate random blocks",
687 .name = "softrandommap",
688 .type = FIO_OPT_BOOL,
689 .off1 = td_var_offset(softrandommap),
690 .help = "Allow randommap to fail and continue witout",
691 .parent = "norandommap",
697 .off1 = td_var_offset(nr_files),
698 .help = "Split job workload between this number of files",
704 .off1 = td_var_offset(open_files),
705 .help = "Number of files to keep open at the same time",
708 .name = "file_service_type",
711 .off1 = td_var_offset(file_service_type),
712 .help = "How to select which file to service next",
716 .oval = FIO_FSERVICE_RANDOM,
717 .help = "Choose a file at random",
719 { .ival = "roundrobin",
720 .oval = FIO_FSERVICE_RR,
721 .help = "Round robin select files",
727 .name = "fadvise_hint",
728 .type = FIO_OPT_BOOL,
729 .off1 = td_var_offset(fadvise_hint),
730 .help = "Use fadvise() to advise the kernel on IO pattern",
736 .off1 = td_var_offset(fsync_blocks),
737 .help = "Issue fsync for writes every given number of blocks",
742 .type = FIO_OPT_BOOL,
743 .off1 = td_var_offset(odirect),
744 .help = "Use O_DIRECT IO (negates buffered)",
749 .type = FIO_OPT_BOOL,
750 .off1 = td_var_offset(odirect),
752 .help = "Use buffered IO (negates direct)",
757 .type = FIO_OPT_BOOL,
758 .off1 = td_var_offset(overwrite),
759 .help = "When writing, set whether to overwrite current data",
765 .off1 = td_var_offset(loops),
766 .help = "Number of times to run the job",
772 .off1 = td_var_offset(numjobs),
773 .help = "Duplicate this job this many times",
777 .name = "startdelay",
779 .off1 = td_var_offset(start_delay),
780 .help = "Only start job when this period has passed",
786 .type = FIO_OPT_STR_VAL_TIME,
787 .off1 = td_var_offset(timeout),
788 .help = "Stop workload when this amount of time has passed",
792 .name = "time_based",
793 .type = FIO_OPT_STR_SET,
794 .off1 = td_var_offset(time_based),
795 .help = "Keep running until runtime/timeout is met",
802 .off1 = td_var_offset(mem_type),
803 .help = "Backing type for IO buffers",
808 .help = "Use malloc(3) for IO buffers",
812 .help = "Use shared memory segments for IO buffers",
814 #ifdef FIO_HAVE_HUGETLB
817 .help = "Like shm, but use huge pages",
822 .help = "Use mmap(2) (file or anon) for IO buffers",
824 #ifdef FIO_HAVE_HUGETLB
825 { .ival = "mmaphuge",
826 .oval = MEM_MMAPHUGE,
827 .help = "Like mmap, but use huge pages",
835 .off1 = td_var_offset(verify),
836 .help = "Verify data written",
841 .help = "Don't do IO verification",
845 .help = "Use md5 checksums for verification",
848 .oval = VERIFY_CRC64,
849 .help = "Use crc64 checksums for verification",
852 .oval = VERIFY_CRC32,
853 .help = "Use crc32 checksums for verification",
856 .oval = VERIFY_CRC16,
857 .help = "Use crc16 checksums for verification",
861 .help = "Use crc7 checksums for verification",
864 .oval = VERIFY_SHA256,
865 .help = "Use sha256 checksums for verification",
868 .oval = VERIFY_SHA512,
869 .help = "Use sha512 checksums for verification",
873 .help = "Use io information",
878 .help = "Pretend to verify",
884 .type = FIO_OPT_BOOL,
885 .off1 = td_var_offset(do_verify),
886 .help = "Run verification stage after write",
891 .name = "verifysort",
892 .type = FIO_OPT_BOOL,
893 .off1 = td_var_offset(verifysort),
894 .help = "Sort written verify blocks for read back",
899 .name = "verify_interval",
900 .type = FIO_OPT_STR_VAL_INT,
901 .off1 = td_var_offset(verify_interval),
902 .minval = 2 * sizeof(struct verify_header),
903 .help = "Store verify buffer header every N bytes",
907 .name = "verify_offset",
908 .type = FIO_OPT_STR_VAL_INT,
909 .help = "Offset verify header location by N bytes",
911 .cb = str_verify_offset_cb,
915 .name = "verify_pattern",
917 .cb = str_verify_pattern_cb,
918 .help = "Fill pattern for IO buffers",
922 .name = "verify_fatal",
923 .type = FIO_OPT_BOOL,
924 .off1 = td_var_offset(verify_fatal),
926 .help = "Exit on a single verify failure, don't continue",
930 .name = "write_iolog",
931 .type = FIO_OPT_STR_STORE,
932 .off1 = td_var_offset(write_iolog_file),
933 .help = "Store IO pattern to file",
936 .name = "read_iolog",
937 .type = FIO_OPT_STR_STORE,
938 .off1 = td_var_offset(read_iolog_file),
939 .help = "Playback IO pattern from file",
942 .name = "exec_prerun",
943 .type = FIO_OPT_STR_STORE,
944 .off1 = td_var_offset(exec_prerun),
945 .help = "Execute this file prior to running job",
948 .name = "exec_postrun",
949 .type = FIO_OPT_STR_STORE,
950 .off1 = td_var_offset(exec_postrun),
951 .help = "Execute this file after running job",
953 #ifdef FIO_HAVE_IOSCHED_SWITCH
955 .name = "ioscheduler",
956 .type = FIO_OPT_STR_STORE,
957 .off1 = td_var_offset(ioscheduler),
958 .help = "Use this IO scheduler on the backing device",
963 .type = FIO_OPT_STR_VAL,
964 .off1 = td_var_offset(zone_size),
965 .help = "Give size of an IO zone",
970 .type = FIO_OPT_STR_VAL,
971 .off1 = td_var_offset(zone_skip),
972 .help = "Space between IO zones",
977 .type = FIO_OPT_STR_VAL,
978 .cb = str_lockmem_cb,
979 .help = "Lock down this amount of memory",
985 .off1 = td_var_offset(rwmix[DDIR_READ]),
987 .help = "Percentage of mixed workload that is reads",
991 .name = "rwmixwrite",
993 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
995 .help = "Percentage of mixed workload that is writes",
999 .name = "rwmixcycle",
1000 .type = FIO_OPT_DEPRECATED,
1004 .type = FIO_OPT_INT,
1005 .off1 = td_var_offset(nice),
1006 .help = "Set job CPU nice value",
1011 #ifdef FIO_HAVE_IOPRIO
1014 .type = FIO_OPT_INT,
1016 .help = "Set job IO priority value",
1021 .name = "prioclass",
1022 .type = FIO_OPT_INT,
1023 .cb = str_prioclass_cb,
1024 .help = "Set job IO priority class",
1030 .name = "thinktime",
1031 .type = FIO_OPT_INT,
1032 .off1 = td_var_offset(thinktime),
1033 .help = "Idle time between IO buffers (usec)",
1037 .name = "thinktime_spin",
1038 .type = FIO_OPT_INT,
1039 .off1 = td_var_offset(thinktime_spin),
1040 .help = "Start think time by spinning this amount (usec)",
1042 .parent = "thinktime",
1045 .name = "thinktime_blocks",
1046 .type = FIO_OPT_INT,
1047 .off1 = td_var_offset(thinktime_blocks),
1048 .help = "IO buffer period between 'thinktime'",
1050 .parent = "thinktime",
1054 .type = FIO_OPT_INT,
1055 .off1 = td_var_offset(rate),
1056 .help = "Set bandwidth rate",
1060 .type = FIO_OPT_INT,
1061 .off1 = td_var_offset(ratemin),
1062 .help = "Job must meet this rate or it will be shutdown",
1066 .name = "rate_iops",
1067 .type = FIO_OPT_INT,
1068 .off1 = td_var_offset(rate_iops),
1069 .help = "Limit IO used to this number of IO operations/sec",
1072 .name = "rate_iops_min",
1073 .type = FIO_OPT_INT,
1074 .off1 = td_var_offset(rate_iops_min),
1075 .help = "Job must meet this rate or it will be shutdown",
1076 .parent = "rate_iops",
1079 .name = "ratecycle",
1080 .type = FIO_OPT_INT,
1081 .off1 = td_var_offset(ratecycle),
1082 .help = "Window average for rate limits (msec)",
1087 .name = "invalidate",
1088 .type = FIO_OPT_BOOL,
1089 .off1 = td_var_offset(invalidate_cache),
1090 .help = "Invalidate buffer/page cache prior to running job",
1095 .type = FIO_OPT_BOOL,
1096 .off1 = td_var_offset(sync_io),
1097 .help = "Use O_SYNC for buffered writes",
1099 .parent = "buffered",
1102 .name = "bwavgtime",
1103 .type = FIO_OPT_INT,
1104 .off1 = td_var_offset(bw_avg_time),
1105 .help = "Time window over which to calculate bandwidth"
1110 .name = "create_serialize",
1111 .type = FIO_OPT_BOOL,
1112 .off1 = td_var_offset(create_serialize),
1113 .help = "Serialize creating of job files",
1117 .name = "create_fsync",
1118 .type = FIO_OPT_BOOL,
1119 .off1 = td_var_offset(create_fsync),
1120 .help = "Fsync file after creation",
1125 .type = FIO_OPT_INT,
1126 .off1 = td_var_offset(cpuload),
1127 .help = "Use this percentage of CPU",
1130 .name = "cpuchunks",
1131 .type = FIO_OPT_INT,
1132 .off1 = td_var_offset(cpucycle),
1133 .help = "Length of the CPU burn cycles (usecs)",
1135 .parent = "cpuload",
1137 #ifdef FIO_HAVE_CPU_AFFINITY
1140 .type = FIO_OPT_INT,
1141 .cb = str_cpumask_cb,
1142 .help = "CPU affinity mask",
1145 .name = "cpus_allowed",
1146 .type = FIO_OPT_STR,
1147 .cb = str_cpus_allowed_cb,
1148 .help = "Set CPUs allowed",
1152 .name = "end_fsync",
1153 .type = FIO_OPT_BOOL,
1154 .off1 = td_var_offset(end_fsync),
1155 .help = "Include fsync at the end of job",
1159 .name = "fsync_on_close",
1160 .type = FIO_OPT_BOOL,
1161 .off1 = td_var_offset(fsync_on_close),
1162 .help = "fsync files on close",
1167 .type = FIO_OPT_BOOL,
1168 .off1 = td_var_offset(unlink),
1169 .help = "Unlink created files after job has completed",
1174 .type = FIO_OPT_STR_SET,
1175 .cb = str_exitall_cb,
1176 .help = "Terminate all jobs when one exits",
1179 .name = "stonewall",
1180 .type = FIO_OPT_STR_SET,
1181 .off1 = td_var_offset(stonewall),
1182 .help = "Insert a hard barrier between this job and previous",
1185 .name = "new_group",
1186 .type = FIO_OPT_STR_SET,
1187 .off1 = td_var_offset(new_group),
1188 .help = "Mark the start of a new group (for reporting)",
1192 .type = FIO_OPT_STR_SET,
1193 .off1 = td_var_offset(use_thread),
1194 .help = "Use threads instead of forks",
1197 .name = "write_bw_log",
1198 .type = FIO_OPT_STR_SET,
1199 .off1 = td_var_offset(write_bw_log),
1200 .help = "Write log of bandwidth during run",
1203 .name = "write_lat_log",
1204 .type = FIO_OPT_STR_SET,
1205 .off1 = td_var_offset(write_lat_log),
1206 .help = "Write log of latency during run",
1209 .name = "hugepage-size",
1210 .type = FIO_OPT_STR_VAL_INT,
1211 .off1 = td_var_offset(hugepage_size),
1212 .help = "When using hugepages, specify size of each page",
1213 .def = __stringify(FIO_HUGE_PAGE),
1216 .name = "group_reporting",
1217 .type = FIO_OPT_STR_SET,
1218 .off1 = td_var_offset(group_reporting),
1219 .help = "Do reporting on a per-group basis",
1222 .name = "zero_buffers",
1223 .type = FIO_OPT_STR_SET,
1224 .off1 = td_var_offset(zero_buffers),
1225 .help = "Init IO buffers to all zeroes",
1228 .name = "refill_buffers",
1229 .type = FIO_OPT_STR_SET,
1230 .off1 = td_var_offset(refill_buffers),
1231 .help = "Refill IO buffers on every IO submit",
1233 #ifdef FIO_HAVE_DISK_UTIL
1235 .name = "disk_util",
1236 .type = FIO_OPT_BOOL,
1237 .off1 = td_var_offset(do_disk_util),
1238 .help = "Log disk utilization stats",
1247 void fio_options_dup_and_init(struct option *long_options)
1249 struct fio_option *o;
1252 options_init(options);
1255 while (long_options[i].name)
1260 long_options[i].name = o->name;
1261 long_options[i].val = FIO_GETOPT_JOB;
1262 if (o->type == FIO_OPT_STR_SET)
1263 long_options[i].has_arg = no_argument;
1265 long_options[i].has_arg = required_argument;
1269 assert(i < FIO_NR_OPTIONS);
1273 int fio_option_parse(struct thread_data *td, const char *opt)
1275 return parse_option(opt, options, td);
1278 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1280 return parse_cmd_option(opt, val, options, td);
1283 void fio_fill_default_options(struct thread_data *td)
1285 fill_default_options(td, options);
1288 int fio_show_option_help(const char *opt)
1290 return show_cmd_help(options, opt);
1293 static void __options_mem(struct thread_data *td, int alloc)
1295 struct thread_options *o = &td->o;
1296 struct fio_option *opt;
1300 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1301 if (opt->type != FIO_OPT_STR_STORE)
1304 ptr = (void *) o + opt->off1;
1307 *ptr = strdup(*ptr);
1317 * dupe FIO_OPT_STR_STORE options
1319 void options_mem_dupe(struct thread_data *td)
1321 __options_mem(td, 1);
1324 void options_mem_free(struct thread_data fio_unused *td)
1327 __options_mem(td, 0);