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 | ||
bfb41d98 | 336 | static int str_verify_cb(void *data, const char *mem) |
90059d65 JA |
337 | { |
338 | struct thread_data *td = data; | |
bfb41d98 JA |
339 | unsigned int nr, msb; |
340 | char *pat; | |
90059d65 | 341 | |
bfb41d98 JA |
342 | if (td->o.verify != VERIFY_PATTERN) |
343 | return 0; | |
344 | ||
345 | pat = get_opt_postfix(mem); | |
346 | if (!pat) { | |
347 | log_err("fio: missing pattern\n"); | |
348 | return 1; | |
349 | } | |
350 | ||
351 | if (strstr(pat, "0x") || strstr(pat, "0X")) | |
352 | nr = strtol(pat, NULL, 16); | |
353 | else | |
354 | nr = strtol(pat, NULL, 16); | |
355 | ||
356 | msb = fls(nr); | |
90059d65 JA |
357 | if (msb <= 8) |
358 | td->o.verify_pattern_bytes = 1; | |
359 | else if (msb <= 16) | |
360 | td->o.verify_pattern_bytes = 2; | |
361 | else if (msb <= 24) | |
362 | td->o.verify_pattern_bytes = 3; | |
363 | else | |
364 | td->o.verify_pattern_bytes = 4; | |
365 | ||
bfb41d98 | 366 | td->o.verify_pattern = nr; |
90059d65 JA |
367 | return 0; |
368 | } | |
214e1eca JA |
369 | |
370 | #define __stringify_1(x) #x | |
371 | #define __stringify(x) __stringify_1(x) | |
372 | ||
373 | /* | |
374 | * Map of job/command line options | |
375 | */ | |
376 | static struct fio_option options[] = { | |
377 | { | |
378 | .name = "description", | |
379 | .type = FIO_OPT_STR_STORE, | |
380 | .off1 = td_var_offset(description), | |
381 | .help = "Text job description", | |
382 | }, | |
383 | { | |
384 | .name = "name", | |
385 | .type = FIO_OPT_STR_STORE, | |
386 | .off1 = td_var_offset(name), | |
387 | .help = "Name of this job", | |
388 | }, | |
389 | { | |
390 | .name = "directory", | |
391 | .type = FIO_OPT_STR_STORE, | |
392 | .off1 = td_var_offset(directory), | |
393 | .cb = str_directory_cb, | |
394 | .help = "Directory to store files in", | |
395 | }, | |
396 | { | |
397 | .name = "filename", | |
398 | .type = FIO_OPT_STR_STORE, | |
399 | .off1 = td_var_offset(filename), | |
400 | .cb = str_filename_cb, | |
401 | .help = "File(s) to use for the workload", | |
402 | }, | |
403 | { | |
404 | .name = "opendir", | |
405 | .type = FIO_OPT_STR_STORE, | |
406 | .off1 = td_var_offset(opendir), | |
407 | .cb = str_opendir_cb, | |
408 | .help = "Recursively add files from this directory and down", | |
409 | }, | |
410 | { | |
411 | .name = "rw", | |
d3aad8f2 | 412 | .alias = "readwrite", |
214e1eca | 413 | .type = FIO_OPT_STR, |
211097b2 | 414 | .cb = str_rw_cb, |
214e1eca JA |
415 | .off1 = td_var_offset(td_ddir), |
416 | .help = "IO direction", | |
417 | .def = "read", | |
418 | .posval = { | |
419 | { .ival = "read", | |
420 | .oval = TD_DDIR_READ, | |
421 | .help = "Sequential read", | |
422 | }, | |
423 | { .ival = "write", | |
424 | .oval = TD_DDIR_WRITE, | |
425 | .help = "Sequential write", | |
426 | }, | |
427 | { .ival = "randread", | |
428 | .oval = TD_DDIR_RANDREAD, | |
429 | .help = "Random read", | |
430 | }, | |
431 | { .ival = "randwrite", | |
432 | .oval = TD_DDIR_RANDWRITE, | |
433 | .help = "Random write", | |
434 | }, | |
435 | { .ival = "rw", | |
436 | .oval = TD_DDIR_RW, | |
437 | .help = "Sequential read and write mix", | |
438 | }, | |
439 | { .ival = "randrw", | |
440 | .oval = TD_DDIR_RANDRW, | |
441 | .help = "Random read and write mix" | |
442 | }, | |
443 | }, | |
444 | }, | |
445 | { | |
446 | .name = "ioengine", | |
447 | .type = FIO_OPT_STR_STORE, | |
448 | .off1 = td_var_offset(ioengine), | |
449 | .help = "IO engine to use", | |
450 | .def = "sync", | |
451 | .posval = { | |
452 | { .ival = "sync", | |
453 | .help = "Use read/write", | |
454 | }, | |
a31041ea | 455 | { .ival = "psync", |
456 | .help = "Use pread/pwrite", | |
457 | }, | |
214e1eca JA |
458 | #ifdef FIO_HAVE_LIBAIO |
459 | { .ival = "libaio", | |
460 | .help = "Linux native asynchronous IO", | |
461 | }, | |
462 | #endif | |
463 | #ifdef FIO_HAVE_POSIXAIO | |
464 | { .ival = "posixaio", | |
465 | .help = "POSIX asynchronous IO", | |
466 | }, | |
467 | #endif | |
468 | { .ival = "mmap", | |
469 | .help = "Memory mapped IO", | |
470 | }, | |
471 | #ifdef FIO_HAVE_SPLICE | |
472 | { .ival = "splice", | |
473 | .help = "splice/vmsplice based IO", | |
474 | }, | |
9cce02e8 JA |
475 | { .ival = "netsplice", |
476 | .help = "splice/vmsplice to/from the network", | |
477 | }, | |
214e1eca JA |
478 | #endif |
479 | #ifdef FIO_HAVE_SGIO | |
480 | { .ival = "sg", | |
481 | .help = "SCSI generic v3 IO", | |
482 | }, | |
483 | #endif | |
484 | { .ival = "null", | |
485 | .help = "Testing engine (no data transfer)", | |
486 | }, | |
487 | { .ival = "net", | |
488 | .help = "Network IO", | |
489 | }, | |
490 | #ifdef FIO_HAVE_SYSLET | |
491 | { .ival = "syslet-rw", | |
492 | .help = "syslet enabled async pread/pwrite IO", | |
493 | }, | |
494 | #endif | |
495 | { .ival = "cpuio", | |
496 | .help = "CPU cycler burner engine", | |
497 | }, | |
b8c82a46 JA |
498 | #ifdef FIO_HAVE_GUASI |
499 | { .ival = "guasi", | |
500 | .help = "GUASI IO engine", | |
501 | }, | |
502 | #endif | |
214e1eca JA |
503 | { .ival = "external", |
504 | .help = "Load external engine (append name)", | |
505 | }, | |
506 | }, | |
507 | }, | |
508 | { | |
509 | .name = "iodepth", | |
510 | .type = FIO_OPT_INT, | |
511 | .off1 = td_var_offset(iodepth), | |
512 | .help = "Amount of IO buffers to keep in flight", | |
757aff4f | 513 | .minval = 1, |
214e1eca JA |
514 | .def = "1", |
515 | }, | |
516 | { | |
517 | .name = "iodepth_batch", | |
518 | .type = FIO_OPT_INT, | |
519 | .off1 = td_var_offset(iodepth_batch), | |
520 | .help = "Number of IO to submit in one go", | |
afdf9352 | 521 | .parent = "iodepth", |
214e1eca JA |
522 | }, |
523 | { | |
524 | .name = "iodepth_low", | |
525 | .type = FIO_OPT_INT, | |
526 | .off1 = td_var_offset(iodepth_low), | |
527 | .help = "Low water mark for queuing depth", | |
afdf9352 | 528 | .parent = "iodepth", |
214e1eca JA |
529 | }, |
530 | { | |
531 | .name = "size", | |
532 | .type = FIO_OPT_STR_VAL, | |
2dc1bbeb | 533 | .off1 = td_var_offset(size), |
c3edbdba | 534 | .minval = 1, |
214e1eca JA |
535 | .help = "Total size of device or files", |
536 | }, | |
537 | { | |
538 | .name = "filesize", | |
539 | .type = FIO_OPT_STR_VAL, | |
540 | .off1 = td_var_offset(file_size_low), | |
541 | .off2 = td_var_offset(file_size_high), | |
c3edbdba | 542 | .minval = 1, |
214e1eca JA |
543 | .help = "Size of individual files", |
544 | }, | |
67a1000f JA |
545 | { |
546 | .name = "offset", | |
547 | .alias = "fileoffset", | |
548 | .type = FIO_OPT_STR_VAL, | |
549 | .off1 = td_var_offset(start_offset), | |
550 | .help = "Start IO from this offset", | |
551 | .def = "0", | |
552 | }, | |
214e1eca JA |
553 | { |
554 | .name = "bs", | |
d3aad8f2 | 555 | .alias = "blocksize", |
214e1eca JA |
556 | .type = FIO_OPT_STR_VAL_INT, |
557 | .off1 = td_var_offset(bs[DDIR_READ]), | |
558 | .off2 = td_var_offset(bs[DDIR_WRITE]), | |
c3edbdba | 559 | .minval = 1, |
214e1eca JA |
560 | .help = "Block size unit", |
561 | .def = "4k", | |
67a1000f | 562 | .parent = "rw", |
214e1eca JA |
563 | }, |
564 | { | |
565 | .name = "bsrange", | |
d3aad8f2 | 566 | .alias = "blocksize_range", |
214e1eca JA |
567 | .type = FIO_OPT_RANGE, |
568 | .off1 = td_var_offset(min_bs[DDIR_READ]), | |
569 | .off2 = td_var_offset(max_bs[DDIR_READ]), | |
570 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), | |
571 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), | |
c3edbdba | 572 | .minval = 1, |
214e1eca | 573 | .help = "Set block size range (in more detail than bs)", |
67a1000f | 574 | .parent = "rw", |
214e1eca | 575 | }, |
564ca972 JA |
576 | { |
577 | .name = "bssplit", | |
578 | .type = FIO_OPT_STR, | |
579 | .cb = str_bssplit_cb, | |
580 | .help = "Set a specific mix of block sizes", | |
581 | .parent = "rw", | |
582 | }, | |
214e1eca JA |
583 | { |
584 | .name = "bs_unaligned", | |
d3aad8f2 | 585 | .alias = "blocksize_unaligned", |
214e1eca JA |
586 | .type = FIO_OPT_STR_SET, |
587 | .off1 = td_var_offset(bs_unaligned), | |
588 | .help = "Don't sector align IO buffer sizes", | |
67a1000f | 589 | .parent = "rw", |
214e1eca JA |
590 | }, |
591 | { | |
592 | .name = "randrepeat", | |
593 | .type = FIO_OPT_BOOL, | |
594 | .off1 = td_var_offset(rand_repeatable), | |
595 | .help = "Use repeatable random IO pattern", | |
596 | .def = "1", | |
67a1000f | 597 | .parent = "rw", |
214e1eca JA |
598 | }, |
599 | { | |
600 | .name = "norandommap", | |
601 | .type = FIO_OPT_STR_SET, | |
602 | .off1 = td_var_offset(norandommap), | |
603 | .help = "Accept potential duplicate random blocks", | |
67a1000f | 604 | .parent = "rw", |
214e1eca JA |
605 | }, |
606 | { | |
607 | .name = "nrfiles", | |
608 | .type = FIO_OPT_INT, | |
609 | .off1 = td_var_offset(nr_files), | |
610 | .help = "Split job workload between this number of files", | |
611 | .def = "1", | |
612 | }, | |
613 | { | |
614 | .name = "openfiles", | |
615 | .type = FIO_OPT_INT, | |
616 | .off1 = td_var_offset(open_files), | |
617 | .help = "Number of files to keep open at the same time", | |
618 | }, | |
619 | { | |
620 | .name = "file_service_type", | |
621 | .type = FIO_OPT_STR, | |
622 | .cb = str_fst_cb, | |
623 | .off1 = td_var_offset(file_service_type), | |
624 | .help = "How to select which file to service next", | |
625 | .def = "roundrobin", | |
626 | .posval = { | |
627 | { .ival = "random", | |
628 | .oval = FIO_FSERVICE_RANDOM, | |
629 | .help = "Choose a file at random", | |
630 | }, | |
631 | { .ival = "roundrobin", | |
632 | .oval = FIO_FSERVICE_RR, | |
633 | .help = "Round robin select files", | |
634 | }, | |
635 | }, | |
67a1000f JA |
636 | .parent = "nrfiles", |
637 | }, | |
638 | { | |
639 | .name = "fadvise_hint", | |
640 | .type = FIO_OPT_BOOL, | |
641 | .off1 = td_var_offset(fadvise_hint), | |
642 | .help = "Use fadvise() to advise the kernel on IO pattern", | |
643 | .def = "1", | |
214e1eca JA |
644 | }, |
645 | { | |
646 | .name = "fsync", | |
647 | .type = FIO_OPT_INT, | |
648 | .off1 = td_var_offset(fsync_blocks), | |
649 | .help = "Issue fsync for writes every given number of blocks", | |
650 | .def = "0", | |
651 | }, | |
652 | { | |
653 | .name = "direct", | |
654 | .type = FIO_OPT_BOOL, | |
655 | .off1 = td_var_offset(odirect), | |
656 | .help = "Use O_DIRECT IO (negates buffered)", | |
657 | .def = "0", | |
658 | }, | |
659 | { | |
660 | .name = "buffered", | |
661 | .type = FIO_OPT_BOOL, | |
662 | .off1 = td_var_offset(odirect), | |
663 | .neg = 1, | |
664 | .help = "Use buffered IO (negates direct)", | |
665 | .def = "1", | |
666 | }, | |
667 | { | |
668 | .name = "overwrite", | |
669 | .type = FIO_OPT_BOOL, | |
670 | .off1 = td_var_offset(overwrite), | |
671 | .help = "When writing, set whether to overwrite current data", | |
672 | .def = "0", | |
673 | }, | |
674 | { | |
675 | .name = "loops", | |
676 | .type = FIO_OPT_INT, | |
677 | .off1 = td_var_offset(loops), | |
678 | .help = "Number of times to run the job", | |
679 | .def = "1", | |
680 | }, | |
681 | { | |
682 | .name = "numjobs", | |
683 | .type = FIO_OPT_INT, | |
684 | .off1 = td_var_offset(numjobs), | |
685 | .help = "Duplicate this job this many times", | |
686 | .def = "1", | |
687 | }, | |
688 | { | |
689 | .name = "startdelay", | |
690 | .type = FIO_OPT_INT, | |
691 | .off1 = td_var_offset(start_delay), | |
692 | .help = "Only start job when this period has passed", | |
693 | .def = "0", | |
694 | }, | |
695 | { | |
696 | .name = "runtime", | |
697 | .alias = "timeout", | |
698 | .type = FIO_OPT_STR_VAL_TIME, | |
699 | .off1 = td_var_offset(timeout), | |
700 | .help = "Stop workload when this amount of time has passed", | |
701 | .def = "0", | |
702 | }, | |
cf4464ca JA |
703 | { |
704 | .name = "time_based", | |
705 | .type = FIO_OPT_STR_SET, | |
706 | .off1 = td_var_offset(time_based), | |
707 | .help = "Keep running until runtime/timeout is met", | |
708 | }, | |
214e1eca JA |
709 | { |
710 | .name = "mem", | |
d3aad8f2 | 711 | .alias = "iomem", |
214e1eca JA |
712 | .type = FIO_OPT_STR, |
713 | .cb = str_mem_cb, | |
714 | .off1 = td_var_offset(mem_type), | |
715 | .help = "Backing type for IO buffers", | |
716 | .def = "malloc", | |
717 | .posval = { | |
718 | { .ival = "malloc", | |
719 | .oval = MEM_MALLOC, | |
720 | .help = "Use malloc(3) for IO buffers", | |
721 | }, | |
37c8cdfe JA |
722 | { .ival = "shm", |
723 | .oval = MEM_SHM, | |
724 | .help = "Use shared memory segments for IO buffers", | |
725 | }, | |
214e1eca JA |
726 | #ifdef FIO_HAVE_HUGETLB |
727 | { .ival = "shmhuge", | |
728 | .oval = MEM_SHMHUGE, | |
729 | .help = "Like shm, but use huge pages", | |
730 | }, | |
b370e46a | 731 | #endif |
37c8cdfe JA |
732 | { .ival = "mmap", |
733 | .oval = MEM_MMAP, | |
734 | .help = "Use mmap(2) (file or anon) for IO buffers", | |
735 | }, | |
214e1eca JA |
736 | #ifdef FIO_HAVE_HUGETLB |
737 | { .ival = "mmaphuge", | |
738 | .oval = MEM_MMAPHUGE, | |
739 | .help = "Like mmap, but use huge pages", | |
740 | }, | |
741 | #endif | |
742 | }, | |
743 | }, | |
744 | { | |
745 | .name = "verify", | |
746 | .type = FIO_OPT_STR, | |
747 | .off1 = td_var_offset(verify), | |
bfb41d98 | 748 | .cb = str_verify_cb, |
214e1eca JA |
749 | .help = "Verify data written", |
750 | .def = "0", | |
751 | .posval = { | |
752 | { .ival = "0", | |
753 | .oval = VERIFY_NONE, | |
754 | .help = "Don't do IO verification", | |
755 | }, | |
fcca4b58 JA |
756 | { .ival = "md5", |
757 | .oval = VERIFY_MD5, | |
758 | .help = "Use md5 checksums for verification", | |
759 | }, | |
d77a7af3 JA |
760 | { .ival = "crc64", |
761 | .oval = VERIFY_CRC64, | |
762 | .help = "Use crc64 checksums for verification", | |
763 | }, | |
214e1eca JA |
764 | { .ival = "crc32", |
765 | .oval = VERIFY_CRC32, | |
766 | .help = "Use crc32 checksums for verification", | |
767 | }, | |
969f7ed3 JA |
768 | { .ival = "crc16", |
769 | .oval = VERIFY_CRC16, | |
770 | .help = "Use crc16 checksums for verification", | |
771 | }, | |
1e154bdb JA |
772 | { .ival = "crc7", |
773 | .oval = VERIFY_CRC7, | |
774 | .help = "Use crc7 checksums for verification", | |
775 | }, | |
cd14cc10 JA |
776 | { .ival = "sha256", |
777 | .oval = VERIFY_SHA256, | |
778 | .help = "Use sha256 checksums for verification", | |
779 | }, | |
780 | { .ival = "sha512", | |
781 | .oval = VERIFY_SHA512, | |
782 | .help = "Use sha512 checksums for verification", | |
783 | }, | |
7437ee87 SL |
784 | { .ival = "meta", |
785 | .oval = VERIFY_META, | |
786 | .help = "Use io information", | |
787 | }, | |
bfb41d98 JA |
788 | { .ival = "pattern", |
789 | .oval = VERIFY_PATTERN, | |
790 | .help = "Verify a specific buffer pattern", | |
791 | }, | |
36690c9b JA |
792 | { |
793 | .ival = "null", | |
794 | .oval = VERIFY_NULL, | |
795 | .help = "Pretend to verify", | |
796 | }, | |
214e1eca JA |
797 | }, |
798 | }, | |
005c565a JA |
799 | { |
800 | .name = "do_verify", | |
68e1f29a | 801 | .type = FIO_OPT_BOOL, |
005c565a JA |
802 | .off1 = td_var_offset(do_verify), |
803 | .help = "Run verification stage after write", | |
804 | .def = "1", | |
805 | .parent = "verify", | |
806 | }, | |
160b966d JA |
807 | { |
808 | .name = "verifysort", | |
809 | .type = FIO_OPT_BOOL, | |
810 | .off1 = td_var_offset(verifysort), | |
811 | .help = "Sort written verify blocks for read back", | |
812 | .def = "1", | |
c83f2df1 | 813 | .parent = "verify", |
160b966d | 814 | }, |
3f9f4e26 | 815 | { |
a59e170d | 816 | .name = "verify_interval", |
3f9f4e26 | 817 | .type = FIO_OPT_STR_VAL_INT, |
a59e170d | 818 | .off1 = td_var_offset(verify_interval), |
819a9680 | 819 | .minval = 2 * sizeof(struct verify_header), |
a59e170d | 820 | .help = "Store verify buffer header every N bytes", |
afdf9352 | 821 | .parent = "verify", |
3f9f4e26 | 822 | }, |
546a9142 | 823 | { |
a59e170d | 824 | .name = "verify_offset", |
546a9142 | 825 | .type = FIO_OPT_STR_VAL_INT, |
a59e170d | 826 | .help = "Offset verify header location by N bytes", |
546a9142 | 827 | .def = "0", |
a59e170d | 828 | .cb = str_verify_offset_cb, |
afdf9352 | 829 | .parent = "verify", |
546a9142 | 830 | }, |
a12a3b4d JA |
831 | { |
832 | .name = "verify_fatal", | |
68e1f29a | 833 | .type = FIO_OPT_BOOL, |
a12a3b4d JA |
834 | .off1 = td_var_offset(verify_fatal), |
835 | .def = "0", | |
836 | .help = "Exit on a single verify failure, don't continue", | |
837 | .parent = "verify", | |
838 | }, | |
214e1eca JA |
839 | { |
840 | .name = "write_iolog", | |
841 | .type = FIO_OPT_STR_STORE, | |
842 | .off1 = td_var_offset(write_iolog_file), | |
843 | .help = "Store IO pattern to file", | |
844 | }, | |
845 | { | |
846 | .name = "read_iolog", | |
847 | .type = FIO_OPT_STR_STORE, | |
848 | .off1 = td_var_offset(read_iolog_file), | |
849 | .help = "Playback IO pattern from file", | |
850 | }, | |
851 | { | |
852 | .name = "exec_prerun", | |
853 | .type = FIO_OPT_STR_STORE, | |
854 | .off1 = td_var_offset(exec_prerun), | |
855 | .help = "Execute this file prior to running job", | |
856 | }, | |
857 | { | |
858 | .name = "exec_postrun", | |
859 | .type = FIO_OPT_STR_STORE, | |
860 | .off1 = td_var_offset(exec_postrun), | |
861 | .help = "Execute this file after running job", | |
862 | }, | |
863 | #ifdef FIO_HAVE_IOSCHED_SWITCH | |
864 | { | |
865 | .name = "ioscheduler", | |
866 | .type = FIO_OPT_STR_STORE, | |
867 | .off1 = td_var_offset(ioscheduler), | |
868 | .help = "Use this IO scheduler on the backing device", | |
869 | }, | |
870 | #endif | |
871 | { | |
872 | .name = "zonesize", | |
873 | .type = FIO_OPT_STR_VAL, | |
874 | .off1 = td_var_offset(zone_size), | |
875 | .help = "Give size of an IO zone", | |
876 | .def = "0", | |
877 | }, | |
878 | { | |
879 | .name = "zoneskip", | |
880 | .type = FIO_OPT_STR_VAL, | |
881 | .off1 = td_var_offset(zone_skip), | |
882 | .help = "Space between IO zones", | |
883 | .def = "0", | |
884 | }, | |
885 | { | |
886 | .name = "lockmem", | |
887 | .type = FIO_OPT_STR_VAL, | |
888 | .cb = str_lockmem_cb, | |
889 | .help = "Lock down this amount of memory", | |
890 | .def = "0", | |
891 | }, | |
214e1eca JA |
892 | { |
893 | .name = "rwmixread", | |
894 | .type = FIO_OPT_INT, | |
e47f799f | 895 | .off1 = td_var_offset(rwmix[DDIR_READ]), |
214e1eca JA |
896 | .maxval = 100, |
897 | .help = "Percentage of mixed workload that is reads", | |
898 | .def = "50", | |
899 | }, | |
900 | { | |
901 | .name = "rwmixwrite", | |
902 | .type = FIO_OPT_INT, | |
e47f799f | 903 | .off1 = td_var_offset(rwmix[DDIR_WRITE]), |
214e1eca JA |
904 | .maxval = 100, |
905 | .help = "Percentage of mixed workload that is writes", | |
906 | .def = "50", | |
907 | }, | |
afdf9352 JA |
908 | { |
909 | .name = "rwmixcycle", | |
910 | .type = FIO_OPT_INT, | |
911 | .off1 = td_var_offset(rwmixcycle), | |
912 | .help = "Cycle period for mixed read/write workloads (msec)", | |
913 | .def = "500", | |
914 | .parent = "rwmixread", | |
915 | }, | |
214e1eca JA |
916 | { |
917 | .name = "nice", | |
918 | .type = FIO_OPT_INT, | |
919 | .off1 = td_var_offset(nice), | |
920 | .help = "Set job CPU nice value", | |
921 | .minval = -19, | |
922 | .maxval = 20, | |
923 | .def = "0", | |
924 | }, | |
925 | #ifdef FIO_HAVE_IOPRIO | |
926 | { | |
927 | .name = "prio", | |
928 | .type = FIO_OPT_INT, | |
929 | .cb = str_prio_cb, | |
930 | .help = "Set job IO priority value", | |
931 | .minval = 0, | |
932 | .maxval = 7, | |
933 | }, | |
934 | { | |
935 | .name = "prioclass", | |
936 | .type = FIO_OPT_INT, | |
937 | .cb = str_prioclass_cb, | |
938 | .help = "Set job IO priority class", | |
939 | .minval = 0, | |
940 | .maxval = 3, | |
941 | }, | |
942 | #endif | |
943 | { | |
944 | .name = "thinktime", | |
945 | .type = FIO_OPT_INT, | |
946 | .off1 = td_var_offset(thinktime), | |
947 | .help = "Idle time between IO buffers (usec)", | |
948 | .def = "0", | |
949 | }, | |
950 | { | |
951 | .name = "thinktime_spin", | |
952 | .type = FIO_OPT_INT, | |
953 | .off1 = td_var_offset(thinktime_spin), | |
954 | .help = "Start think time by spinning this amount (usec)", | |
955 | .def = "0", | |
afdf9352 | 956 | .parent = "thinktime", |
214e1eca JA |
957 | }, |
958 | { | |
959 | .name = "thinktime_blocks", | |
960 | .type = FIO_OPT_INT, | |
961 | .off1 = td_var_offset(thinktime_blocks), | |
962 | .help = "IO buffer period between 'thinktime'", | |
963 | .def = "1", | |
afdf9352 | 964 | .parent = "thinktime", |
214e1eca JA |
965 | }, |
966 | { | |
967 | .name = "rate", | |
968 | .type = FIO_OPT_INT, | |
969 | .off1 = td_var_offset(rate), | |
970 | .help = "Set bandwidth rate", | |
971 | }, | |
972 | { | |
973 | .name = "ratemin", | |
974 | .type = FIO_OPT_INT, | |
975 | .off1 = td_var_offset(ratemin), | |
4e991c23 | 976 | .help = "Job must meet this rate or it will be shutdown", |
afdf9352 | 977 | .parent = "rate", |
4e991c23 JA |
978 | }, |
979 | { | |
980 | .name = "rate_iops", | |
981 | .type = FIO_OPT_INT, | |
982 | .off1 = td_var_offset(rate_iops), | |
983 | .help = "Limit IO used to this number of IO operations/sec", | |
984 | }, | |
985 | { | |
986 | .name = "rate_iops_min", | |
987 | .type = FIO_OPT_INT, | |
988 | .off1 = td_var_offset(rate_iops_min), | |
989 | .help = "Job must meet this rate or it will be shutdown", | |
afdf9352 | 990 | .parent = "rate_iops", |
214e1eca JA |
991 | }, |
992 | { | |
993 | .name = "ratecycle", | |
994 | .type = FIO_OPT_INT, | |
995 | .off1 = td_var_offset(ratecycle), | |
996 | .help = "Window average for rate limits (msec)", | |
997 | .def = "1000", | |
afdf9352 | 998 | .parent = "rate", |
214e1eca JA |
999 | }, |
1000 | { | |
1001 | .name = "invalidate", | |
1002 | .type = FIO_OPT_BOOL, | |
1003 | .off1 = td_var_offset(invalidate_cache), | |
1004 | .help = "Invalidate buffer/page cache prior to running job", | |
1005 | .def = "1", | |
1006 | }, | |
1007 | { | |
1008 | .name = "sync", | |
1009 | .type = FIO_OPT_BOOL, | |
1010 | .off1 = td_var_offset(sync_io), | |
1011 | .help = "Use O_SYNC for buffered writes", | |
1012 | .def = "0", | |
67a1000f | 1013 | .parent = "buffered", |
214e1eca JA |
1014 | }, |
1015 | { | |
1016 | .name = "bwavgtime", | |
1017 | .type = FIO_OPT_INT, | |
1018 | .off1 = td_var_offset(bw_avg_time), | |
1019 | .help = "Time window over which to calculate bandwidth (msec)", | |
1020 | .def = "500", | |
1021 | }, | |
1022 | { | |
1023 | .name = "create_serialize", | |
1024 | .type = FIO_OPT_BOOL, | |
1025 | .off1 = td_var_offset(create_serialize), | |
1026 | .help = "Serialize creating of job files", | |
1027 | .def = "1", | |
1028 | }, | |
1029 | { | |
1030 | .name = "create_fsync", | |
1031 | .type = FIO_OPT_BOOL, | |
1032 | .off1 = td_var_offset(create_fsync), | |
1033 | .help = "Fsync file after creation", | |
1034 | .def = "1", | |
1035 | }, | |
1036 | { | |
1037 | .name = "cpuload", | |
1038 | .type = FIO_OPT_INT, | |
1039 | .off1 = td_var_offset(cpuload), | |
1040 | .help = "Use this percentage of CPU", | |
1041 | }, | |
1042 | { | |
1043 | .name = "cpuchunks", | |
1044 | .type = FIO_OPT_INT, | |
1045 | .off1 = td_var_offset(cpucycle), | |
1046 | .help = "Length of the CPU burn cycles (usecs)", | |
1047 | .def = "50000", | |
67a1000f | 1048 | .parent = "cpuload", |
214e1eca JA |
1049 | }, |
1050 | #ifdef FIO_HAVE_CPU_AFFINITY | |
1051 | { | |
1052 | .name = "cpumask", | |
1053 | .type = FIO_OPT_INT, | |
1054 | .cb = str_cpumask_cb, | |
1055 | .help = "CPU affinity mask", | |
1056 | }, | |
d2e268b0 JA |
1057 | { |
1058 | .name = "cpus_allowed", | |
1059 | .type = FIO_OPT_STR, | |
1060 | .cb = str_cpus_allowed_cb, | |
1061 | .help = "Set CPUs allowed", | |
1062 | }, | |
214e1eca JA |
1063 | #endif |
1064 | { | |
1065 | .name = "end_fsync", | |
1066 | .type = FIO_OPT_BOOL, | |
1067 | .off1 = td_var_offset(end_fsync), | |
1068 | .help = "Include fsync at the end of job", | |
1069 | .def = "0", | |
1070 | }, | |
1071 | { | |
1072 | .name = "fsync_on_close", | |
1073 | .type = FIO_OPT_BOOL, | |
1074 | .off1 = td_var_offset(fsync_on_close), | |
1075 | .help = "fsync files on close", | |
1076 | .def = "0", | |
1077 | }, | |
1078 | { | |
1079 | .name = "unlink", | |
1080 | .type = FIO_OPT_BOOL, | |
1081 | .off1 = td_var_offset(unlink), | |
1082 | .help = "Unlink created files after job has completed", | |
1083 | .def = "0", | |
1084 | }, | |
1085 | { | |
1086 | .name = "exitall", | |
1087 | .type = FIO_OPT_STR_SET, | |
1088 | .cb = str_exitall_cb, | |
1089 | .help = "Terminate all jobs when one exits", | |
1090 | }, | |
1091 | { | |
1092 | .name = "stonewall", | |
1093 | .type = FIO_OPT_STR_SET, | |
1094 | .off1 = td_var_offset(stonewall), | |
1095 | .help = "Insert a hard barrier between this job and previous", | |
1096 | }, | |
b3d62a75 JA |
1097 | { |
1098 | .name = "new_group", | |
1099 | .type = FIO_OPT_STR_SET, | |
1100 | .off1 = td_var_offset(new_group), | |
1101 | .help = "Mark the start of a new group (for reporting)", | |
1102 | }, | |
214e1eca JA |
1103 | { |
1104 | .name = "thread", | |
1105 | .type = FIO_OPT_STR_SET, | |
1106 | .off1 = td_var_offset(use_thread), | |
1107 | .help = "Use threads instead of forks", | |
1108 | }, | |
1109 | { | |
1110 | .name = "write_bw_log", | |
1111 | .type = FIO_OPT_STR_SET, | |
1112 | .off1 = td_var_offset(write_bw_log), | |
1113 | .help = "Write log of bandwidth during run", | |
1114 | }, | |
1115 | { | |
1116 | .name = "write_lat_log", | |
1117 | .type = FIO_OPT_STR_SET, | |
1118 | .off1 = td_var_offset(write_lat_log), | |
1119 | .help = "Write log of latency during run", | |
1120 | }, | |
1121 | { | |
1122 | .name = "hugepage-size", | |
1123 | .type = FIO_OPT_STR_VAL, | |
1124 | .off1 = td_var_offset(hugepage_size), | |
1125 | .help = "When using hugepages, specify size of each page", | |
1126 | .def = __stringify(FIO_HUGE_PAGE), | |
1127 | }, | |
1128 | { | |
1129 | .name = "group_reporting", | |
1130 | .type = FIO_OPT_STR_SET, | |
1131 | .off1 = td_var_offset(group_reporting), | |
1132 | .help = "Do reporting on a per-group basis", | |
1133 | }, | |
e9459e5a JA |
1134 | { |
1135 | .name = "zero_buffers", | |
1136 | .type = FIO_OPT_STR_SET, | |
1137 | .off1 = td_var_offset(zero_buffers), | |
1138 | .help = "Init IO buffers to all zeroes", | |
1139 | }, | |
0a839f30 JA |
1140 | #ifdef FIO_HAVE_DISK_UTIL |
1141 | { | |
1142 | .name = "disk_util", | |
1143 | .type = FIO_OPT_BOOL, | |
1144 | .off1 = td_var_offset(do_disk_util), | |
1145 | .help = "Log disk utilization stats", | |
1146 | .def = "1", | |
1147 | }, | |
1148 | #endif | |
214e1eca JA |
1149 | { |
1150 | .name = NULL, | |
1151 | }, | |
1152 | }; | |
1153 | ||
1154 | void fio_options_dup_and_init(struct option *long_options) | |
1155 | { | |
1156 | struct fio_option *o; | |
1157 | unsigned int i; | |
1158 | ||
1159 | options_init(options); | |
1160 | ||
1161 | i = 0; | |
1162 | while (long_options[i].name) | |
1163 | i++; | |
1164 | ||
1165 | o = &options[0]; | |
1166 | while (o->name) { | |
1167 | long_options[i].name = o->name; | |
1168 | long_options[i].val = FIO_GETOPT_JOB; | |
1169 | if (o->type == FIO_OPT_STR_SET) | |
1170 | long_options[i].has_arg = no_argument; | |
1171 | else | |
1172 | long_options[i].has_arg = required_argument; | |
1173 | ||
1174 | i++; | |
1175 | o++; | |
1176 | assert(i < FIO_NR_OPTIONS); | |
1177 | } | |
1178 | } | |
1179 | ||
1180 | int fio_option_parse(struct thread_data *td, const char *opt) | |
1181 | { | |
1182 | return parse_option(opt, options, td); | |
1183 | } | |
1184 | ||
1185 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) | |
1186 | { | |
1187 | return parse_cmd_option(opt, val, options, td); | |
1188 | } | |
1189 | ||
1190 | void fio_fill_default_options(struct thread_data *td) | |
1191 | { | |
1192 | fill_default_options(td, options); | |
1193 | } | |
1194 | ||
1195 | int fio_show_option_help(const char *opt) | |
1196 | { | |
1197 | return show_cmd_help(options, opt); | |
1198 | } | |
d23bb327 JA |
1199 | |
1200 | static void __options_mem(struct thread_data *td, int alloc) | |
1201 | { | |
1202 | struct thread_options *o = &td->o; | |
1203 | struct fio_option *opt; | |
1204 | char **ptr; | |
1205 | int i; | |
1206 | ||
1207 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { | |
1208 | if (opt->type != FIO_OPT_STR_STORE) | |
1209 | continue; | |
1210 | ||
1211 | ptr = (void *) o + opt->off1; | |
1212 | if (*ptr) { | |
1213 | if (alloc) | |
1214 | *ptr = strdup(*ptr); | |
1215 | else { | |
1216 | free(*ptr); | |
1217 | *ptr = NULL; | |
1218 | } | |
1219 | } | |
1220 | } | |
1221 | } | |
1222 | ||
1223 | /* | |
1224 | * dupe FIO_OPT_STR_STORE options | |
1225 | */ | |
1226 | void options_mem_dupe(struct thread_data *td) | |
1227 | { | |
1228 | __options_mem(td, 1); | |
1229 | } | |
1230 | ||
22d66213 | 1231 | void options_mem_free(struct thread_data fio_unused *td) |
d23bb327 | 1232 | { |
22d66213 | 1233 | #if 0 |
d23bb327 | 1234 | __options_mem(td, 0); |
22d66213 | 1235 | #endif |
d23bb327 | 1236 | } |