Commit | Line | Data |
---|---|---|
214e1eca JA |
1 | #include <stdio.h> |
2 | #include <stdlib.h> | |
3 | #include <unistd.h> | |
4 | #include <ctype.h> | |
5 | #include <string.h> | |
6 | #include <getopt.h> | |
7 | #include <assert.h> | |
8 | ||
9 | #include "fio.h" | |
10 | #include "parse.h" | |
90059d65 | 11 | #include "fls.h" |
214e1eca | 12 | |
2dc1bbeb | 13 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) |
214e1eca JA |
14 | |
15 | /* | |
16 | * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. | |
17 | */ | |
18 | static char *get_opt_postfix(const char *str) | |
19 | { | |
20 | char *p = strstr(str, ":"); | |
21 | ||
22 | if (!p) | |
23 | return NULL; | |
24 | ||
25 | p++; | |
26 | strip_blank_front(&p); | |
27 | strip_blank_end(p); | |
28 | return strdup(p); | |
29 | } | |
30 | ||
564ca972 JA |
31 | static int bs_cmp(const void *p1, const void *p2) |
32 | { | |
33 | const struct bssplit *bsp1 = p1; | |
34 | const struct bssplit *bsp2 = p2; | |
35 | ||
36 | return bsp1->perc < bsp2->perc; | |
37 | } | |
38 | ||
39 | static int str_bssplit_cb(void *data, const char *input) | |
40 | { | |
41 | struct thread_data *td = data; | |
42 | char *fname, *str, *p; | |
43 | unsigned int i, perc, perc_missing; | |
44 | unsigned int max_bs, min_bs; | |
45 | long long val; | |
46 | ||
47 | p = str = strdup(input); | |
48 | ||
49 | strip_blank_front(&str); | |
50 | strip_blank_end(str); | |
51 | ||
52 | td->o.bssplit_nr = 4; | |
53 | td->o.bssplit = malloc(4 * sizeof(struct bssplit)); | |
54 | ||
55 | i = 0; | |
56 | max_bs = 0; | |
57 | min_bs = -1; | |
58 | while ((fname = strsep(&str, ":")) != NULL) { | |
59 | char *perc_str; | |
60 | ||
61 | if (!strlen(fname)) | |
62 | break; | |
63 | ||
64 | /* | |
65 | * grow struct buffer, if needed | |
66 | */ | |
67 | if (i == td->o.bssplit_nr) { | |
68 | td->o.bssplit_nr <<= 1; | |
69 | td->o.bssplit = realloc(td->o.bssplit, td->o.bssplit_nr * sizeof(struct bssplit)); | |
70 | } | |
71 | ||
72 | perc_str = strstr(fname, "/"); | |
73 | if (perc_str) { | |
74 | *perc_str = '\0'; | |
75 | perc_str++; | |
76 | perc = atoi(perc_str); | |
77 | if (perc > 100) | |
78 | perc = 100; | |
79 | else if (!perc) | |
80 | perc = -1; | |
81 | } else | |
82 | perc = -1; | |
83 | ||
84 | if (str_to_decimal(fname, &val, 1)) { | |
85 | log_err("fio: bssplit conversion failed\n"); | |
86 | free(td->o.bssplit); | |
87 | return 1; | |
88 | } | |
89 | ||
90 | if (val > max_bs) | |
91 | max_bs = val; | |
92 | if (val < min_bs) | |
93 | min_bs = val; | |
94 | ||
95 | td->o.bssplit[i].bs = val; | |
96 | td->o.bssplit[i].perc = perc; | |
97 | i++; | |
98 | } | |
99 | ||
100 | td->o.bssplit_nr = i; | |
101 | ||
102 | /* | |
103 | * Now check if the percentages add up, and how much is missing | |
104 | */ | |
105 | perc = perc_missing = 0; | |
106 | for (i = 0; i < td->o.bssplit_nr; i++) { | |
107 | struct bssplit *bsp = &td->o.bssplit[i]; | |
108 | ||
109 | if (bsp->perc == (unsigned char) -1) | |
110 | perc_missing++; | |
111 | else | |
112 | perc += bsp->perc; | |
113 | } | |
114 | ||
115 | if (perc > 100) { | |
116 | log_err("fio: bssplit percentages add to more than 100%%\n"); | |
117 | free(td->o.bssplit); | |
118 | return 1; | |
119 | } | |
120 | /* | |
121 | * If values didn't have a percentage set, divide the remains between | |
122 | * them. | |
123 | */ | |
124 | if (perc_missing) { | |
125 | for (i = 0; i < td->o.bssplit_nr; i++) { | |
126 | struct bssplit *bsp = &td->o.bssplit[i]; | |
127 | ||
128 | if (bsp->perc == (unsigned char) -1) | |
129 | bsp->perc = (100 - perc) / perc_missing; | |
130 | } | |
131 | } | |
132 | ||
133 | td->o.min_bs[DDIR_READ] = td->o.min_bs[DDIR_WRITE] = min_bs; | |
134 | td->o.max_bs[DDIR_READ] = td->o.max_bs[DDIR_WRITE] = max_bs; | |
135 | ||
136 | /* | |
137 | * now sort based on percentages, for ease of lookup | |
138 | */ | |
139 | qsort(td->o.bssplit, td->o.bssplit_nr, sizeof(struct bssplit), bs_cmp); | |
140 | ||
141 | free(p); | |
142 | return 0; | |
143 | } | |
144 | ||
211097b2 JA |
145 | static int str_rw_cb(void *data, const char *str) |
146 | { | |
147 | struct thread_data *td = data; | |
148 | char *nr = get_opt_postfix(str); | |
149 | ||
fafdba3c | 150 | td->o.ddir_nr = 1; |
211097b2 JA |
151 | if (nr) |
152 | td->o.ddir_nr = atoi(nr); | |
153 | ||
211097b2 JA |
154 | return 0; |
155 | } | |
156 | ||
214e1eca JA |
157 | static int str_mem_cb(void *data, const char *mem) |
158 | { | |
159 | struct thread_data *td = data; | |
160 | ||
2dc1bbeb | 161 | if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) { |
214e1eca | 162 | td->mmapfile = get_opt_postfix(mem); |
2dc1bbeb | 163 | if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) { |
214e1eca JA |
164 | log_err("fio: mmaphuge:/path/to/file\n"); |
165 | return 1; | |
166 | } | |
167 | } | |
168 | ||
169 | return 0; | |
170 | } | |
171 | ||
172 | static int str_lockmem_cb(void fio_unused *data, unsigned long *val) | |
173 | { | |
174 | mlock_size = *val; | |
175 | return 0; | |
176 | } | |
177 | ||
178 | #ifdef FIO_HAVE_IOPRIO | |
179 | static int str_prioclass_cb(void *data, unsigned int *val) | |
180 | { | |
181 | struct thread_data *td = data; | |
6cefbe33 JA |
182 | unsigned short mask; |
183 | ||
184 | /* | |
185 | * mask off old class bits, str_prio_cb() may have set a default class | |
186 | */ | |
187 | mask = (1 << IOPRIO_CLASS_SHIFT) - 1; | |
188 | td->ioprio &= mask; | |
214e1eca JA |
189 | |
190 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; | |
ac684785 | 191 | td->ioprio_set = 1; |
214e1eca JA |
192 | return 0; |
193 | } | |
194 | ||
195 | static int str_prio_cb(void *data, unsigned int *val) | |
196 | { | |
197 | struct thread_data *td = data; | |
198 | ||
199 | td->ioprio |= *val; | |
6cefbe33 JA |
200 | |
201 | /* | |
202 | * If no class is set, assume BE | |
203 | */ | |
204 | if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) | |
205 | td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; | |
206 | ||
ac684785 | 207 | td->ioprio_set = 1; |
214e1eca JA |
208 | return 0; |
209 | } | |
210 | #endif | |
211 | ||
212 | static int str_exitall_cb(void) | |
213 | { | |
214 | exitall_on_terminate = 1; | |
215 | return 0; | |
216 | } | |
217 | ||
214e1eca | 218 | #ifdef FIO_HAVE_CPU_AFFINITY |
d2e268b0 JA |
219 | static int str_cpumask_cb(void *data, unsigned int *val) |
220 | { | |
221 | struct thread_data *td = data; | |
214e1eca JA |
222 | unsigned int i; |
223 | ||
d2e268b0 | 224 | CPU_ZERO(&td->o.cpumask); |
214e1eca | 225 | |
e600f7f1 | 226 | for (i = 0; i < sizeof(int) * 8; i++) |
d2e268b0 JA |
227 | if ((1 << i) & *val) |
228 | CPU_SET(*val, &td->o.cpumask); | |
229 | ||
230 | td->o.cpumask_set = 1; | |
231 | return 0; | |
214e1eca JA |
232 | } |
233 | ||
d2e268b0 | 234 | static int str_cpus_allowed_cb(void *data, const char *input) |
214e1eca JA |
235 | { |
236 | struct thread_data *td = data; | |
d2e268b0 JA |
237 | char *cpu, *str, *p; |
238 | ||
239 | CPU_ZERO(&td->o.cpumask); | |
240 | ||
241 | p = str = strdup(input); | |
214e1eca | 242 | |
d2e268b0 JA |
243 | strip_blank_front(&str); |
244 | strip_blank_end(str); | |
245 | ||
246 | while ((cpu = strsep(&str, ",")) != NULL) { | |
247 | if (!strlen(cpu)) | |
248 | break; | |
249 | CPU_SET(atoi(cpu), &td->o.cpumask); | |
250 | } | |
251 | ||
252 | free(p); | |
375b2695 | 253 | td->o.cpumask_set = 1; |
d2e268b0 | 254 | exit(0); |
214e1eca JA |
255 | return 0; |
256 | } | |
d2e268b0 | 257 | #endif |
214e1eca JA |
258 | |
259 | static int str_fst_cb(void *data, const char *str) | |
260 | { | |
261 | struct thread_data *td = data; | |
262 | char *nr = get_opt_postfix(str); | |
263 | ||
264 | td->file_service_nr = 1; | |
265 | if (nr) | |
266 | td->file_service_nr = atoi(nr); | |
267 | ||
268 | return 0; | |
269 | } | |
270 | ||
271 | static int str_filename_cb(void *data, const char *input) | |
272 | { | |
273 | struct thread_data *td = data; | |
274 | char *fname, *str, *p; | |
275 | ||
276 | p = str = strdup(input); | |
277 | ||
278 | strip_blank_front(&str); | |
279 | strip_blank_end(str); | |
280 | ||
281 | if (!td->files_index) | |
2dc1bbeb | 282 | td->o.nr_files = 0; |
214e1eca JA |
283 | |
284 | while ((fname = strsep(&str, ":")) != NULL) { | |
285 | if (!strlen(fname)) | |
286 | break; | |
287 | add_file(td, fname); | |
2dc1bbeb | 288 | td->o.nr_files++; |
214e1eca JA |
289 | } |
290 | ||
291 | free(p); | |
292 | return 0; | |
293 | } | |
294 | ||
295 | static int str_directory_cb(void *data, const char fio_unused *str) | |
296 | { | |
297 | struct thread_data *td = data; | |
298 | struct stat sb; | |
299 | ||
2dc1bbeb JA |
300 | if (lstat(td->o.directory, &sb) < 0) { |
301 | log_err("fio: %s is not a directory\n", td->o.directory); | |
214e1eca JA |
302 | td_verror(td, errno, "lstat"); |
303 | return 1; | |
304 | } | |
305 | if (!S_ISDIR(sb.st_mode)) { | |
2dc1bbeb | 306 | log_err("fio: %s is not a directory\n", td->o.directory); |
214e1eca JA |
307 | return 1; |
308 | } | |
309 | ||
310 | return 0; | |
311 | } | |
312 | ||
313 | static int str_opendir_cb(void *data, const char fio_unused *str) | |
314 | { | |
315 | struct thread_data *td = data; | |
316 | ||
317 | if (!td->files_index) | |
2dc1bbeb | 318 | td->o.nr_files = 0; |
214e1eca | 319 | |
2dc1bbeb | 320 | return add_dir_files(td, td->o.opendir); |
214e1eca JA |
321 | } |
322 | ||
a59e170d | 323 | static int str_verify_offset_cb(void *data, unsigned int *off) |
546a9142 SL |
324 | { |
325 | struct thread_data *td = data; | |
a59e170d | 326 | |
546a9142 | 327 | if (*off && *off < sizeof(struct verify_header)) { |
a59e170d | 328 | log_err("fio: verify_offset too small\n"); |
546a9142 SL |
329 | return 1; |
330 | } | |
a59e170d JA |
331 | |
332 | td->o.verify_offset = *off; | |
546a9142 SL |
333 | return 0; |
334 | } | |
335 | ||
e28218f3 | 336 | static int str_verify_pattern_cb(void *data, unsigned int *off) |
90059d65 JA |
337 | { |
338 | struct thread_data *td = data; | |
e28218f3 | 339 | unsigned int msb; |
90059d65 | 340 | |
e28218f3 | 341 | msb = fls(*off); |
90059d65 JA |
342 | if (msb <= 8) |
343 | td->o.verify_pattern_bytes = 1; | |
344 | else if (msb <= 16) | |
345 | td->o.verify_pattern_bytes = 2; | |
346 | else if (msb <= 24) | |
347 | td->o.verify_pattern_bytes = 3; | |
348 | else | |
349 | td->o.verify_pattern_bytes = 4; | |
350 | ||
e28218f3 | 351 | td->o.verify_pattern = *off; |
90059d65 JA |
352 | return 0; |
353 | } | |
214e1eca JA |
354 | |
355 | #define __stringify_1(x) #x | |
356 | #define __stringify(x) __stringify_1(x) | |
357 | ||
358 | /* | |
359 | * Map of job/command line options | |
360 | */ | |
361 | static struct fio_option options[] = { | |
362 | { | |
363 | .name = "description", | |
364 | .type = FIO_OPT_STR_STORE, | |
365 | .off1 = td_var_offset(description), | |
366 | .help = "Text job description", | |
367 | }, | |
368 | { | |
369 | .name = "name", | |
370 | .type = FIO_OPT_STR_STORE, | |
371 | .off1 = td_var_offset(name), | |
372 | .help = "Name of this job", | |
373 | }, | |
374 | { | |
375 | .name = "directory", | |
376 | .type = FIO_OPT_STR_STORE, | |
377 | .off1 = td_var_offset(directory), | |
378 | .cb = str_directory_cb, | |
379 | .help = "Directory to store files in", | |
380 | }, | |
381 | { | |
382 | .name = "filename", | |
383 | .type = FIO_OPT_STR_STORE, | |
384 | .off1 = td_var_offset(filename), | |
385 | .cb = str_filename_cb, | |
386 | .help = "File(s) to use for the workload", | |
387 | }, | |
388 | { | |
389 | .name = "opendir", | |
390 | .type = FIO_OPT_STR_STORE, | |
391 | .off1 = td_var_offset(opendir), | |
392 | .cb = str_opendir_cb, | |
393 | .help = "Recursively add files from this directory and down", | |
394 | }, | |
395 | { | |
396 | .name = "rw", | |
d3aad8f2 | 397 | .alias = "readwrite", |
214e1eca | 398 | .type = FIO_OPT_STR, |
211097b2 | 399 | .cb = str_rw_cb, |
214e1eca JA |
400 | .off1 = td_var_offset(td_ddir), |
401 | .help = "IO direction", | |
402 | .def = "read", | |
403 | .posval = { | |
404 | { .ival = "read", | |
405 | .oval = TD_DDIR_READ, | |
406 | .help = "Sequential read", | |
407 | }, | |
408 | { .ival = "write", | |
409 | .oval = TD_DDIR_WRITE, | |
410 | .help = "Sequential write", | |
411 | }, | |
412 | { .ival = "randread", | |
413 | .oval = TD_DDIR_RANDREAD, | |
414 | .help = "Random read", | |
415 | }, | |
416 | { .ival = "randwrite", | |
417 | .oval = TD_DDIR_RANDWRITE, | |
418 | .help = "Random write", | |
419 | }, | |
420 | { .ival = "rw", | |
421 | .oval = TD_DDIR_RW, | |
422 | .help = "Sequential read and write mix", | |
423 | }, | |
424 | { .ival = "randrw", | |
425 | .oval = TD_DDIR_RANDRW, | |
426 | .help = "Random read and write mix" | |
427 | }, | |
428 | }, | |
429 | }, | |
430 | { | |
431 | .name = "ioengine", | |
432 | .type = FIO_OPT_STR_STORE, | |
433 | .off1 = td_var_offset(ioengine), | |
434 | .help = "IO engine to use", | |
435 | .def = "sync", | |
436 | .posval = { | |
437 | { .ival = "sync", | |
438 | .help = "Use read/write", | |
439 | }, | |
a31041ea | 440 | { .ival = "psync", |
441 | .help = "Use pread/pwrite", | |
442 | }, | |
214e1eca JA |
443 | #ifdef FIO_HAVE_LIBAIO |
444 | { .ival = "libaio", | |
445 | .help = "Linux native asynchronous IO", | |
446 | }, | |
447 | #endif | |
448 | #ifdef FIO_HAVE_POSIXAIO | |
449 | { .ival = "posixaio", | |
450 | .help = "POSIX asynchronous IO", | |
451 | }, | |
452 | #endif | |
453 | { .ival = "mmap", | |
454 | .help = "Memory mapped IO", | |
455 | }, | |
456 | #ifdef FIO_HAVE_SPLICE | |
457 | { .ival = "splice", | |
458 | .help = "splice/vmsplice based IO", | |
459 | }, | |
9cce02e8 JA |
460 | { .ival = "netsplice", |
461 | .help = "splice/vmsplice to/from the network", | |
462 | }, | |
214e1eca JA |
463 | #endif |
464 | #ifdef FIO_HAVE_SGIO | |
465 | { .ival = "sg", | |
466 | .help = "SCSI generic v3 IO", | |
467 | }, | |
468 | #endif | |
469 | { .ival = "null", | |
470 | .help = "Testing engine (no data transfer)", | |
471 | }, | |
472 | { .ival = "net", | |
473 | .help = "Network IO", | |
474 | }, | |
475 | #ifdef FIO_HAVE_SYSLET | |
476 | { .ival = "syslet-rw", | |
477 | .help = "syslet enabled async pread/pwrite IO", | |
478 | }, | |
479 | #endif | |
480 | { .ival = "cpuio", | |
481 | .help = "CPU cycler burner engine", | |
482 | }, | |
b8c82a46 JA |
483 | #ifdef FIO_HAVE_GUASI |
484 | { .ival = "guasi", | |
485 | .help = "GUASI IO engine", | |
486 | }, | |
487 | #endif | |
214e1eca JA |
488 | { .ival = "external", |
489 | .help = "Load external engine (append name)", | |
490 | }, | |
491 | }, | |
492 | }, | |
493 | { | |
494 | .name = "iodepth", | |
495 | .type = FIO_OPT_INT, | |
496 | .off1 = td_var_offset(iodepth), | |
497 | .help = "Amount of IO buffers to keep in flight", | |
757aff4f | 498 | .minval = 1, |
214e1eca JA |
499 | .def = "1", |
500 | }, | |
501 | { | |
502 | .name = "iodepth_batch", | |
503 | .type = FIO_OPT_INT, | |
504 | .off1 = td_var_offset(iodepth_batch), | |
505 | .help = "Number of IO to submit in one go", | |
afdf9352 | 506 | .parent = "iodepth", |
214e1eca JA |
507 | }, |
508 | { | |
509 | .name = "iodepth_low", | |
510 | .type = FIO_OPT_INT, | |
511 | .off1 = td_var_offset(iodepth_low), | |
512 | .help = "Low water mark for queuing depth", | |
afdf9352 | 513 | .parent = "iodepth", |
214e1eca JA |
514 | }, |
515 | { | |
516 | .name = "size", | |
517 | .type = FIO_OPT_STR_VAL, | |
2dc1bbeb | 518 | .off1 = td_var_offset(size), |
c3edbdba | 519 | .minval = 1, |
214e1eca JA |
520 | .help = "Total size of device or files", |
521 | }, | |
aa31f1f1 SL |
522 | { |
523 | .name = "fill_device", | |
524 | .type = FIO_OPT_BOOL, | |
525 | .off1 = td_var_offset(fill_device), | |
526 | .help = "Write until an ENOSPC error occurs", | |
527 | .def = "0", | |
528 | }, | |
214e1eca JA |
529 | { |
530 | .name = "filesize", | |
531 | .type = FIO_OPT_STR_VAL, | |
532 | .off1 = td_var_offset(file_size_low), | |
533 | .off2 = td_var_offset(file_size_high), | |
c3edbdba | 534 | .minval = 1, |
214e1eca JA |
535 | .help = "Size of individual files", |
536 | }, | |
67a1000f JA |
537 | { |
538 | .name = "offset", | |
539 | .alias = "fileoffset", | |
540 | .type = FIO_OPT_STR_VAL, | |
541 | .off1 = td_var_offset(start_offset), | |
542 | .help = "Start IO from this offset", | |
543 | .def = "0", | |
544 | }, | |
214e1eca JA |
545 | { |
546 | .name = "bs", | |
d3aad8f2 | 547 | .alias = "blocksize", |
214e1eca JA |
548 | .type = FIO_OPT_STR_VAL_INT, |
549 | .off1 = td_var_offset(bs[DDIR_READ]), | |
550 | .off2 = td_var_offset(bs[DDIR_WRITE]), | |
c3edbdba | 551 | .minval = 1, |
214e1eca JA |
552 | .help = "Block size unit", |
553 | .def = "4k", | |
67a1000f | 554 | .parent = "rw", |
214e1eca JA |
555 | }, |
556 | { | |
557 | .name = "bsrange", | |
d3aad8f2 | 558 | .alias = "blocksize_range", |
214e1eca JA |
559 | .type = FIO_OPT_RANGE, |
560 | .off1 = td_var_offset(min_bs[DDIR_READ]), | |
561 | .off2 = td_var_offset(max_bs[DDIR_READ]), | |
562 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), | |
563 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), | |
c3edbdba | 564 | .minval = 1, |
214e1eca | 565 | .help = "Set block size range (in more detail than bs)", |
67a1000f | 566 | .parent = "rw", |
214e1eca | 567 | }, |
564ca972 JA |
568 | { |
569 | .name = "bssplit", | |
570 | .type = FIO_OPT_STR, | |
571 | .cb = str_bssplit_cb, | |
572 | .help = "Set a specific mix of block sizes", | |
573 | .parent = "rw", | |
574 | }, | |
214e1eca JA |
575 | { |
576 | .name = "bs_unaligned", | |
d3aad8f2 | 577 | .alias = "blocksize_unaligned", |
214e1eca JA |
578 | .type = FIO_OPT_STR_SET, |
579 | .off1 = td_var_offset(bs_unaligned), | |
580 | .help = "Don't sector align IO buffer sizes", | |
67a1000f | 581 | .parent = "rw", |
214e1eca JA |
582 | }, |
583 | { | |
584 | .name = "randrepeat", | |
585 | .type = FIO_OPT_BOOL, | |
586 | .off1 = td_var_offset(rand_repeatable), | |
587 | .help = "Use repeatable random IO pattern", | |
588 | .def = "1", | |
67a1000f | 589 | .parent = "rw", |
214e1eca JA |
590 | }, |
591 | { | |
592 | .name = "norandommap", | |
593 | .type = FIO_OPT_STR_SET, | |
594 | .off1 = td_var_offset(norandommap), | |
595 | .help = "Accept potential duplicate random blocks", | |
67a1000f | 596 | .parent = "rw", |
214e1eca JA |
597 | }, |
598 | { | |
599 | .name = "nrfiles", | |
600 | .type = FIO_OPT_INT, | |
601 | .off1 = td_var_offset(nr_files), | |
602 | .help = "Split job workload between this number of files", | |
603 | .def = "1", | |
604 | }, | |
605 | { | |
606 | .name = "openfiles", | |
607 | .type = FIO_OPT_INT, | |
608 | .off1 = td_var_offset(open_files), | |
609 | .help = "Number of files to keep open at the same time", | |
610 | }, | |
611 | { | |
612 | .name = "file_service_type", | |
613 | .type = FIO_OPT_STR, | |
614 | .cb = str_fst_cb, | |
615 | .off1 = td_var_offset(file_service_type), | |
616 | .help = "How to select which file to service next", | |
617 | .def = "roundrobin", | |
618 | .posval = { | |
619 | { .ival = "random", | |
620 | .oval = FIO_FSERVICE_RANDOM, | |
621 | .help = "Choose a file at random", | |
622 | }, | |
623 | { .ival = "roundrobin", | |
624 | .oval = FIO_FSERVICE_RR, | |
625 | .help = "Round robin select files", | |
626 | }, | |
627 | }, | |
67a1000f JA |
628 | .parent = "nrfiles", |
629 | }, | |
630 | { | |
631 | .name = "fadvise_hint", | |
632 | .type = FIO_OPT_BOOL, | |
633 | .off1 = td_var_offset(fadvise_hint), | |
634 | .help = "Use fadvise() to advise the kernel on IO pattern", | |
635 | .def = "1", | |
214e1eca JA |
636 | }, |
637 | { | |
638 | .name = "fsync", | |
639 | .type = FIO_OPT_INT, | |
640 | .off1 = td_var_offset(fsync_blocks), | |
641 | .help = "Issue fsync for writes every given number of blocks", | |
642 | .def = "0", | |
643 | }, | |
644 | { | |
645 | .name = "direct", | |
646 | .type = FIO_OPT_BOOL, | |
647 | .off1 = td_var_offset(odirect), | |
648 | .help = "Use O_DIRECT IO (negates buffered)", | |
649 | .def = "0", | |
650 | }, | |
651 | { | |
652 | .name = "buffered", | |
653 | .type = FIO_OPT_BOOL, | |
654 | .off1 = td_var_offset(odirect), | |
655 | .neg = 1, | |
656 | .help = "Use buffered IO (negates direct)", | |
657 | .def = "1", | |
658 | }, | |
659 | { | |
660 | .name = "overwrite", | |
661 | .type = FIO_OPT_BOOL, | |
662 | .off1 = td_var_offset(overwrite), | |
663 | .help = "When writing, set whether to overwrite current data", | |
664 | .def = "0", | |
665 | }, | |
666 | { | |
667 | .name = "loops", | |
668 | .type = FIO_OPT_INT, | |
669 | .off1 = td_var_offset(loops), | |
670 | .help = "Number of times to run the job", | |
671 | .def = "1", | |
672 | }, | |
673 | { | |
674 | .name = "numjobs", | |
675 | .type = FIO_OPT_INT, | |
676 | .off1 = td_var_offset(numjobs), | |
677 | .help = "Duplicate this job this many times", | |
678 | .def = "1", | |
679 | }, | |
680 | { | |
681 | .name = "startdelay", | |
682 | .type = FIO_OPT_INT, | |
683 | .off1 = td_var_offset(start_delay), | |
684 | .help = "Only start job when this period has passed", | |
685 | .def = "0", | |
686 | }, | |
687 | { | |
688 | .name = "runtime", | |
689 | .alias = "timeout", | |
690 | .type = FIO_OPT_STR_VAL_TIME, | |
691 | .off1 = td_var_offset(timeout), | |
692 | .help = "Stop workload when this amount of time has passed", | |
693 | .def = "0", | |
694 | }, | |
cf4464ca JA |
695 | { |
696 | .name = "time_based", | |
697 | .type = FIO_OPT_STR_SET, | |
698 | .off1 = td_var_offset(time_based), | |
699 | .help = "Keep running until runtime/timeout is met", | |
700 | }, | |
214e1eca JA |
701 | { |
702 | .name = "mem", | |
d3aad8f2 | 703 | .alias = "iomem", |
214e1eca JA |
704 | .type = FIO_OPT_STR, |
705 | .cb = str_mem_cb, | |
706 | .off1 = td_var_offset(mem_type), | |
707 | .help = "Backing type for IO buffers", | |
708 | .def = "malloc", | |
709 | .posval = { | |
710 | { .ival = "malloc", | |
711 | .oval = MEM_MALLOC, | |
712 | .help = "Use malloc(3) for IO buffers", | |
713 | }, | |
37c8cdfe JA |
714 | { .ival = "shm", |
715 | .oval = MEM_SHM, | |
716 | .help = "Use shared memory segments for IO buffers", | |
717 | }, | |
214e1eca JA |
718 | #ifdef FIO_HAVE_HUGETLB |
719 | { .ival = "shmhuge", | |
720 | .oval = MEM_SHMHUGE, | |
721 | .help = "Like shm, but use huge pages", | |
722 | }, | |
b370e46a | 723 | #endif |
37c8cdfe JA |
724 | { .ival = "mmap", |
725 | .oval = MEM_MMAP, | |
726 | .help = "Use mmap(2) (file or anon) for IO buffers", | |
727 | }, | |
214e1eca JA |
728 | #ifdef FIO_HAVE_HUGETLB |
729 | { .ival = "mmaphuge", | |
730 | .oval = MEM_MMAPHUGE, | |
731 | .help = "Like mmap, but use huge pages", | |
732 | }, | |
733 | #endif | |
734 | }, | |
735 | }, | |
736 | { | |
737 | .name = "verify", | |
738 | .type = FIO_OPT_STR, | |
739 | .off1 = td_var_offset(verify), | |
740 | .help = "Verify data written", | |
741 | .def = "0", | |
742 | .posval = { | |
743 | { .ival = "0", | |
744 | .oval = VERIFY_NONE, | |
745 | .help = "Don't do IO verification", | |
746 | }, | |
fcca4b58 JA |
747 | { .ival = "md5", |
748 | .oval = VERIFY_MD5, | |
749 | .help = "Use md5 checksums for verification", | |
750 | }, | |
d77a7af3 JA |
751 | { .ival = "crc64", |
752 | .oval = VERIFY_CRC64, | |
753 | .help = "Use crc64 checksums for verification", | |
754 | }, | |
214e1eca JA |
755 | { .ival = "crc32", |
756 | .oval = VERIFY_CRC32, | |
757 | .help = "Use crc32 checksums for verification", | |
758 | }, | |
969f7ed3 JA |
759 | { .ival = "crc16", |
760 | .oval = VERIFY_CRC16, | |
761 | .help = "Use crc16 checksums for verification", | |
762 | }, | |
1e154bdb JA |
763 | { .ival = "crc7", |
764 | .oval = VERIFY_CRC7, | |
765 | .help = "Use crc7 checksums for verification", | |
766 | }, | |
cd14cc10 JA |
767 | { .ival = "sha256", |
768 | .oval = VERIFY_SHA256, | |
769 | .help = "Use sha256 checksums for verification", | |
770 | }, | |
771 | { .ival = "sha512", | |
772 | .oval = VERIFY_SHA512, | |
773 | .help = "Use sha512 checksums for verification", | |
774 | }, | |
7437ee87 SL |
775 | { .ival = "meta", |
776 | .oval = VERIFY_META, | |
777 | .help = "Use io information", | |
778 | }, | |
36690c9b JA |
779 | { |
780 | .ival = "null", | |
781 | .oval = VERIFY_NULL, | |
782 | .help = "Pretend to verify", | |
783 | }, | |
214e1eca JA |
784 | }, |
785 | }, | |
005c565a JA |
786 | { |
787 | .name = "do_verify", | |
68e1f29a | 788 | .type = FIO_OPT_BOOL, |
005c565a JA |
789 | .off1 = td_var_offset(do_verify), |
790 | .help = "Run verification stage after write", | |
791 | .def = "1", | |
792 | .parent = "verify", | |
793 | }, | |
160b966d JA |
794 | { |
795 | .name = "verifysort", | |
796 | .type = FIO_OPT_BOOL, | |
797 | .off1 = td_var_offset(verifysort), | |
798 | .help = "Sort written verify blocks for read back", | |
799 | .def = "1", | |
c83f2df1 | 800 | .parent = "verify", |
160b966d | 801 | }, |
3f9f4e26 | 802 | { |
a59e170d | 803 | .name = "verify_interval", |
3f9f4e26 | 804 | .type = FIO_OPT_STR_VAL_INT, |
a59e170d | 805 | .off1 = td_var_offset(verify_interval), |
819a9680 | 806 | .minval = 2 * sizeof(struct verify_header), |
a59e170d | 807 | .help = "Store verify buffer header every N bytes", |
afdf9352 | 808 | .parent = "verify", |
3f9f4e26 | 809 | }, |
546a9142 | 810 | { |
a59e170d | 811 | .name = "verify_offset", |
546a9142 | 812 | .type = FIO_OPT_STR_VAL_INT, |
a59e170d | 813 | .help = "Offset verify header location by N bytes", |
546a9142 | 814 | .def = "0", |
a59e170d | 815 | .cb = str_verify_offset_cb, |
afdf9352 | 816 | .parent = "verify", |
546a9142 | 817 | }, |
e28218f3 SL |
818 | { |
819 | .name = "verify_pattern", | |
820 | .type = FIO_OPT_INT, | |
821 | .cb = str_verify_pattern_cb, | |
822 | .help = "Fill pattern for IO buffers", | |
823 | .parent = "verify", | |
824 | }, | |
a12a3b4d JA |
825 | { |
826 | .name = "verify_fatal", | |
68e1f29a | 827 | .type = FIO_OPT_BOOL, |
a12a3b4d JA |
828 | .off1 = td_var_offset(verify_fatal), |
829 | .def = "0", | |
830 | .help = "Exit on a single verify failure, don't continue", | |
831 | .parent = "verify", | |
832 | }, | |
214e1eca JA |
833 | { |
834 | .name = "write_iolog", | |
835 | .type = FIO_OPT_STR_STORE, | |
836 | .off1 = td_var_offset(write_iolog_file), | |
837 | .help = "Store IO pattern to file", | |
838 | }, | |
839 | { | |
840 | .name = "read_iolog", | |
841 | .type = FIO_OPT_STR_STORE, | |
842 | .off1 = td_var_offset(read_iolog_file), | |
843 | .help = "Playback IO pattern from file", | |
844 | }, | |
845 | { | |
846 | .name = "exec_prerun", | |
847 | .type = FIO_OPT_STR_STORE, | |
848 | .off1 = td_var_offset(exec_prerun), | |
849 | .help = "Execute this file prior to running job", | |
850 | }, | |
851 | { | |
852 | .name = "exec_postrun", | |
853 | .type = FIO_OPT_STR_STORE, | |
854 | .off1 = td_var_offset(exec_postrun), | |
855 | .help = "Execute this file after running job", | |
856 | }, | |
857 | #ifdef FIO_HAVE_IOSCHED_SWITCH | |
858 | { | |
859 | .name = "ioscheduler", | |
860 | .type = FIO_OPT_STR_STORE, | |
861 | .off1 = td_var_offset(ioscheduler), | |
862 | .help = "Use this IO scheduler on the backing device", | |
863 | }, | |
864 | #endif | |
865 | { | |
866 | .name = "zonesize", | |
867 | .type = FIO_OPT_STR_VAL, | |
868 | .off1 = td_var_offset(zone_size), | |
869 | .help = "Give size of an IO zone", | |
870 | .def = "0", | |
871 | }, | |
872 | { | |
873 | .name = "zoneskip", | |
874 | .type = FIO_OPT_STR_VAL, | |
875 | .off1 = td_var_offset(zone_skip), | |
876 | .help = "Space between IO zones", | |
877 | .def = "0", | |
878 | }, | |
879 | { | |
880 | .name = "lockmem", | |
881 | .type = FIO_OPT_STR_VAL, | |
882 | .cb = str_lockmem_cb, | |
883 | .help = "Lock down this amount of memory", | |
884 | .def = "0", | |
885 | }, | |
214e1eca JA |
886 | { |
887 | .name = "rwmixread", | |
888 | .type = FIO_OPT_INT, | |
e47f799f | 889 | .off1 = td_var_offset(rwmix[DDIR_READ]), |
214e1eca JA |
890 | .maxval = 100, |
891 | .help = "Percentage of mixed workload that is reads", | |
892 | .def = "50", | |
893 | }, | |
894 | { | |
895 | .name = "rwmixwrite", | |
896 | .type = FIO_OPT_INT, | |
e47f799f | 897 | .off1 = td_var_offset(rwmix[DDIR_WRITE]), |
214e1eca JA |
898 | .maxval = 100, |
899 | .help = "Percentage of mixed workload that is writes", | |
900 | .def = "50", | |
901 | }, | |
afdf9352 JA |
902 | { |
903 | .name = "rwmixcycle", | |
904 | .type = FIO_OPT_INT, | |
905 | .off1 = td_var_offset(rwmixcycle), | |
906 | .help = "Cycle period for mixed read/write workloads (msec)", | |
907 | .def = "500", | |
908 | .parent = "rwmixread", | |
909 | }, | |
214e1eca JA |
910 | { |
911 | .name = "nice", | |
912 | .type = FIO_OPT_INT, | |
913 | .off1 = td_var_offset(nice), | |
914 | .help = "Set job CPU nice value", | |
915 | .minval = -19, | |
916 | .maxval = 20, | |
917 | .def = "0", | |
918 | }, | |
919 | #ifdef FIO_HAVE_IOPRIO | |
920 | { | |
921 | .name = "prio", | |
922 | .type = FIO_OPT_INT, | |
923 | .cb = str_prio_cb, | |
924 | .help = "Set job IO priority value", | |
925 | .minval = 0, | |
926 | .maxval = 7, | |
927 | }, | |
928 | { | |
929 | .name = "prioclass", | |
930 | .type = FIO_OPT_INT, | |
931 | .cb = str_prioclass_cb, | |
932 | .help = "Set job IO priority class", | |
933 | .minval = 0, | |
934 | .maxval = 3, | |
935 | }, | |
936 | #endif | |
937 | { | |
938 | .name = "thinktime", | |
939 | .type = FIO_OPT_INT, | |
940 | .off1 = td_var_offset(thinktime), | |
941 | .help = "Idle time between IO buffers (usec)", | |
942 | .def = "0", | |
943 | }, | |
944 | { | |
945 | .name = "thinktime_spin", | |
946 | .type = FIO_OPT_INT, | |
947 | .off1 = td_var_offset(thinktime_spin), | |
948 | .help = "Start think time by spinning this amount (usec)", | |
949 | .def = "0", | |
afdf9352 | 950 | .parent = "thinktime", |
214e1eca JA |
951 | }, |
952 | { | |
953 | .name = "thinktime_blocks", | |
954 | .type = FIO_OPT_INT, | |
955 | .off1 = td_var_offset(thinktime_blocks), | |
956 | .help = "IO buffer period between 'thinktime'", | |
957 | .def = "1", | |
afdf9352 | 958 | .parent = "thinktime", |
214e1eca JA |
959 | }, |
960 | { | |
961 | .name = "rate", | |
962 | .type = FIO_OPT_INT, | |
963 | .off1 = td_var_offset(rate), | |
964 | .help = "Set bandwidth rate", | |
965 | }, | |
966 | { | |
967 | .name = "ratemin", | |
968 | .type = FIO_OPT_INT, | |
969 | .off1 = td_var_offset(ratemin), | |
4e991c23 | 970 | .help = "Job must meet this rate or it will be shutdown", |
afdf9352 | 971 | .parent = "rate", |
4e991c23 JA |
972 | }, |
973 | { | |
974 | .name = "rate_iops", | |
975 | .type = FIO_OPT_INT, | |
976 | .off1 = td_var_offset(rate_iops), | |
977 | .help = "Limit IO used to this number of IO operations/sec", | |
978 | }, | |
979 | { | |
980 | .name = "rate_iops_min", | |
981 | .type = FIO_OPT_INT, | |
982 | .off1 = td_var_offset(rate_iops_min), | |
983 | .help = "Job must meet this rate or it will be shutdown", | |
afdf9352 | 984 | .parent = "rate_iops", |
214e1eca JA |
985 | }, |
986 | { | |
987 | .name = "ratecycle", | |
988 | .type = FIO_OPT_INT, | |
989 | .off1 = td_var_offset(ratecycle), | |
990 | .help = "Window average for rate limits (msec)", | |
991 | .def = "1000", | |
afdf9352 | 992 | .parent = "rate", |
214e1eca JA |
993 | }, |
994 | { | |
995 | .name = "invalidate", | |
996 | .type = FIO_OPT_BOOL, | |
997 | .off1 = td_var_offset(invalidate_cache), | |
998 | .help = "Invalidate buffer/page cache prior to running job", | |
999 | .def = "1", | |
1000 | }, | |
1001 | { | |
1002 | .name = "sync", | |
1003 | .type = FIO_OPT_BOOL, | |
1004 | .off1 = td_var_offset(sync_io), | |
1005 | .help = "Use O_SYNC for buffered writes", | |
1006 | .def = "0", | |
67a1000f | 1007 | .parent = "buffered", |
214e1eca JA |
1008 | }, |
1009 | { | |
1010 | .name = "bwavgtime", | |
1011 | .type = FIO_OPT_INT, | |
1012 | .off1 = td_var_offset(bw_avg_time), | |
1013 | .help = "Time window over which to calculate bandwidth (msec)", | |
1014 | .def = "500", | |
1015 | }, | |
1016 | { | |
1017 | .name = "create_serialize", | |
1018 | .type = FIO_OPT_BOOL, | |
1019 | .off1 = td_var_offset(create_serialize), | |
1020 | .help = "Serialize creating of job files", | |
1021 | .def = "1", | |
1022 | }, | |
1023 | { | |
1024 | .name = "create_fsync", | |
1025 | .type = FIO_OPT_BOOL, | |
1026 | .off1 = td_var_offset(create_fsync), | |
1027 | .help = "Fsync file after creation", | |
1028 | .def = "1", | |
1029 | }, | |
1030 | { | |
1031 | .name = "cpuload", | |
1032 | .type = FIO_OPT_INT, | |
1033 | .off1 = td_var_offset(cpuload), | |
1034 | .help = "Use this percentage of CPU", | |
1035 | }, | |
1036 | { | |
1037 | .name = "cpuchunks", | |
1038 | .type = FIO_OPT_INT, | |
1039 | .off1 = td_var_offset(cpucycle), | |
1040 | .help = "Length of the CPU burn cycles (usecs)", | |
1041 | .def = "50000", | |
67a1000f | 1042 | .parent = "cpuload", |
214e1eca JA |
1043 | }, |
1044 | #ifdef FIO_HAVE_CPU_AFFINITY | |
1045 | { | |
1046 | .name = "cpumask", | |
1047 | .type = FIO_OPT_INT, | |
1048 | .cb = str_cpumask_cb, | |
1049 | .help = "CPU affinity mask", | |
1050 | }, | |
d2e268b0 JA |
1051 | { |
1052 | .name = "cpus_allowed", | |
1053 | .type = FIO_OPT_STR, | |
1054 | .cb = str_cpus_allowed_cb, | |
1055 | .help = "Set CPUs allowed", | |
1056 | }, | |
214e1eca JA |
1057 | #endif |
1058 | { | |
1059 | .name = "end_fsync", | |
1060 | .type = FIO_OPT_BOOL, | |
1061 | .off1 = td_var_offset(end_fsync), | |
1062 | .help = "Include fsync at the end of job", | |
1063 | .def = "0", | |
1064 | }, | |
1065 | { | |
1066 | .name = "fsync_on_close", | |
1067 | .type = FIO_OPT_BOOL, | |
1068 | .off1 = td_var_offset(fsync_on_close), | |
1069 | .help = "fsync files on close", | |
1070 | .def = "0", | |
1071 | }, | |
1072 | { | |
1073 | .name = "unlink", | |
1074 | .type = FIO_OPT_BOOL, | |
1075 | .off1 = td_var_offset(unlink), | |
1076 | .help = "Unlink created files after job has completed", | |
1077 | .def = "0", | |
1078 | }, | |
1079 | { | |
1080 | .name = "exitall", | |
1081 | .type = FIO_OPT_STR_SET, | |
1082 | .cb = str_exitall_cb, | |
1083 | .help = "Terminate all jobs when one exits", | |
1084 | }, | |
1085 | { | |
1086 | .name = "stonewall", | |
1087 | .type = FIO_OPT_STR_SET, | |
1088 | .off1 = td_var_offset(stonewall), | |
1089 | .help = "Insert a hard barrier between this job and previous", | |
1090 | }, | |
b3d62a75 JA |
1091 | { |
1092 | .name = "new_group", | |
1093 | .type = FIO_OPT_STR_SET, | |
1094 | .off1 = td_var_offset(new_group), | |
1095 | .help = "Mark the start of a new group (for reporting)", | |
1096 | }, | |
214e1eca JA |
1097 | { |
1098 | .name = "thread", | |
1099 | .type = FIO_OPT_STR_SET, | |
1100 | .off1 = td_var_offset(use_thread), | |
1101 | .help = "Use threads instead of forks", | |
1102 | }, | |
1103 | { | |
1104 | .name = "write_bw_log", | |
1105 | .type = FIO_OPT_STR_SET, | |
1106 | .off1 = td_var_offset(write_bw_log), | |
1107 | .help = "Write log of bandwidth during run", | |
1108 | }, | |
1109 | { | |
1110 | .name = "write_lat_log", | |
1111 | .type = FIO_OPT_STR_SET, | |
1112 | .off1 = td_var_offset(write_lat_log), | |
1113 | .help = "Write log of latency during run", | |
1114 | }, | |
1115 | { | |
1116 | .name = "hugepage-size", | |
1117 | .type = FIO_OPT_STR_VAL, | |
1118 | .off1 = td_var_offset(hugepage_size), | |
1119 | .help = "When using hugepages, specify size of each page", | |
1120 | .def = __stringify(FIO_HUGE_PAGE), | |
1121 | }, | |
1122 | { | |
1123 | .name = "group_reporting", | |
1124 | .type = FIO_OPT_STR_SET, | |
1125 | .off1 = td_var_offset(group_reporting), | |
1126 | .help = "Do reporting on a per-group basis", | |
1127 | }, | |
e9459e5a JA |
1128 | { |
1129 | .name = "zero_buffers", | |
1130 | .type = FIO_OPT_STR_SET, | |
1131 | .off1 = td_var_offset(zero_buffers), | |
1132 | .help = "Init IO buffers to all zeroes", | |
1133 | }, | |
0a839f30 JA |
1134 | #ifdef FIO_HAVE_DISK_UTIL |
1135 | { | |
1136 | .name = "disk_util", | |
1137 | .type = FIO_OPT_BOOL, | |
1138 | .off1 = td_var_offset(do_disk_util), | |
1139 | .help = "Log disk utilization stats", | |
1140 | .def = "1", | |
1141 | }, | |
1142 | #endif | |
214e1eca JA |
1143 | { |
1144 | .name = NULL, | |
1145 | }, | |
1146 | }; | |
1147 | ||
1148 | void fio_options_dup_and_init(struct option *long_options) | |
1149 | { | |
1150 | struct fio_option *o; | |
1151 | unsigned int i; | |
1152 | ||
1153 | options_init(options); | |
1154 | ||
1155 | i = 0; | |
1156 | while (long_options[i].name) | |
1157 | i++; | |
1158 | ||
1159 | o = &options[0]; | |
1160 | while (o->name) { | |
1161 | long_options[i].name = o->name; | |
1162 | long_options[i].val = FIO_GETOPT_JOB; | |
1163 | if (o->type == FIO_OPT_STR_SET) | |
1164 | long_options[i].has_arg = no_argument; | |
1165 | else | |
1166 | long_options[i].has_arg = required_argument; | |
1167 | ||
1168 | i++; | |
1169 | o++; | |
1170 | assert(i < FIO_NR_OPTIONS); | |
1171 | } | |
1172 | } | |
1173 | ||
1174 | int fio_option_parse(struct thread_data *td, const char *opt) | |
1175 | { | |
1176 | return parse_option(opt, options, td); | |
1177 | } | |
1178 | ||
1179 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) | |
1180 | { | |
1181 | return parse_cmd_option(opt, val, options, td); | |
1182 | } | |
1183 | ||
1184 | void fio_fill_default_options(struct thread_data *td) | |
1185 | { | |
1186 | fill_default_options(td, options); | |
1187 | } | |
1188 | ||
1189 | int fio_show_option_help(const char *opt) | |
1190 | { | |
1191 | return show_cmd_help(options, opt); | |
1192 | } | |
d23bb327 JA |
1193 | |
1194 | static void __options_mem(struct thread_data *td, int alloc) | |
1195 | { | |
1196 | struct thread_options *o = &td->o; | |
1197 | struct fio_option *opt; | |
1198 | char **ptr; | |
1199 | int i; | |
1200 | ||
1201 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { | |
1202 | if (opt->type != FIO_OPT_STR_STORE) | |
1203 | continue; | |
1204 | ||
1205 | ptr = (void *) o + opt->off1; | |
1206 | if (*ptr) { | |
1207 | if (alloc) | |
1208 | *ptr = strdup(*ptr); | |
1209 | else { | |
1210 | free(*ptr); | |
1211 | *ptr = NULL; | |
1212 | } | |
1213 | } | |
1214 | } | |
1215 | } | |
1216 | ||
1217 | /* | |
1218 | * dupe FIO_OPT_STR_STORE options | |
1219 | */ | |
1220 | void options_mem_dupe(struct thread_data *td) | |
1221 | { | |
1222 | __options_mem(td, 1); | |
1223 | } | |
1224 | ||
22d66213 | 1225 | void options_mem_free(struct thread_data fio_unused *td) |
d23bb327 | 1226 | { |
22d66213 | 1227 | #if 0 |
d23bb327 | 1228 | __options_mem(td, 0); |
22d66213 | 1229 | #endif |
d23bb327 | 1230 | } |