10 #include <sys/types.h>
17 #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
20 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
22 static char *get_opt_postfix(const char *str)
24 char *p = strstr(str, ":");
30 strip_blank_front(&p);
35 static int bs_cmp(const void *p1, const void *p2)
37 const struct bssplit *bsp1 = p1;
38 const struct bssplit *bsp2 = p2;
40 return bsp1->perc < bsp2->perc;
43 static int str_bssplit_cb(void *data, const char *input)
45 struct thread_data *td = data;
46 char *fname, *str, *p;
47 unsigned int i, perc, perc_missing;
48 unsigned int max_bs, min_bs;
51 p = str = strdup(input);
53 strip_blank_front(&str);
57 td->o.bssplit = malloc(4 * sizeof(struct bssplit));
62 while ((fname = strsep(&str, ":")) != NULL) {
69 * grow struct buffer, if needed
71 if (i == td->o.bssplit_nr) {
72 td->o.bssplit_nr <<= 1;
73 td->o.bssplit = realloc(td->o.bssplit,
75 * sizeof(struct bssplit));
78 perc_str = strstr(fname, "/");
82 perc = atoi(perc_str);
90 if (str_to_decimal(fname, &val, 1)) {
91 log_err("fio: bssplit conversion failed\n");
101 td->o.bssplit[i].bs = val;
102 td->o.bssplit[i].perc = perc;
106 td->o.bssplit_nr = i;
109 * Now check if the percentages add up, and how much is missing
111 perc = perc_missing = 0;
112 for (i = 0; i < td->o.bssplit_nr; i++) {
113 struct bssplit *bsp = &td->o.bssplit[i];
115 if (bsp->perc == (unsigned char) -1)
122 log_err("fio: bssplit percentages add to more than 100%%\n");
127 * If values didn't have a percentage set, divide the remains between
131 for (i = 0; i < td->o.bssplit_nr; i++) {
132 struct bssplit *bsp = &td->o.bssplit[i];
134 if (bsp->perc == (unsigned char) -1)
135 bsp->perc = (100 - perc) / perc_missing;
139 td->o.min_bs[DDIR_READ] = td->o.min_bs[DDIR_WRITE] = min_bs;
140 td->o.max_bs[DDIR_READ] = td->o.max_bs[DDIR_WRITE] = max_bs;
143 * now sort based on percentages, for ease of lookup
145 qsort(td->o.bssplit, td->o.bssplit_nr, sizeof(struct bssplit), bs_cmp);
151 static int str_rw_cb(void *data, const char *str)
153 struct thread_data *td = data;
154 char *nr = get_opt_postfix(str);
158 td->o.ddir_nr = atoi(nr);
163 static int str_mem_cb(void *data, const char *mem)
165 struct thread_data *td = data;
167 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
168 td->mmapfile = get_opt_postfix(mem);
169 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
170 log_err("fio: mmaphuge:/path/to/file\n");
178 static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
184 static int str_rwmix_read_cb(void *data, unsigned int *val)
186 struct thread_data *td = data;
188 td->o.rwmix[DDIR_READ] = *val;
189 td->o.rwmix[DDIR_WRITE] = 100 - *val;
193 static int str_rwmix_write_cb(void *data, unsigned int *val)
195 struct thread_data *td = data;
197 td->o.rwmix[DDIR_WRITE] = *val;
198 td->o.rwmix[DDIR_READ] = 100 - *val;
202 #ifdef FIO_HAVE_IOPRIO
203 static int str_prioclass_cb(void *data, unsigned int *val)
205 struct thread_data *td = data;
209 * mask off old class bits, str_prio_cb() may have set a default class
211 mask = (1 << IOPRIO_CLASS_SHIFT) - 1;
214 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
219 static int str_prio_cb(void *data, unsigned int *val)
221 struct thread_data *td = data;
226 * If no class is set, assume BE
228 if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0)
229 td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT;
236 static int str_exitall_cb(void)
238 exitall_on_terminate = 1;
242 #ifdef FIO_HAVE_CPU_AFFINITY
243 static int str_cpumask_cb(void *data, unsigned int *val)
245 struct thread_data *td = data;
248 CPU_ZERO(&td->o.cpumask);
250 for (i = 0; i < sizeof(int) * 8; i++)
252 CPU_SET(*val, &td->o.cpumask);
254 td->o.cpumask_set = 1;
258 static int str_cpus_allowed_cb(void *data, const char *input)
260 struct thread_data *td = data;
263 CPU_ZERO(&td->o.cpumask);
265 p = str = strdup(input);
267 strip_blank_front(&str);
268 strip_blank_end(str);
270 while ((cpu = strsep(&str, ",")) != NULL) {
273 CPU_SET(atoi(cpu), &td->o.cpumask);
277 td->o.cpumask_set = 1;
282 static int str_fst_cb(void *data, const char *str)
284 struct thread_data *td = data;
285 char *nr = get_opt_postfix(str);
287 td->file_service_nr = 1;
289 td->file_service_nr = atoi(nr);
294 static int check_dir(struct thread_data *td, char *fname)
296 char file[PATH_MAX], *dir;
299 if (td->o.directory) {
300 strcpy(file, td->o.directory);
305 sprintf(file + elen, "%s", fname);
312 * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded
313 * yet, so we can't do this check right here...
315 if (lstat(dir, &sb) < 0) {
318 log_err("fio: %s is not a directory\n", dir);
319 td_verror(td, ret, "lstat");
323 if (!S_ISDIR(sb.st_mode)) {
324 log_err("fio: %s is not a directory\n", dir);
333 static int str_filename_cb(void *data, const char *input)
335 struct thread_data *td = data;
336 char *fname, *str, *p;
338 p = str = strdup(input);
340 strip_blank_front(&str);
341 strip_blank_end(str);
343 if (!td->files_index)
346 while ((fname = strsep(&str, ":")) != NULL) {
349 if (check_dir(td, fname)) {
361 static int str_directory_cb(void *data, const char fio_unused *str)
363 struct thread_data *td = data;
366 if (lstat(td->o.directory, &sb) < 0) {
369 log_err("fio: %s is not a directory\n", td->o.directory);
370 td_verror(td, ret, "lstat");
373 if (!S_ISDIR(sb.st_mode)) {
374 log_err("fio: %s is not a directory\n", td->o.directory);
381 static int str_opendir_cb(void *data, const char fio_unused *str)
383 struct thread_data *td = data;
385 if (!td->files_index)
388 return add_dir_files(td, td->o.opendir);
391 static int str_verify_offset_cb(void *data, unsigned int *off)
393 struct thread_data *td = data;
395 if (*off && *off < sizeof(struct verify_header)) {
396 log_err("fio: verify_offset too small\n");
400 td->o.verify_offset = *off;
404 static int str_verify_pattern_cb(void *data, unsigned int *off)
406 struct thread_data *td = data;
411 td->o.verify_pattern_bytes = 1;
413 td->o.verify_pattern_bytes = 2;
415 td->o.verify_pattern_bytes = 3;
417 td->o.verify_pattern_bytes = 4;
419 td->o.verify_pattern = *off;
423 static int str_lockfile_cb(void *data, const char *str)
425 struct thread_data *td = data;
426 char *nr = get_opt_postfix(str);
428 td->o.lockfile_batch = 1;
430 td->o.lockfile_batch = atoi(nr);
435 #define __stringify_1(x) #x
436 #define __stringify(x) __stringify_1(x)
439 * Map of job/command line options
441 static struct fio_option options[] = {
443 .name = "description",
444 .type = FIO_OPT_STR_STORE,
445 .off1 = td_var_offset(description),
446 .help = "Text job description",
450 .type = FIO_OPT_STR_STORE,
451 .off1 = td_var_offset(name),
452 .help = "Name of this job",
456 .type = FIO_OPT_STR_STORE,
457 .off1 = td_var_offset(directory),
458 .cb = str_directory_cb,
459 .help = "Directory to store files in",
463 .type = FIO_OPT_STR_STORE,
464 .off1 = td_var_offset(filename),
465 .cb = str_filename_cb,
466 .help = "File(s) to use for the workload",
471 .cb = str_lockfile_cb,
472 .off1 = td_var_offset(file_lock_mode),
473 .help = "Lock file when doing IO to it",
474 .parent = "filename",
478 .oval = FILE_LOCK_NONE,
479 .help = "No file locking",
481 { .ival = "exclusive",
482 .oval = FILE_LOCK_EXCLUSIVE,
483 .help = "Exclusive file lock",
487 .oval = FILE_LOCK_READWRITE,
488 .help = "Read vs write lock",
494 .type = FIO_OPT_STR_STORE,
495 .off1 = td_var_offset(opendir),
496 .cb = str_opendir_cb,
497 .help = "Recursively add files from this directory and down",
501 .alias = "readwrite",
504 .off1 = td_var_offset(td_ddir),
505 .help = "IO direction",
509 .oval = TD_DDIR_READ,
510 .help = "Sequential read",
513 .oval = TD_DDIR_WRITE,
514 .help = "Sequential write",
516 { .ival = "randread",
517 .oval = TD_DDIR_RANDREAD,
518 .help = "Random read",
520 { .ival = "randwrite",
521 .oval = TD_DDIR_RANDWRITE,
522 .help = "Random write",
526 .help = "Sequential read and write mix",
529 .oval = TD_DDIR_RANDRW,
530 .help = "Random read and write mix"
536 .type = FIO_OPT_STR_STORE,
537 .off1 = td_var_offset(ioengine),
538 .help = "IO engine to use",
542 .help = "Use read/write",
545 .help = "Use pread/pwrite",
548 .help = "Use readv/writev",
550 #ifdef FIO_HAVE_LIBAIO
552 .help = "Linux native asynchronous IO",
555 #ifdef FIO_HAVE_POSIXAIO
556 { .ival = "posixaio",
557 .help = "POSIX asynchronous IO",
561 .help = "Memory mapped IO",
563 #ifdef FIO_HAVE_SPLICE
565 .help = "splice/vmsplice based IO",
567 { .ival = "netsplice",
568 .help = "splice/vmsplice to/from the network",
573 .help = "SCSI generic v3 IO",
577 .help = "Testing engine (no data transfer)",
580 .help = "Network IO",
582 #ifdef FIO_HAVE_SYSLET
583 { .ival = "syslet-rw",
584 .help = "syslet enabled async pread/pwrite IO",
588 .help = "CPU cycler burner engine",
590 #ifdef FIO_HAVE_GUASI
592 .help = "GUASI IO engine",
595 { .ival = "external",
596 .help = "Load external engine (append name)",
603 .off1 = td_var_offset(iodepth),
604 .help = "Amount of IO buffers to keep in flight",
609 .name = "iodepth_batch",
611 .off1 = td_var_offset(iodepth_batch),
612 .help = "Number of IO to submit in one go",
618 .name = "iodepth_low",
620 .off1 = td_var_offset(iodepth_low),
621 .help = "Low water mark for queuing depth",
626 .type = FIO_OPT_STR_VAL,
627 .off1 = td_var_offset(size),
629 .help = "Total size of device or files",
632 .name = "fill_device",
633 .type = FIO_OPT_BOOL,
634 .off1 = td_var_offset(fill_device),
635 .help = "Write until an ENOSPC error occurs",
640 .type = FIO_OPT_STR_VAL,
641 .off1 = td_var_offset(file_size_low),
642 .off2 = td_var_offset(file_size_high),
644 .help = "Size of individual files",
648 .alias = "fileoffset",
649 .type = FIO_OPT_STR_VAL,
650 .off1 = td_var_offset(start_offset),
651 .help = "Start IO from this offset",
656 .alias = "blocksize",
657 .type = FIO_OPT_STR_VAL_INT,
658 .off1 = td_var_offset(bs[DDIR_READ]),
659 .off2 = td_var_offset(bs[DDIR_WRITE]),
661 .help = "Block size unit",
667 .alias = "blocksize_range",
668 .type = FIO_OPT_RANGE,
669 .off1 = td_var_offset(min_bs[DDIR_READ]),
670 .off2 = td_var_offset(max_bs[DDIR_READ]),
671 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
672 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
674 .help = "Set block size range (in more detail than bs)",
680 .cb = str_bssplit_cb,
681 .help = "Set a specific mix of block sizes",
685 .name = "bs_unaligned",
686 .alias = "blocksize_unaligned",
687 .type = FIO_OPT_STR_SET,
688 .off1 = td_var_offset(bs_unaligned),
689 .help = "Don't sector align IO buffer sizes",
693 .name = "randrepeat",
694 .type = FIO_OPT_BOOL,
695 .off1 = td_var_offset(rand_repeatable),
696 .help = "Use repeatable random IO pattern",
701 .name = "norandommap",
702 .type = FIO_OPT_STR_SET,
703 .off1 = td_var_offset(norandommap),
704 .help = "Accept potential duplicate random blocks",
708 .name = "softrandommap",
709 .type = FIO_OPT_BOOL,
710 .off1 = td_var_offset(softrandommap),
711 .help = "Allow randommap to fail and continue witout",
712 .parent = "norandommap",
718 .off1 = td_var_offset(nr_files),
719 .help = "Split job workload between this number of files",
725 .off1 = td_var_offset(open_files),
726 .help = "Number of files to keep open at the same time",
729 .name = "file_service_type",
732 .off1 = td_var_offset(file_service_type),
733 .help = "How to select which file to service next",
737 .oval = FIO_FSERVICE_RANDOM,
738 .help = "Choose a file at random",
740 { .ival = "roundrobin",
741 .oval = FIO_FSERVICE_RR,
742 .help = "Round robin select files",
748 .name = "fadvise_hint",
749 .type = FIO_OPT_BOOL,
750 .off1 = td_var_offset(fadvise_hint),
751 .help = "Use fadvise() to advise the kernel on IO pattern",
757 .off1 = td_var_offset(fsync_blocks),
758 .help = "Issue fsync for writes every given number of blocks",
763 .type = FIO_OPT_BOOL,
764 .off1 = td_var_offset(odirect),
765 .help = "Use O_DIRECT IO (negates buffered)",
770 .type = FIO_OPT_BOOL,
771 .off1 = td_var_offset(odirect),
773 .help = "Use buffered IO (negates direct)",
778 .type = FIO_OPT_BOOL,
779 .off1 = td_var_offset(overwrite),
780 .help = "When writing, set whether to overwrite current data",
786 .off1 = td_var_offset(loops),
787 .help = "Number of times to run the job",
793 .off1 = td_var_offset(numjobs),
794 .help = "Duplicate this job this many times",
798 .name = "startdelay",
800 .off1 = td_var_offset(start_delay),
801 .help = "Only start job when this period has passed",
807 .type = FIO_OPT_STR_VAL_TIME,
808 .off1 = td_var_offset(timeout),
809 .help = "Stop workload when this amount of time has passed",
813 .name = "time_based",
814 .type = FIO_OPT_STR_SET,
815 .off1 = td_var_offset(time_based),
816 .help = "Keep running until runtime/timeout is met",
823 .off1 = td_var_offset(mem_type),
824 .help = "Backing type for IO buffers",
829 .help = "Use malloc(3) for IO buffers",
833 .help = "Use shared memory segments for IO buffers",
835 #ifdef FIO_HAVE_HUGETLB
838 .help = "Like shm, but use huge pages",
843 .help = "Use mmap(2) (file or anon) for IO buffers",
845 #ifdef FIO_HAVE_HUGETLB
846 { .ival = "mmaphuge",
847 .oval = MEM_MMAPHUGE,
848 .help = "Like mmap, but use huge pages",
856 .off1 = td_var_offset(verify),
857 .help = "Verify data written",
862 .help = "Don't do IO verification",
866 .help = "Use md5 checksums for verification",
869 .oval = VERIFY_CRC64,
870 .help = "Use crc64 checksums for verification",
873 .oval = VERIFY_CRC32,
874 .help = "Use crc32 checksums for verification",
877 .oval = VERIFY_CRC16,
878 .help = "Use crc16 checksums for verification",
882 .help = "Use crc7 checksums for verification",
885 .oval = VERIFY_SHA256,
886 .help = "Use sha256 checksums for verification",
889 .oval = VERIFY_SHA512,
890 .help = "Use sha512 checksums for verification",
894 .help = "Use io information",
899 .help = "Pretend to verify",
905 .type = FIO_OPT_BOOL,
906 .off1 = td_var_offset(do_verify),
907 .help = "Run verification stage after write",
912 .name = "verifysort",
913 .type = FIO_OPT_BOOL,
914 .off1 = td_var_offset(verifysort),
915 .help = "Sort written verify blocks for read back",
920 .name = "verify_interval",
921 .type = FIO_OPT_STR_VAL_INT,
922 .off1 = td_var_offset(verify_interval),
923 .minval = 2 * sizeof(struct verify_header),
924 .help = "Store verify buffer header every N bytes",
928 .name = "verify_offset",
929 .type = FIO_OPT_STR_VAL_INT,
930 .help = "Offset verify header location by N bytes",
932 .cb = str_verify_offset_cb,
936 .name = "verify_pattern",
938 .cb = str_verify_pattern_cb,
939 .help = "Fill pattern for IO buffers",
943 .name = "verify_fatal",
944 .type = FIO_OPT_BOOL,
945 .off1 = td_var_offset(verify_fatal),
947 .help = "Exit on a single verify failure, don't continue",
951 .name = "write_iolog",
952 .type = FIO_OPT_STR_STORE,
953 .off1 = td_var_offset(write_iolog_file),
954 .help = "Store IO pattern to file",
957 .name = "read_iolog",
958 .type = FIO_OPT_STR_STORE,
959 .off1 = td_var_offset(read_iolog_file),
960 .help = "Playback IO pattern from file",
963 .name = "exec_prerun",
964 .type = FIO_OPT_STR_STORE,
965 .off1 = td_var_offset(exec_prerun),
966 .help = "Execute this file prior to running job",
969 .name = "exec_postrun",
970 .type = FIO_OPT_STR_STORE,
971 .off1 = td_var_offset(exec_postrun),
972 .help = "Execute this file after running job",
974 #ifdef FIO_HAVE_IOSCHED_SWITCH
976 .name = "ioscheduler",
977 .type = FIO_OPT_STR_STORE,
978 .off1 = td_var_offset(ioscheduler),
979 .help = "Use this IO scheduler on the backing device",
984 .type = FIO_OPT_STR_VAL,
985 .off1 = td_var_offset(zone_size),
986 .help = "Give size of an IO zone",
991 .type = FIO_OPT_STR_VAL,
992 .off1 = td_var_offset(zone_skip),
993 .help = "Space between IO zones",
998 .type = FIO_OPT_STR_VAL,
999 .cb = str_lockmem_cb,
1000 .help = "Lock down this amount of memory",
1004 .name = "rwmixread",
1005 .type = FIO_OPT_INT,
1006 .cb = str_rwmix_read_cb,
1008 .help = "Percentage of mixed workload that is reads",
1012 .name = "rwmixwrite",
1013 .type = FIO_OPT_INT,
1014 .cb = str_rwmix_write_cb,
1016 .help = "Percentage of mixed workload that is writes",
1020 .name = "rwmixcycle",
1021 .type = FIO_OPT_DEPRECATED,
1025 .type = FIO_OPT_INT,
1026 .off1 = td_var_offset(nice),
1027 .help = "Set job CPU nice value",
1032 #ifdef FIO_HAVE_IOPRIO
1035 .type = FIO_OPT_INT,
1037 .help = "Set job IO priority value",
1042 .name = "prioclass",
1043 .type = FIO_OPT_INT,
1044 .cb = str_prioclass_cb,
1045 .help = "Set job IO priority class",
1051 .name = "thinktime",
1052 .type = FIO_OPT_INT,
1053 .off1 = td_var_offset(thinktime),
1054 .help = "Idle time between IO buffers (usec)",
1058 .name = "thinktime_spin",
1059 .type = FIO_OPT_INT,
1060 .off1 = td_var_offset(thinktime_spin),
1061 .help = "Start think time by spinning this amount (usec)",
1063 .parent = "thinktime",
1066 .name = "thinktime_blocks",
1067 .type = FIO_OPT_INT,
1068 .off1 = td_var_offset(thinktime_blocks),
1069 .help = "IO buffer period between 'thinktime'",
1071 .parent = "thinktime",
1075 .type = FIO_OPT_INT,
1076 .off1 = td_var_offset(rate),
1077 .help = "Set bandwidth rate",
1081 .type = FIO_OPT_INT,
1082 .off1 = td_var_offset(ratemin),
1083 .help = "Job must meet this rate or it will be shutdown",
1087 .name = "rate_iops",
1088 .type = FIO_OPT_INT,
1089 .off1 = td_var_offset(rate_iops),
1090 .help = "Limit IO used to this number of IO operations/sec",
1093 .name = "rate_iops_min",
1094 .type = FIO_OPT_INT,
1095 .off1 = td_var_offset(rate_iops_min),
1096 .help = "Job must meet this rate or it will be shutdown",
1097 .parent = "rate_iops",
1100 .name = "ratecycle",
1101 .type = FIO_OPT_INT,
1102 .off1 = td_var_offset(ratecycle),
1103 .help = "Window average for rate limits (msec)",
1108 .name = "invalidate",
1109 .type = FIO_OPT_BOOL,
1110 .off1 = td_var_offset(invalidate_cache),
1111 .help = "Invalidate buffer/page cache prior to running job",
1116 .type = FIO_OPT_BOOL,
1117 .off1 = td_var_offset(sync_io),
1118 .help = "Use O_SYNC for buffered writes",
1120 .parent = "buffered",
1123 .name = "bwavgtime",
1124 .type = FIO_OPT_INT,
1125 .off1 = td_var_offset(bw_avg_time),
1126 .help = "Time window over which to calculate bandwidth"
1131 .name = "create_serialize",
1132 .type = FIO_OPT_BOOL,
1133 .off1 = td_var_offset(create_serialize),
1134 .help = "Serialize creating of job files",
1138 .name = "create_fsync",
1139 .type = FIO_OPT_BOOL,
1140 .off1 = td_var_offset(create_fsync),
1141 .help = "Fsync file after creation",
1146 .type = FIO_OPT_INT,
1147 .off1 = td_var_offset(cpuload),
1148 .help = "Use this percentage of CPU",
1151 .name = "cpuchunks",
1152 .type = FIO_OPT_INT,
1153 .off1 = td_var_offset(cpucycle),
1154 .help = "Length of the CPU burn cycles (usecs)",
1156 .parent = "cpuload",
1158 #ifdef FIO_HAVE_CPU_AFFINITY
1161 .type = FIO_OPT_INT,
1162 .cb = str_cpumask_cb,
1163 .help = "CPU affinity mask",
1166 .name = "cpus_allowed",
1167 .type = FIO_OPT_STR,
1168 .cb = str_cpus_allowed_cb,
1169 .help = "Set CPUs allowed",
1173 .name = "end_fsync",
1174 .type = FIO_OPT_BOOL,
1175 .off1 = td_var_offset(end_fsync),
1176 .help = "Include fsync at the end of job",
1180 .name = "fsync_on_close",
1181 .type = FIO_OPT_BOOL,
1182 .off1 = td_var_offset(fsync_on_close),
1183 .help = "fsync files on close",
1188 .type = FIO_OPT_BOOL,
1189 .off1 = td_var_offset(unlink),
1190 .help = "Unlink created files after job has completed",
1195 .type = FIO_OPT_STR_SET,
1196 .cb = str_exitall_cb,
1197 .help = "Terminate all jobs when one exits",
1200 .name = "stonewall",
1201 .type = FIO_OPT_STR_SET,
1202 .off1 = td_var_offset(stonewall),
1203 .help = "Insert a hard barrier between this job and previous",
1206 .name = "new_group",
1207 .type = FIO_OPT_STR_SET,
1208 .off1 = td_var_offset(new_group),
1209 .help = "Mark the start of a new group (for reporting)",
1213 .type = FIO_OPT_STR_SET,
1214 .off1 = td_var_offset(use_thread),
1215 .help = "Use threads instead of forks",
1218 .name = "write_bw_log",
1219 .type = FIO_OPT_STR_SET,
1220 .off1 = td_var_offset(write_bw_log),
1221 .help = "Write log of bandwidth during run",
1224 .name = "write_lat_log",
1225 .type = FIO_OPT_STR_SET,
1226 .off1 = td_var_offset(write_lat_log),
1227 .help = "Write log of latency during run",
1230 .name = "hugepage-size",
1231 .type = FIO_OPT_STR_VAL_INT,
1232 .off1 = td_var_offset(hugepage_size),
1233 .help = "When using hugepages, specify size of each page",
1234 .def = __stringify(FIO_HUGE_PAGE),
1237 .name = "group_reporting",
1238 .type = FIO_OPT_STR_SET,
1239 .off1 = td_var_offset(group_reporting),
1240 .help = "Do reporting on a per-group basis",
1243 .name = "zero_buffers",
1244 .type = FIO_OPT_STR_SET,
1245 .off1 = td_var_offset(zero_buffers),
1246 .help = "Init IO buffers to all zeroes",
1249 .name = "refill_buffers",
1250 .type = FIO_OPT_STR_SET,
1251 .off1 = td_var_offset(refill_buffers),
1252 .help = "Refill IO buffers on every IO submit",
1254 #ifdef FIO_HAVE_DISK_UTIL
1256 .name = "disk_util",
1257 .type = FIO_OPT_BOOL,
1258 .off1 = td_var_offset(do_disk_util),
1259 .help = "Log disk utilization stats",
1268 void fio_options_dup_and_init(struct option *long_options)
1270 struct fio_option *o;
1273 options_init(options);
1276 while (long_options[i].name)
1281 long_options[i].name = (char *) o->name;
1282 long_options[i].val = FIO_GETOPT_JOB;
1283 if (o->type == FIO_OPT_STR_SET)
1284 long_options[i].has_arg = no_argument;
1286 long_options[i].has_arg = required_argument;
1290 assert(i < FIO_NR_OPTIONS);
1294 int fio_option_parse(struct thread_data *td, const char *opt)
1296 return parse_option(opt, options, td);
1299 int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1301 return parse_cmd_option(opt, val, options, td);
1304 void fio_fill_default_options(struct thread_data *td)
1306 fill_default_options(td, options);
1309 int fio_show_option_help(const char *opt)
1311 return show_cmd_help(options, opt);
1314 static void __options_mem(struct thread_data *td, int alloc)
1316 struct thread_options *o = &td->o;
1317 struct fio_option *opt;
1321 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1322 if (opt->type != FIO_OPT_STR_STORE)
1325 ptr = (void *) o + opt->off1;
1328 *ptr = strdup(*ptr);
1338 * dupe FIO_OPT_STR_STORE options
1340 void options_mem_dupe(struct thread_data *td)
1342 __options_mem(td, 1);
1345 void options_mem_free(struct thread_data fio_unused *td)
1348 __options_mem(td, 0);