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 static int str_rwmix_read_cb(void *data, unsigned int *val)
183 struct thread_data *td = data;
185 td->o.rwmix[DDIR_READ] = *val;
186 td->o.rwmix[DDIR_WRITE] = 100 - *val;
190 static int str_rwmix_write_cb(void *data, unsigned int *val)
192 struct thread_data *td = data;
194 td->o.rwmix[DDIR_WRITE] = *val;
195 td->o.rwmix[DDIR_READ] = 100 - *val;
199 #ifdef FIO_HAVE_IOPRIO
200 static int str_prioclass_cb(void *data, unsigned int *val)
202 struct thread_data *td = data;
206 * mask off old class bits, str_prio_cb() may have set a default class
208 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
211 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
216 static int str_prio_cb(void *data, unsigned int *val)
218 struct thread_data *td = data;
223 * If no class is set, assume BE
225 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
226 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
233 static int str_exitall_cb(void)
235 exitall_on_terminate = 1;
239 #ifdef FIO_HAVE_CPU_AFFINITY
240 static int str_cpumask_cb(void *data, unsigned int *val)
242 struct thread_data *td = data;
245 CPU_ZERO(&td->o.cpumask);
247 for (i = 0; i < sizeof(int) * 8; i++)
249 CPU_SET(*val, &td->o.cpumask);
251 td->o.cpumask_set = 1;
255 static int str_cpus_allowed_cb(void *data, const char *input)
257 struct thread_data *td = data;
260 CPU_ZERO(&td->o.cpumask);
262 p = str = strdup(input);
264 strip_blank_front(&str);
265 strip_blank_end(str);
267 while ((cpu = strsep(&str, ",")) != NULL) {
270 CPU_SET(atoi(cpu), &td->o.cpumask);
274 td->o.cpumask_set = 1;
279 static int str_fst_cb(void *data, const char *str)
281 struct thread_data *td = data;
282 char *nr = get_opt_postfix(str);
284 td->file_service_nr = 1;
286 td->file_service_nr = atoi(nr);
291 static int check_dir(struct thread_data *td, char *fname)
293 char file[PATH_MAX], *dir;
296 if (td->o.directory) {
297 strcpy(file, td->o.directory);
302 sprintf(file + elen, "%s", fname);
309 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
310 * yet, so we can't do this check right here...
312 if (lstat(dir, &sb) < 0) {
315 log_err("fio: %s is not a directory\n", dir);
316 td_verror(td, ret, "lstat");
320 if (!S_ISDIR(sb.st_mode)) {
321 log_err("fio: %s is not a directory\n", dir);
330 static int str_filename_cb(void *data, const char *input)
332 struct thread_data *td = data;
333 char *fname, *str, *p;
335 p = str = strdup(input);
337 strip_blank_front(&str);
338 strip_blank_end(str);
340 if (!td->files_index)
343 while ((fname = strsep(&str, ":")) != NULL) {
346 if (check_dir(td, fname)) {
358 static int str_directory_cb(void *data, const char fio_unused *str)
360 struct thread_data *td = data;
363 if (lstat(td->o.directory, &sb) < 0) {
366 log_err("fio: %s is not a directory\n", td->o.directory);
367 td_verror(td, ret, "lstat");
370 if (!S_ISDIR(sb.st_mode)) {
371 log_err("fio: %s is not a directory\n", td->o.directory);
378 static int str_opendir_cb(void *data, const char fio_unused *str)
380 struct thread_data *td = data;
382 if (!td->files_index)
385 return add_dir_files(td, td->o.opendir);
388 static int str_verify_offset_cb(void *data, unsigned int *off)
390 struct thread_data *td = data;
392 if (*off && *off < sizeof(struct verify_header)) {
393 log_err("fio: verify_offset too small\n");
397 td->o.verify_offset = *off;
401 static int str_verify_pattern_cb(void *data, unsigned int *off)
403 struct thread_data *td = data;
408 td->o.verify_pattern_bytes = 1;
410 td->o.verify_pattern_bytes = 2;
412 td->o.verify_pattern_bytes = 3;
414 td->o.verify_pattern_bytes = 4;
416 td->o.verify_pattern = *off;
420 static int str_lockfile_cb(void *data, const char *str)
422 struct thread_data *td = data;
423 char *nr = get_opt_postfix(str);
425 td->o.lockfile_batch = 1;
427 td->o.lockfile_batch = atoi(nr);
432 #define __stringify_1(x) #x
433 #define __stringify(x) __stringify_1(x)
436 * Map of job/command line options
438 static struct fio_option options[] = {
440 .name = "description",
441 .type = FIO_OPT_STR_STORE,
442 .off1 = td_var_offset(description),
443 .help = "Text job description",
447 .type = FIO_OPT_STR_STORE,
448 .off1 = td_var_offset(name),
449 .help = "Name of this job",
453 .type = FIO_OPT_STR_STORE,
454 .off1 = td_var_offset(directory),
455 .cb = str_directory_cb,
456 .help = "Directory to store files in",
460 .type = FIO_OPT_STR_STORE,
461 .off1 = td_var_offset(filename),
462 .cb = str_filename_cb,
463 .help = "File(s) to use for the workload",
468 .cb = str_lockfile_cb,
469 .off1 = td_var_offset(file_lock_mode),
470 .help = "Lock file when doing IO to it",
471 .parent = "filename",
475 .oval = FILE_LOCK_NONE,
476 .help = "No file locking",
478 { .ival = "exclusive",
479 .oval = FILE_LOCK_EXCLUSIVE,
480 .help = "Exclusive file lock",
484 .oval = FILE_LOCK_READWRITE,
485 .help = "Read vs write lock",
491 .type = FIO_OPT_STR_STORE,
492 .off1 = td_var_offset(opendir),
493 .cb = str_opendir_cb,
494 .help = "Recursively add files from this directory and down",
498 .alias = "readwrite",
501 .off1 = td_var_offset(td_ddir),
502 .help = "IO direction",
506 .oval = TD_DDIR_READ,
507 .help = "Sequential read",
510 .oval = TD_DDIR_WRITE,
511 .help = "Sequential write",
513 { .ival = "randread",
514 .oval = TD_DDIR_RANDREAD,
515 .help = "Random read",
517 { .ival = "randwrite",
518 .oval = TD_DDIR_RANDWRITE,
519 .help = "Random write",
523 .help = "Sequential read and write mix",
526 .oval = TD_DDIR_RANDRW,
527 .help = "Random read and write mix"
533 .type = FIO_OPT_STR_STORE,
534 .off1 = td_var_offset(ioengine),
535 .help = "IO engine to use",
539 .help = "Use read/write",
542 .help = "Use pread/pwrite",
545 .help = "Use readv/writev",
547 #ifdef FIO_HAVE_LIBAIO
549 .help = "Linux native asynchronous IO",
552 #ifdef FIO_HAVE_POSIXAIO
553 { .ival = "posixaio",
554 .help = "POSIX asynchronous IO",
558 .help = "Memory mapped IO",
560 #ifdef FIO_HAVE_SPLICE
562 .help = "splice/vmsplice based IO",
564 { .ival = "netsplice",
565 .help = "splice/vmsplice to/from the network",
570 .help = "SCSI generic v3 IO",
574 .help = "Testing engine (no data transfer)",
577 .help = "Network IO",
579 #ifdef FIO_HAVE_SYSLET
580 { .ival = "syslet-rw",
581 .help = "syslet enabled async pread/pwrite IO",
585 .help = "CPU cycler burner engine",
587 #ifdef FIO_HAVE_GUASI
589 .help = "GUASI IO engine",
592 { .ival = "external",
593 .help = "Load external engine (append name)",
600 .off1 = td_var_offset(iodepth),
601 .help = "Amount of IO buffers to keep in flight",
606 .name = "iodepth_batch",
608 .off1 = td_var_offset(iodepth_batch),
609 .help = "Number of IO to submit in one go",
615 .name = "iodepth_low",
617 .off1 = td_var_offset(iodepth_low),
618 .help = "Low water mark for queuing depth",
623 .type = FIO_OPT_STR_VAL,
624 .off1 = td_var_offset(size),
626 .help = "Total size of device or files",
629 .name = "fill_device",
630 .type = FIO_OPT_BOOL,
631 .off1 = td_var_offset(fill_device),
632 .help = "Write until an ENOSPC error occurs",
637 .type = FIO_OPT_STR_VAL,
638 .off1 = td_var_offset(file_size_low),
639 .off2 = td_var_offset(file_size_high),
641 .help = "Size of individual files",
645 .alias = "fileoffset",
646 .type = FIO_OPT_STR_VAL,
647 .off1 = td_var_offset(start_offset),
648 .help = "Start IO from this offset",
653 .alias = "blocksize",
654 .type = FIO_OPT_STR_VAL_INT,
655 .off1 = td_var_offset(bs[DDIR_READ]),
656 .off2 = td_var_offset(bs[DDIR_WRITE]),
658 .help = "Block size unit",
664 .alias = "blocksize_range",
665 .type = FIO_OPT_RANGE,
666 .off1 = td_var_offset(min_bs[DDIR_READ]),
667 .off2 = td_var_offset(max_bs[DDIR_READ]),
668 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
669 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
671 .help = "Set block size range (in more detail than bs)",
677 .cb = str_bssplit_cb,
678 .help = "Set a specific mix of block sizes",
682 .name = "bs_unaligned",
683 .alias = "blocksize_unaligned",
684 .type = FIO_OPT_STR_SET,
685 .off1 = td_var_offset(bs_unaligned),
686 .help = "Don't sector align IO buffer sizes",
690 .name = "randrepeat",
691 .type = FIO_OPT_BOOL,
692 .off1 = td_var_offset(rand_repeatable),
693 .help = "Use repeatable random IO pattern",
698 .name = "norandommap",
699 .type = FIO_OPT_STR_SET,
700 .off1 = td_var_offset(norandommap),
701 .help = "Accept potential duplicate random blocks",
705 .name = "softrandommap",
706 .type = FIO_OPT_BOOL,
707 .off1 = td_var_offset(softrandommap),
708 .help = "Allow randommap to fail and continue witout",
709 .parent = "norandommap",
715 .off1 = td_var_offset(nr_files),
716 .help = "Split job workload between this number of files",
722 .off1 = td_var_offset(open_files),
723 .help = "Number of files to keep open at the same time",
726 .name = "file_service_type",
729 .off1 = td_var_offset(file_service_type),
730 .help = "How to select which file to service next",
734 .oval = FIO_FSERVICE_RANDOM,
735 .help = "Choose a file at random",
737 { .ival = "roundrobin",
738 .oval = FIO_FSERVICE_RR,
739 .help = "Round robin select files",
745 .name = "fadvise_hint",
746 .type = FIO_OPT_BOOL,
747 .off1 = td_var_offset(fadvise_hint),
748 .help = "Use fadvise() to advise the kernel on IO pattern",
754 .off1 = td_var_offset(fsync_blocks),
755 .help = "Issue fsync for writes every given number of blocks",
760 .type = FIO_OPT_BOOL,
761 .off1 = td_var_offset(odirect),
762 .help = "Use O_DIRECT IO (negates buffered)",
767 .type = FIO_OPT_BOOL,
768 .off1 = td_var_offset(odirect),
770 .help = "Use buffered IO (negates direct)",
775 .type = FIO_OPT_BOOL,
776 .off1 = td_var_offset(overwrite),
777 .help = "When writing, set whether to overwrite current data",
783 .off1 = td_var_offset(loops),
784 .help = "Number of times to run the job",
790 .off1 = td_var_offset(numjobs),
791 .help = "Duplicate this job this many times",
795 .name = "startdelay",
797 .off1 = td_var_offset(start_delay),
798 .help = "Only start job when this period has passed",
804 .type = FIO_OPT_STR_VAL_TIME,
805 .off1 = td_var_offset(timeout),
806 .help = "Stop workload when this amount of time has passed",
810 .name = "time_based",
811 .type = FIO_OPT_STR_SET,
812 .off1 = td_var_offset(time_based),
813 .help = "Keep running until runtime/timeout is met",
820 .off1 = td_var_offset(mem_type),
821 .help = "Backing type for IO buffers",
826 .help = "Use malloc(3) for IO buffers",
830 .help = "Use shared memory segments for IO buffers",
832 #ifdef FIO_HAVE_HUGETLB
835 .help = "Like shm, but use huge pages",
840 .help = "Use mmap(2) (file or anon) for IO buffers",
842 #ifdef FIO_HAVE_HUGETLB
843 { .ival = "mmaphuge",
844 .oval = MEM_MMAPHUGE,
845 .help = "Like mmap, but use huge pages",
853 .off1 = td_var_offset(verify),
854 .help = "Verify data written",
859 .help = "Don't do IO verification",
863 .help = "Use md5 checksums for verification",
866 .oval = VERIFY_CRC64,
867 .help = "Use crc64 checksums for verification",
870 .oval = VERIFY_CRC32,
871 .help = "Use crc32 checksums for verification",
874 .oval = VERIFY_CRC16,
875 .help = "Use crc16 checksums for verification",
879 .help = "Use crc7 checksums for verification",
882 .oval = VERIFY_SHA256,
883 .help = "Use sha256 checksums for verification",
886 .oval = VERIFY_SHA512,
887 .help = "Use sha512 checksums for verification",
891 .help = "Use io information",
896 .help = "Pretend to verify",
902 .type = FIO_OPT_BOOL,
903 .off1 = td_var_offset(do_verify),
904 .help = "Run verification stage after write",
909 .name = "verifysort",
910 .type = FIO_OPT_BOOL,
911 .off1 = td_var_offset(verifysort),
912 .help = "Sort written verify blocks for read back",
917 .name = "verify_interval",
918 .type = FIO_OPT_STR_VAL_INT,
919 .off1 = td_var_offset(verify_interval),
920 .minval = 2 * sizeof(struct verify_header),
921 .help = "Store verify buffer header every N bytes",
925 .name = "verify_offset",
926 .type = FIO_OPT_STR_VAL_INT,
927 .help = "Offset verify header location by N bytes",
929 .cb = str_verify_offset_cb,
933 .name = "verify_pattern",
935 .cb = str_verify_pattern_cb,
936 .help = "Fill pattern for IO buffers",
940 .name = "verify_fatal",
941 .type = FIO_OPT_BOOL,
942 .off1 = td_var_offset(verify_fatal),
944 .help = "Exit on a single verify failure, don't continue",
948 .name = "write_iolog",
949 .type = FIO_OPT_STR_STORE,
950 .off1 = td_var_offset(write_iolog_file),
951 .help = "Store IO pattern to file",
954 .name = "read_iolog",
955 .type = FIO_OPT_STR_STORE,
956 .off1 = td_var_offset(read_iolog_file),
957 .help = "Playback IO pattern from file",
960 .name = "exec_prerun",
961 .type = FIO_OPT_STR_STORE,
962 .off1 = td_var_offset(exec_prerun),
963 .help = "Execute this file prior to running job",
966 .name = "exec_postrun",
967 .type = FIO_OPT_STR_STORE,
968 .off1 = td_var_offset(exec_postrun),
969 .help = "Execute this file after running job",
971 #ifdef FIO_HAVE_IOSCHED_SWITCH
973 .name = "ioscheduler",
974 .type = FIO_OPT_STR_STORE,
975 .off1 = td_var_offset(ioscheduler),
976 .help = "Use this IO scheduler on the backing device",
981 .type = FIO_OPT_STR_VAL,
982 .off1 = td_var_offset(zone_size),
983 .help = "Give size of an IO zone",
988 .type = FIO_OPT_STR_VAL,
989 .off1 = td_var_offset(zone_skip),
990 .help = "Space between IO zones",
995 .type = FIO_OPT_STR_VAL,
996 .cb = str_lockmem_cb,
997 .help = "Lock down this amount of memory",
1001 .name = "rwmixread",
1002 .type = FIO_OPT_INT,
1003 .cb = str_rwmix_read_cb,
1005 .help = "Percentage of mixed workload that is reads",
1009 .name = "rwmixwrite",
1010 .type = FIO_OPT_INT,
1011 .cb = str_rwmix_write_cb,
1013 .help = "Percentage of mixed workload that is writes",
1017 .name = "rwmixcycle",
1018 .type = FIO_OPT_DEPRECATED,
1022 .type = FIO_OPT_INT,
1023 .off1 = td_var_offset(nice),
1024 .help = "Set job CPU nice value",
1029 #ifdef FIO_HAVE_IOPRIO
1032 .type = FIO_OPT_INT,
1034 .help = "Set job IO priority value",
1039 .name = "prioclass",
1040 .type = FIO_OPT_INT,
1041 .cb = str_prioclass_cb,
1042 .help = "Set job IO priority class",
1048 .name = "thinktime",
1049 .type = FIO_OPT_INT,
1050 .off1 = td_var_offset(thinktime),
1051 .help = "Idle time between IO buffers (usec)",
1055 .name = "thinktime_spin",
1056 .type = FIO_OPT_INT,
1057 .off1 = td_var_offset(thinktime_spin),
1058 .help = "Start think time by spinning this amount (usec)",
1060 .parent = "thinktime",
1063 .name = "thinktime_blocks",
1064 .type = FIO_OPT_INT,
1065 .off1 = td_var_offset(thinktime_blocks),
1066 .help = "IO buffer period between 'thinktime'",
1068 .parent = "thinktime",
1072 .type = FIO_OPT_INT,
1073 .off1 = td_var_offset(rate),
1074 .help = "Set bandwidth rate",
1078 .type = FIO_OPT_INT,
1079 .off1 = td_var_offset(ratemin),
1080 .help = "Job must meet this rate or it will be shutdown",
1084 .name = "rate_iops",
1085 .type = FIO_OPT_INT,
1086 .off1 = td_var_offset(rate_iops),
1087 .help = "Limit IO used to this number of IO operations/sec",
1090 .name = "rate_iops_min",
1091 .type = FIO_OPT_INT,
1092 .off1 = td_var_offset(rate_iops_min),
1093 .help = "Job must meet this rate or it will be shutdown",
1094 .parent = "rate_iops",
1097 .name = "ratecycle",
1098 .type = FIO_OPT_INT,
1099 .off1 = td_var_offset(ratecycle),
1100 .help = "Window average for rate limits (msec)",
1105 .name = "invalidate",
1106 .type = FIO_OPT_BOOL,
1107 .off1 = td_var_offset(invalidate_cache),
1108 .help = "Invalidate buffer/page cache prior to running job",
1113 .type = FIO_OPT_BOOL,
1114 .off1 = td_var_offset(sync_io),
1115 .help = "Use O_SYNC for buffered writes",
1117 .parent = "buffered",
1120 .name = "bwavgtime",
1121 .type = FIO_OPT_INT,
1122 .off1 = td_var_offset(bw_avg_time),
1123 .help = "Time window over which to calculate bandwidth"
1128 .name = "create_serialize",
1129 .type = FIO_OPT_BOOL,
1130 .off1 = td_var_offset(create_serialize),
1131 .help = "Serialize creating of job files",
1135 .name = "create_fsync",
1136 .type = FIO_OPT_BOOL,
1137 .off1 = td_var_offset(create_fsync),
1138 .help = "Fsync file after creation",
1143 .type = FIO_OPT_INT,
1144 .off1 = td_var_offset(cpuload),
1145 .help = "Use this percentage of CPU",
1148 .name = "cpuchunks",
1149 .type = FIO_OPT_INT,
1150 .off1 = td_var_offset(cpucycle),
1151 .help = "Length of the CPU burn cycles (usecs)",
1153 .parent = "cpuload",
1155 #ifdef FIO_HAVE_CPU_AFFINITY
1158 .type = FIO_OPT_INT,
1159 .cb = str_cpumask_cb,
1160 .help = "CPU affinity mask",
1163 .name = "cpus_allowed",
1164 .type = FIO_OPT_STR,
1165 .cb = str_cpus_allowed_cb,
1166 .help = "Set CPUs allowed",
1170 .name = "end_fsync",
1171 .type = FIO_OPT_BOOL,
1172 .off1 = td_var_offset(end_fsync),
1173 .help = "Include fsync at the end of job",
1177 .name = "fsync_on_close",
1178 .type = FIO_OPT_BOOL,
1179 .off1 = td_var_offset(fsync_on_close),
1180 .help = "fsync files on close",
1185 .type = FIO_OPT_BOOL,
1186 .off1 = td_var_offset(unlink),
1187 .help = "Unlink created files after job has completed",
1192 .type = FIO_OPT_STR_SET,
1193 .cb = str_exitall_cb,
1194 .help = "Terminate all jobs when one exits",
1197 .name = "stonewall",
1198 .type = FIO_OPT_STR_SET,
1199 .off1 = td_var_offset(stonewall),
1200 .help = "Insert a hard barrier between this job and previous",
1203 .name = "new_group",
1204 .type = FIO_OPT_STR_SET,
1205 .off1 = td_var_offset(new_group),
1206 .help = "Mark the start of a new group (for reporting)",
1210 .type = FIO_OPT_STR_SET,
1211 .off1 = td_var_offset(use_thread),
1212 .help = "Use threads instead of forks",
1215 .name = "write_bw_log",
1216 .type = FIO_OPT_STR_SET,
1217 .off1 = td_var_offset(write_bw_log),
1218 .help = "Write log of bandwidth during run",
1221 .name = "write_lat_log",
1222 .type = FIO_OPT_STR_SET,
1223 .off1 = td_var_offset(write_lat_log),
1224 .help = "Write log of latency during run",
1227 .name = "hugepage-size",
1228 .type = FIO_OPT_STR_VAL_INT,
1229 .off1 = td_var_offset(hugepage_size),
1230 .help = "When using hugepages, specify size of each page",
1231 .def = __stringify(FIO_HUGE_PAGE),
1234 .name = "group_reporting",
1235 .type = FIO_OPT_STR_SET,
1236 .off1 = td_var_offset(group_reporting),
1237 .help = "Do reporting on a per-group basis",
1240 .name = "zero_buffers",
1241 .type = FIO_OPT_STR_SET,
1242 .off1 = td_var_offset(zero_buffers),
1243 .help = "Init IO buffers to all zeroes",
1246 .name = "refill_buffers",
1247 .type = FIO_OPT_STR_SET,
1248 .off1 = td_var_offset(refill_buffers),
1249 .help = "Refill IO buffers on every IO submit",
1251 #ifdef FIO_HAVE_DISK_UTIL
1253 .name = "disk_util",
1254 .type = FIO_OPT_BOOL,
1255 .off1 = td_var_offset(do_disk_util),
1256 .help = "Log disk utilization stats",
1265 void fio_options_dup_and_init(struct option *long_options)
1267 struct fio_option *o;
1270 options_init(options);
1273 while (long_options[i].name)
1278 long_options[i].name = o->name;
1279 long_options[i].val = FIO_GETOPT_JOB;
1280 if (o->type == FIO_OPT_STR_SET)
1281 long_options[i].has_arg = no_argument;
1283 long_options[i].has_arg = required_argument;
1287 assert(i < FIO_NR_OPTIONS);
1291 int fio_option_parse(struct thread_data *td, const char *opt)
1293 return parse_option(opt, options, td);
1296 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1298 return parse_cmd_option(opt, val, options, td);
1301 void fio_fill_default_options(struct thread_data *td)
1303 fill_default_options(td, options);
1306 int fio_show_option_help(const char *opt)
1308 return show_cmd_help(options, opt);
1311 static void __options_mem(struct thread_data *td, int alloc)
1313 struct thread_options *o = &td->o;
1314 struct fio_option *opt;
1318 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1319 if (opt->type != FIO_OPT_STR_STORE)
1322 ptr = (void *) o + opt->off1;
1325 *ptr = strdup(*ptr);
1335 * dupe FIO_OPT_STR_STORE options
1337 void options_mem_dupe(struct thread_data *td)
1339 __options_mem(td, 1);
1342 void options_mem_free(struct thread_data fio_unused *td)
1345 __options_mem(td, 0);