blob: 27b4fb65eb1b6158763050badd5821db122f089d [file] [log] [blame]
Jens Axboe214e1ec2007-03-15 10:48:13 +01001#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"
Jens Axboe90059d62007-07-30 09:33:12 +020011#include "fls.h"
Jens Axboe214e1ec2007-03-15 10:48:13 +010012
Jens Axboe2dc1bbe2007-03-15 15:01:33 +010013#define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var)
Jens Axboe214e1ec2007-03-15 10:48:13 +010014
15/*
16 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
17 */
18static 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
Jens Axboe564ca972007-12-14 12:21:19 +010031static 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
39static 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
Jens Axboe211097b2007-03-22 18:56:45 +0100145static int str_rw_cb(void *data, const char *str)
146{
147 struct thread_data *td = data;
148 char *nr = get_opt_postfix(str);
149
Jens Axboefafdba32007-03-26 10:09:12 +0200150 td->o.ddir_nr = 1;
Jens Axboe211097b2007-03-22 18:56:45 +0100151 if (nr)
152 td->o.ddir_nr = atoi(nr);
153
Jens Axboe211097b2007-03-22 18:56:45 +0100154 return 0;
155}
156
Jens Axboe214e1ec2007-03-15 10:48:13 +0100157static int str_mem_cb(void *data, const char *mem)
158{
159 struct thread_data *td = data;
160
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100161 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100162 td->mmapfile = get_opt_postfix(mem);
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100163 if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100164 log_err("fio: mmaphuge:/path/to/file\n");
165 return 1;
166 }
167 }
168
169 return 0;
170}
171
172static 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
179static int str_prioclass_cb(void *data, unsigned int *val)
180{
181 struct thread_data *td = data;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200182 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;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100189
190 td->ioprio |= *val << IOPRIO_CLASS_SHIFT;
Jens Axboeac684782007-11-08 08:29:07 +0100191 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100192 return 0;
193}
194
195static int str_prio_cb(void *data, unsigned int *val)
196{
197 struct thread_data *td = data;
198
199 td->ioprio |= *val;
Jens Axboe6cefbe32007-04-18 12:46:56 +0200200
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
Jens Axboeac684782007-11-08 08:29:07 +0100207 td->ioprio_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100208 return 0;
209}
210#endif
211
212static int str_exitall_cb(void)
213{
214 exitall_on_terminate = 1;
215 return 0;
216}
217
Jens Axboe214e1ec2007-03-15 10:48:13 +0100218#ifdef FIO_HAVE_CPU_AFFINITY
Jens Axboe214e1ec2007-03-15 10:48:13 +0100219static int str_cpumask_cb(void *data, unsigned int *val)
220{
221 struct thread_data *td = data;
Jens Axboed2e268b2007-06-15 10:33:49 +0200222 unsigned int i;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100223
Jens Axboed2e268b2007-06-15 10:33:49 +0200224 CPU_ZERO(&td->o.cpumask);
225
226 for (i = 0; i < sizeof(int) * 8; i++)
227 if ((1 << i) & *val)
228 CPU_SET(*val, &td->o.cpumask);
229
Jens Axboe375b2692007-05-22 09:13:02 +0200230 td->o.cpumask_set = 1;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100231 return 0;
232}
233
Jens Axboed2e268b2007-06-15 10:33:49 +0200234static int str_cpus_allowed_cb(void *data, const char *input)
235{
236 struct thread_data *td = data;
237 char *cpu, *str, *p;
238
239 CPU_ZERO(&td->o.cpumask);
240
241 p = str = strdup(input);
242
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);
253 td->o.cpumask_set = 1;
Jens Axboed2e268b2007-06-15 10:33:49 +0200254 return 0;
255}
256#endif
257
Jens Axboe214e1ec2007-03-15 10:48:13 +0100258static int str_fst_cb(void *data, const char *str)
259{
260 struct thread_data *td = data;
261 char *nr = get_opt_postfix(str);
262
263 td->file_service_nr = 1;
264 if (nr)
265 td->file_service_nr = atoi(nr);
266
267 return 0;
268}
269
270static int str_filename_cb(void *data, const char *input)
271{
272 struct thread_data *td = data;
273 char *fname, *str, *p;
274
275 p = str = strdup(input);
276
277 strip_blank_front(&str);
278 strip_blank_end(str);
279
280 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100281 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100282
283 while ((fname = strsep(&str, ":")) != NULL) {
284 if (!strlen(fname))
285 break;
286 add_file(td, fname);
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100287 td->o.nr_files++;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100288 }
289
290 free(p);
291 return 0;
292}
293
294static int str_directory_cb(void *data, const char fio_unused *str)
295{
296 struct thread_data *td = data;
297 struct stat sb;
298
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100299 if (lstat(td->o.directory, &sb) < 0) {
300 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100301 td_verror(td, errno, "lstat");
302 return 1;
303 }
304 if (!S_ISDIR(sb.st_mode)) {
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100305 log_err("fio: %s is not a directory\n", td->o.directory);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100306 return 1;
307 }
308
309 return 0;
310}
311
312static int str_opendir_cb(void *data, const char fio_unused *str)
313{
314 struct thread_data *td = data;
315
316 if (!td->files_index)
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100317 td->o.nr_files = 0;
Jens Axboe214e1ec2007-03-15 10:48:13 +0100318
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100319 return add_dir_files(td, td->o.opendir);
Jens Axboe214e1ec2007-03-15 10:48:13 +0100320}
321
Jens Axboea59e1702007-07-30 08:53:27 +0200322static int str_verify_offset_cb(void *data, unsigned int *off)
Shawn Lewis546a9142007-07-28 21:11:37 +0200323{
324 struct thread_data *td = data;
Jens Axboea59e1702007-07-30 08:53:27 +0200325
Shawn Lewis546a9142007-07-28 21:11:37 +0200326 if (*off && *off < sizeof(struct verify_header)) {
Jens Axboea59e1702007-07-30 08:53:27 +0200327 log_err("fio: verify_offset too small\n");
Shawn Lewis546a9142007-07-28 21:11:37 +0200328 return 1;
329 }
Jens Axboea59e1702007-07-30 08:53:27 +0200330
331 td->o.verify_offset = *off;
Shawn Lewis546a9142007-07-28 21:11:37 +0200332 return 0;
333}
334
Shawn Lewise28218f2008-01-16 11:01:33 +0100335static int str_verify_pattern_cb(void *data, unsigned int *off)
Jens Axboe90059d62007-07-30 09:33:12 +0200336{
337 struct thread_data *td = data;
Shawn Lewise28218f2008-01-16 11:01:33 +0100338 unsigned int msb;
Jens Axboe90059d62007-07-30 09:33:12 +0200339
Shawn Lewise28218f2008-01-16 11:01:33 +0100340 msb = fls(*off);
Jens Axboe90059d62007-07-30 09:33:12 +0200341 if (msb <= 8)
342 td->o.verify_pattern_bytes = 1;
343 else if (msb <= 16)
344 td->o.verify_pattern_bytes = 2;
345 else if (msb <= 24)
346 td->o.verify_pattern_bytes = 3;
347 else
348 td->o.verify_pattern_bytes = 4;
349
Shawn Lewise28218f2008-01-16 11:01:33 +0100350 td->o.verify_pattern = *off;
Jens Axboe90059d62007-07-30 09:33:12 +0200351 return 0;
352}
Jens Axboe214e1ec2007-03-15 10:48:13 +0100353
354#define __stringify_1(x) #x
355#define __stringify(x) __stringify_1(x)
356
357/*
358 * Map of job/command line options
359 */
360static struct fio_option options[] = {
361 {
362 .name = "description",
363 .type = FIO_OPT_STR_STORE,
364 .off1 = td_var_offset(description),
365 .help = "Text job description",
366 },
367 {
368 .name = "name",
369 .type = FIO_OPT_STR_STORE,
370 .off1 = td_var_offset(name),
371 .help = "Name of this job",
372 },
373 {
374 .name = "directory",
375 .type = FIO_OPT_STR_STORE,
376 .off1 = td_var_offset(directory),
377 .cb = str_directory_cb,
378 .help = "Directory to store files in",
379 },
380 {
381 .name = "filename",
382 .type = FIO_OPT_STR_STORE,
383 .off1 = td_var_offset(filename),
384 .cb = str_filename_cb,
385 .help = "File(s) to use for the workload",
386 },
387 {
Jens Axboe29c13492008-03-01 19:25:20 +0100388 .name = "lockfile",
389 .type = FIO_OPT_BOOL,
390 .off1 = td_var_offset(lockfile),
391 .help = "Lock file when doing IO to it",
392 .parent = "filename",
393 .def = "0",
394 },
395 {
396 .name = "lockfile_batch",
397 .type = FIO_OPT_INT,
398 .off1 = td_var_offset(lockfile_batch),
399 .help = "Number of IOs to allow per file lock",
400 .parent = "lockfile",
401 .def = "1",
402 },
403 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100404 .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",
Jens Axboed3aad8f2007-03-15 14:12:05 +0100412 .alias = "readwrite",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100413 .type = FIO_OPT_STR,
Jens Axboe211097b2007-03-22 18:56:45 +0100414 .cb = str_rw_cb,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100415 .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 },
gurudas paia31041e2007-10-23 15:12:30 +0200455 { .ival = "psync",
456 .help = "Use pread/pwrite",
457 },
Jens Axboe1d2af022008-02-04 10:59:07 +0100458 { .ival = "vsync",
459 .help = "Use readv/writev",
460 },
Jens Axboe214e1ec2007-03-15 10:48:13 +0100461#ifdef FIO_HAVE_LIBAIO
462 { .ival = "libaio",
463 .help = "Linux native asynchronous IO",
464 },
465#endif
466#ifdef FIO_HAVE_POSIXAIO
467 { .ival = "posixaio",
468 .help = "POSIX asynchronous IO",
469 },
470#endif
471 { .ival = "mmap",
472 .help = "Memory mapped IO",
473 },
474#ifdef FIO_HAVE_SPLICE
475 { .ival = "splice",
476 .help = "splice/vmsplice based IO",
477 },
Jens Axboe9cce02e2007-06-22 15:42:21 +0200478 { .ival = "netsplice",
479 .help = "splice/vmsplice to/from the network",
480 },
Jens Axboe214e1ec2007-03-15 10:48:13 +0100481#endif
482#ifdef FIO_HAVE_SGIO
483 { .ival = "sg",
484 .help = "SCSI generic v3 IO",
485 },
486#endif
487 { .ival = "null",
488 .help = "Testing engine (no data transfer)",
489 },
490 { .ival = "net",
491 .help = "Network IO",
492 },
493#ifdef FIO_HAVE_SYSLET
494 { .ival = "syslet-rw",
495 .help = "syslet enabled async pread/pwrite IO",
496 },
497#endif
498 { .ival = "cpuio",
499 .help = "CPU cycler burner engine",
500 },
Jens Axboeb8c82a42007-03-21 08:48:26 +0100501#ifdef FIO_HAVE_GUASI
502 { .ival = "guasi",
503 .help = "GUASI IO engine",
504 },
505#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +0100506 { .ival = "external",
507 .help = "Load external engine (append name)",
508 },
509 },
510 },
511 {
512 .name = "iodepth",
513 .type = FIO_OPT_INT,
514 .off1 = td_var_offset(iodepth),
515 .help = "Amount of IO buffers to keep in flight",
Jens Axboe757aff42007-12-12 19:42:13 +0100516 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100517 .def = "1",
518 },
519 {
520 .name = "iodepth_batch",
521 .type = FIO_OPT_INT,
522 .off1 = td_var_offset(iodepth_batch),
523 .help = "Number of IO to submit in one go",
Jens Axboeafdf9352007-07-31 16:14:34 +0200524 .parent = "iodepth",
Jens Axboea2e6f8a2008-01-18 10:28:11 +0100525 .minval = 1,
526 .def = "1",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100527 },
528 {
529 .name = "iodepth_low",
530 .type = FIO_OPT_INT,
531 .off1 = td_var_offset(iodepth_low),
532 .help = "Low water mark for queuing depth",
Jens Axboeafdf9352007-07-31 16:14:34 +0200533 .parent = "iodepth",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100534 },
535 {
536 .name = "size",
537 .type = FIO_OPT_STR_VAL,
Jens Axboe2dc1bbe2007-03-15 15:01:33 +0100538 .off1 = td_var_offset(size),
Jens Axboec3edbdb2007-07-20 14:25:31 +0200539 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100540 .help = "Total size of device or files",
541 },
542 {
Shawn Lewisaa31f1f2008-01-11 09:45:11 +0100543 .name = "fill_device",
544 .type = FIO_OPT_BOOL,
545 .off1 = td_var_offset(fill_device),
546 .help = "Write until an ENOSPC error occurs",
547 .def = "0",
548 },
549 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100550 .name = "filesize",
551 .type = FIO_OPT_STR_VAL,
552 .off1 = td_var_offset(file_size_low),
553 .off2 = td_var_offset(file_size_high),
Jens Axboec3edbdb2007-07-20 14:25:31 +0200554 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100555 .help = "Size of individual files",
556 },
557 {
Jens Axboe67a10002007-07-31 23:12:16 +0200558 .name = "offset",
559 .alias = "fileoffset",
560 .type = FIO_OPT_STR_VAL,
561 .off1 = td_var_offset(start_offset),
562 .help = "Start IO from this offset",
563 .def = "0",
564 },
565 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100566 .name = "bs",
Jens Axboed3aad8f2007-03-15 14:12:05 +0100567 .alias = "blocksize",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100568 .type = FIO_OPT_STR_VAL_INT,
569 .off1 = td_var_offset(bs[DDIR_READ]),
570 .off2 = td_var_offset(bs[DDIR_WRITE]),
Jens Axboec3edbdb2007-07-20 14:25:31 +0200571 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100572 .help = "Block size unit",
573 .def = "4k",
Jens Axboe67a10002007-07-31 23:12:16 +0200574 .parent = "rw",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100575 },
576 {
577 .name = "bsrange",
Jens Axboed3aad8f2007-03-15 14:12:05 +0100578 .alias = "blocksize_range",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100579 .type = FIO_OPT_RANGE,
580 .off1 = td_var_offset(min_bs[DDIR_READ]),
581 .off2 = td_var_offset(max_bs[DDIR_READ]),
582 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
583 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
Jens Axboec3edbdb2007-07-20 14:25:31 +0200584 .minval = 1,
Jens Axboe214e1ec2007-03-15 10:48:13 +0100585 .help = "Set block size range (in more detail than bs)",
Jens Axboe67a10002007-07-31 23:12:16 +0200586 .parent = "rw",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100587 },
588 {
Jens Axboe564ca972007-12-14 12:21:19 +0100589 .name = "bssplit",
590 .type = FIO_OPT_STR,
591 .cb = str_bssplit_cb,
592 .help = "Set a specific mix of block sizes",
593 .parent = "rw",
594 },
595 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100596 .name = "bs_unaligned",
Jens Axboed3aad8f2007-03-15 14:12:05 +0100597 .alias = "blocksize_unaligned",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100598 .type = FIO_OPT_STR_SET,
599 .off1 = td_var_offset(bs_unaligned),
600 .help = "Don't sector align IO buffer sizes",
Jens Axboe67a10002007-07-31 23:12:16 +0200601 .parent = "rw",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100602 },
603 {
604 .name = "randrepeat",
605 .type = FIO_OPT_BOOL,
606 .off1 = td_var_offset(rand_repeatable),
607 .help = "Use repeatable random IO pattern",
608 .def = "1",
Jens Axboe67a10002007-07-31 23:12:16 +0200609 .parent = "rw",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100610 },
611 {
612 .name = "norandommap",
613 .type = FIO_OPT_STR_SET,
614 .off1 = td_var_offset(norandommap),
615 .help = "Accept potential duplicate random blocks",
Jens Axboe67a10002007-07-31 23:12:16 +0200616 .parent = "rw",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100617 },
618 {
619 .name = "nrfiles",
620 .type = FIO_OPT_INT,
621 .off1 = td_var_offset(nr_files),
622 .help = "Split job workload between this number of files",
623 .def = "1",
624 },
625 {
626 .name = "openfiles",
627 .type = FIO_OPT_INT,
628 .off1 = td_var_offset(open_files),
629 .help = "Number of files to keep open at the same time",
630 },
631 {
632 .name = "file_service_type",
633 .type = FIO_OPT_STR,
634 .cb = str_fst_cb,
635 .off1 = td_var_offset(file_service_type),
636 .help = "How to select which file to service next",
637 .def = "roundrobin",
638 .posval = {
639 { .ival = "random",
640 .oval = FIO_FSERVICE_RANDOM,
641 .help = "Choose a file at random",
642 },
643 { .ival = "roundrobin",
644 .oval = FIO_FSERVICE_RR,
645 .help = "Round robin select files",
646 },
647 },
Jens Axboe67a10002007-07-31 23:12:16 +0200648 .parent = "nrfiles",
649 },
650 {
651 .name = "fadvise_hint",
652 .type = FIO_OPT_BOOL,
653 .off1 = td_var_offset(fadvise_hint),
654 .help = "Use fadvise() to advise the kernel on IO pattern",
655 .def = "1",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100656 },
657 {
658 .name = "fsync",
659 .type = FIO_OPT_INT,
660 .off1 = td_var_offset(fsync_blocks),
661 .help = "Issue fsync for writes every given number of blocks",
662 .def = "0",
663 },
664 {
665 .name = "direct",
666 .type = FIO_OPT_BOOL,
667 .off1 = td_var_offset(odirect),
668 .help = "Use O_DIRECT IO (negates buffered)",
669 .def = "0",
670 },
671 {
672 .name = "buffered",
673 .type = FIO_OPT_BOOL,
674 .off1 = td_var_offset(odirect),
675 .neg = 1,
676 .help = "Use buffered IO (negates direct)",
677 .def = "1",
678 },
679 {
680 .name = "overwrite",
681 .type = FIO_OPT_BOOL,
682 .off1 = td_var_offset(overwrite),
683 .help = "When writing, set whether to overwrite current data",
684 .def = "0",
685 },
686 {
687 .name = "loops",
688 .type = FIO_OPT_INT,
689 .off1 = td_var_offset(loops),
690 .help = "Number of times to run the job",
691 .def = "1",
692 },
693 {
694 .name = "numjobs",
695 .type = FIO_OPT_INT,
696 .off1 = td_var_offset(numjobs),
697 .help = "Duplicate this job this many times",
698 .def = "1",
699 },
700 {
701 .name = "startdelay",
702 .type = FIO_OPT_INT,
703 .off1 = td_var_offset(start_delay),
704 .help = "Only start job when this period has passed",
705 .def = "0",
706 },
707 {
708 .name = "runtime",
709 .alias = "timeout",
710 .type = FIO_OPT_STR_VAL_TIME,
711 .off1 = td_var_offset(timeout),
712 .help = "Stop workload when this amount of time has passed",
713 .def = "0",
714 },
715 {
Jens Axboecf4464c2007-04-17 20:14:42 +0200716 .name = "time_based",
717 .type = FIO_OPT_STR_SET,
718 .off1 = td_var_offset(time_based),
719 .help = "Keep running until runtime/timeout is met",
720 },
721 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100722 .name = "mem",
Jens Axboed3aad8f2007-03-15 14:12:05 +0100723 .alias = "iomem",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100724 .type = FIO_OPT_STR,
725 .cb = str_mem_cb,
726 .off1 = td_var_offset(mem_type),
727 .help = "Backing type for IO buffers",
728 .def = "malloc",
729 .posval = {
730 { .ival = "malloc",
731 .oval = MEM_MALLOC,
732 .help = "Use malloc(3) for IO buffers",
733 },
Jens Axboeb370e462007-03-19 10:51:49 +0100734 { .ival = "shm",
735 .oval = MEM_SHM,
736 .help = "Use shared memory segments for IO buffers",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100737 },
738#ifdef FIO_HAVE_HUGETLB
Jens Axboe37c8cdf2007-03-19 13:14:03 +0100739 { .ival = "shmhuge",
740 .oval = MEM_SHMHUGE,
741 .help = "Like shm, but use huge pages",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100742 },
743#endif
Jens Axboeb370e462007-03-19 10:51:49 +0100744 { .ival = "mmap",
745 .oval = MEM_MMAP,
746 .help = "Use mmap(2) (file or anon) for IO buffers",
747 },
Jens Axboe37c8cdf2007-03-19 13:14:03 +0100748#ifdef FIO_HAVE_HUGETLB
749 { .ival = "mmaphuge",
750 .oval = MEM_MMAPHUGE,
751 .help = "Like mmap, but use huge pages",
752 },
753#endif
Jens Axboe214e1ec2007-03-15 10:48:13 +0100754 },
755 },
756 {
757 .name = "verify",
758 .type = FIO_OPT_STR,
759 .off1 = td_var_offset(verify),
760 .help = "Verify data written",
761 .def = "0",
762 .posval = {
763 { .ival = "0",
764 .oval = VERIFY_NONE,
765 .help = "Don't do IO verification",
766 },
Jens Axboefcca4b52007-07-27 15:42:00 +0200767 { .ival = "md5",
768 .oval = VERIFY_MD5,
769 .help = "Use md5 checksums for verification",
770 },
Jens Axboed77a7af2007-07-27 15:35:06 +0200771 { .ival = "crc64",
772 .oval = VERIFY_CRC64,
773 .help = "Use crc64 checksums for verification",
774 },
Jens Axboe214e1ec2007-03-15 10:48:13 +0100775 { .ival = "crc32",
776 .oval = VERIFY_CRC32,
777 .help = "Use crc32 checksums for verification",
778 },
Jens Axboe969f7ed2007-07-27 09:07:17 +0200779 { .ival = "crc16",
780 .oval = VERIFY_CRC16,
781 .help = "Use crc16 checksums for verification",
782 },
Jens Axboe1e154bd2007-07-27 09:52:40 +0200783 { .ival = "crc7",
784 .oval = VERIFY_CRC7,
785 .help = "Use crc7 checksums for verification",
786 },
Jens Axboecd14cc12007-07-30 10:59:33 +0200787 { .ival = "sha256",
788 .oval = VERIFY_SHA256,
789 .help = "Use sha256 checksums for verification",
790 },
791 { .ival = "sha512",
792 .oval = VERIFY_SHA512,
793 .help = "Use sha512 checksums for verification",
794 },
Shawn Lewis7437ee82007-08-02 21:05:58 +0200795 { .ival = "meta",
796 .oval = VERIFY_META,
797 .help = "Use io information",
798 },
Jens Axboe36690c92007-03-26 10:23:34 +0200799 {
800 .ival = "null",
801 .oval = VERIFY_NULL,
802 .help = "Pretend to verify",
803 },
Jens Axboe214e1ec2007-03-15 10:48:13 +0100804 },
805 },
806 {
Jens Axboe005c5652007-08-02 22:21:36 +0200807 .name = "do_verify",
Jens Axboe68e1f292007-08-10 10:32:14 +0200808 .type = FIO_OPT_BOOL,
Jens Axboe005c5652007-08-02 22:21:36 +0200809 .off1 = td_var_offset(do_verify),
810 .help = "Run verification stage after write",
811 .def = "1",
812 .parent = "verify",
813 },
814 {
Jens Axboe160b9662007-03-27 10:59:49 +0200815 .name = "verifysort",
816 .type = FIO_OPT_BOOL,
817 .off1 = td_var_offset(verifysort),
818 .help = "Sort written verify blocks for read back",
819 .def = "1",
Jens Axboec83f2df2007-07-31 22:51:47 +0200820 .parent = "verify",
Jens Axboe160b9662007-03-27 10:59:49 +0200821 },
822 {
Jens Axboea59e1702007-07-30 08:53:27 +0200823 .name = "verify_interval",
Shawn Lewis3f9f4e22007-07-28 21:10:37 +0200824 .type = FIO_OPT_STR_VAL_INT,
Jens Axboea59e1702007-07-30 08:53:27 +0200825 .off1 = td_var_offset(verify_interval),
Jens Axboe819a9682007-07-28 21:30:31 +0200826 .minval = 2 * sizeof(struct verify_header),
Jens Axboea59e1702007-07-30 08:53:27 +0200827 .help = "Store verify buffer header every N bytes",
Jens Axboeafdf9352007-07-31 16:14:34 +0200828 .parent = "verify",
Shawn Lewis3f9f4e22007-07-28 21:10:37 +0200829 },
830 {
Jens Axboea59e1702007-07-30 08:53:27 +0200831 .name = "verify_offset",
Shawn Lewis546a9142007-07-28 21:11:37 +0200832 .type = FIO_OPT_STR_VAL_INT,
Jens Axboea59e1702007-07-30 08:53:27 +0200833 .help = "Offset verify header location by N bytes",
Shawn Lewis546a9142007-07-28 21:11:37 +0200834 .def = "0",
Jens Axboea59e1702007-07-30 08:53:27 +0200835 .cb = str_verify_offset_cb,
Jens Axboeafdf9352007-07-31 16:14:34 +0200836 .parent = "verify",
Shawn Lewis546a9142007-07-28 21:11:37 +0200837 },
838 {
Shawn Lewise28218f2008-01-16 11:01:33 +0100839 .name = "verify_pattern",
840 .type = FIO_OPT_INT,
841 .cb = str_verify_pattern_cb,
842 .help = "Fill pattern for IO buffers",
843 .parent = "verify",
844 },
845 {
Jens Axboea12a3b42007-08-09 10:20:54 +0200846 .name = "verify_fatal",
Jens Axboe68e1f292007-08-10 10:32:14 +0200847 .type = FIO_OPT_BOOL,
Jens Axboea12a3b42007-08-09 10:20:54 +0200848 .off1 = td_var_offset(verify_fatal),
849 .def = "0",
850 .help = "Exit on a single verify failure, don't continue",
851 .parent = "verify",
852 },
853 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100854 .name = "write_iolog",
855 .type = FIO_OPT_STR_STORE,
856 .off1 = td_var_offset(write_iolog_file),
857 .help = "Store IO pattern to file",
858 },
859 {
860 .name = "read_iolog",
861 .type = FIO_OPT_STR_STORE,
862 .off1 = td_var_offset(read_iolog_file),
863 .help = "Playback IO pattern from file",
864 },
865 {
866 .name = "exec_prerun",
867 .type = FIO_OPT_STR_STORE,
868 .off1 = td_var_offset(exec_prerun),
869 .help = "Execute this file prior to running job",
870 },
871 {
872 .name = "exec_postrun",
873 .type = FIO_OPT_STR_STORE,
874 .off1 = td_var_offset(exec_postrun),
875 .help = "Execute this file after running job",
876 },
877#ifdef FIO_HAVE_IOSCHED_SWITCH
878 {
879 .name = "ioscheduler",
880 .type = FIO_OPT_STR_STORE,
881 .off1 = td_var_offset(ioscheduler),
882 .help = "Use this IO scheduler on the backing device",
883 },
884#endif
885 {
886 .name = "zonesize",
887 .type = FIO_OPT_STR_VAL,
888 .off1 = td_var_offset(zone_size),
889 .help = "Give size of an IO zone",
890 .def = "0",
891 },
892 {
893 .name = "zoneskip",
894 .type = FIO_OPT_STR_VAL,
895 .off1 = td_var_offset(zone_skip),
896 .help = "Space between IO zones",
897 .def = "0",
898 },
899 {
900 .name = "lockmem",
901 .type = FIO_OPT_STR_VAL,
902 .cb = str_lockmem_cb,
903 .help = "Lock down this amount of memory",
904 .def = "0",
905 },
906 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100907 .name = "rwmixread",
908 .type = FIO_OPT_INT,
Jens Axboee47f7992007-03-21 14:05:39 +0100909 .off1 = td_var_offset(rwmix[DDIR_READ]),
Jens Axboe214e1ec2007-03-15 10:48:13 +0100910 .maxval = 100,
911 .help = "Percentage of mixed workload that is reads",
912 .def = "50",
913 },
914 {
915 .name = "rwmixwrite",
916 .type = FIO_OPT_INT,
Jens Axboee47f7992007-03-21 14:05:39 +0100917 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
Jens Axboe214e1ec2007-03-15 10:48:13 +0100918 .maxval = 100,
919 .help = "Percentage of mixed workload that is writes",
920 .def = "50",
921 },
922 {
Jens Axboeafdf9352007-07-31 16:14:34 +0200923 .name = "rwmixcycle",
924 .type = FIO_OPT_INT,
925 .off1 = td_var_offset(rwmixcycle),
926 .help = "Cycle period for mixed read/write workloads (msec)",
927 .def = "500",
928 .parent = "rwmixread",
929 },
930 {
Jens Axboe214e1ec2007-03-15 10:48:13 +0100931 .name = "nice",
932 .type = FIO_OPT_INT,
933 .off1 = td_var_offset(nice),
934 .help = "Set job CPU nice value",
935 .minval = -19,
936 .maxval = 20,
937 .def = "0",
938 },
939#ifdef FIO_HAVE_IOPRIO
940 {
941 .name = "prio",
942 .type = FIO_OPT_INT,
943 .cb = str_prio_cb,
944 .help = "Set job IO priority value",
945 .minval = 0,
946 .maxval = 7,
947 },
948 {
949 .name = "prioclass",
950 .type = FIO_OPT_INT,
951 .cb = str_prioclass_cb,
952 .help = "Set job IO priority class",
953 .minval = 0,
954 .maxval = 3,
955 },
956#endif
957 {
958 .name = "thinktime",
959 .type = FIO_OPT_INT,
960 .off1 = td_var_offset(thinktime),
961 .help = "Idle time between IO buffers (usec)",
962 .def = "0",
963 },
964 {
965 .name = "thinktime_spin",
966 .type = FIO_OPT_INT,
967 .off1 = td_var_offset(thinktime_spin),
968 .help = "Start think time by spinning this amount (usec)",
969 .def = "0",
Jens Axboeafdf9352007-07-31 16:14:34 +0200970 .parent = "thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100971 },
972 {
973 .name = "thinktime_blocks",
974 .type = FIO_OPT_INT,
975 .off1 = td_var_offset(thinktime_blocks),
976 .help = "IO buffer period between 'thinktime'",
977 .def = "1",
Jens Axboeafdf9352007-07-31 16:14:34 +0200978 .parent = "thinktime",
Jens Axboe214e1ec2007-03-15 10:48:13 +0100979 },
980 {
981 .name = "rate",
982 .type = FIO_OPT_INT,
983 .off1 = td_var_offset(rate),
984 .help = "Set bandwidth rate",
985 },
986 {
987 .name = "ratemin",
988 .type = FIO_OPT_INT,
989 .off1 = td_var_offset(ratemin),
Jens Axboe4e991c22007-03-15 11:41:11 +0100990 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +0200991 .parent = "rate",
Jens Axboe4e991c22007-03-15 11:41:11 +0100992 },
993 {
994 .name = "rate_iops",
995 .type = FIO_OPT_INT,
996 .off1 = td_var_offset(rate_iops),
997 .help = "Limit IO used to this number of IO operations/sec",
998 },
999 {
1000 .name = "rate_iops_min",
1001 .type = FIO_OPT_INT,
1002 .off1 = td_var_offset(rate_iops_min),
1003 .help = "Job must meet this rate or it will be shutdown",
Jens Axboeafdf9352007-07-31 16:14:34 +02001004 .parent = "rate_iops",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001005 },
1006 {
1007 .name = "ratecycle",
1008 .type = FIO_OPT_INT,
1009 .off1 = td_var_offset(ratecycle),
1010 .help = "Window average for rate limits (msec)",
1011 .def = "1000",
Jens Axboeafdf9352007-07-31 16:14:34 +02001012 .parent = "rate",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001013 },
1014 {
1015 .name = "invalidate",
1016 .type = FIO_OPT_BOOL,
1017 .off1 = td_var_offset(invalidate_cache),
1018 .help = "Invalidate buffer/page cache prior to running job",
1019 .def = "1",
1020 },
1021 {
1022 .name = "sync",
1023 .type = FIO_OPT_BOOL,
1024 .off1 = td_var_offset(sync_io),
1025 .help = "Use O_SYNC for buffered writes",
1026 .def = "0",
Jens Axboe67a10002007-07-31 23:12:16 +02001027 .parent = "buffered",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001028 },
1029 {
1030 .name = "bwavgtime",
1031 .type = FIO_OPT_INT,
1032 .off1 = td_var_offset(bw_avg_time),
1033 .help = "Time window over which to calculate bandwidth (msec)",
1034 .def = "500",
1035 },
1036 {
1037 .name = "create_serialize",
1038 .type = FIO_OPT_BOOL,
1039 .off1 = td_var_offset(create_serialize),
1040 .help = "Serialize creating of job files",
1041 .def = "1",
1042 },
1043 {
1044 .name = "create_fsync",
1045 .type = FIO_OPT_BOOL,
1046 .off1 = td_var_offset(create_fsync),
1047 .help = "Fsync file after creation",
1048 .def = "1",
1049 },
1050 {
1051 .name = "cpuload",
1052 .type = FIO_OPT_INT,
1053 .off1 = td_var_offset(cpuload),
1054 .help = "Use this percentage of CPU",
1055 },
1056 {
1057 .name = "cpuchunks",
1058 .type = FIO_OPT_INT,
1059 .off1 = td_var_offset(cpucycle),
1060 .help = "Length of the CPU burn cycles (usecs)",
1061 .def = "50000",
Jens Axboe67a10002007-07-31 23:12:16 +02001062 .parent = "cpuload",
Jens Axboe214e1ec2007-03-15 10:48:13 +01001063 },
1064#ifdef FIO_HAVE_CPU_AFFINITY
1065 {
1066 .name = "cpumask",
1067 .type = FIO_OPT_INT,
1068 .cb = str_cpumask_cb,
1069 .help = "CPU affinity mask",
1070 },
Jens Axboed2e268b2007-06-15 10:33:49 +02001071 {
1072 .name = "cpus_allowed",
1073 .type = FIO_OPT_STR,
1074 .cb = str_cpus_allowed_cb,
1075 .help = "Set CPUs allowed",
1076 },
Jens Axboe214e1ec2007-03-15 10:48:13 +01001077#endif
1078 {
1079 .name = "end_fsync",
1080 .type = FIO_OPT_BOOL,
1081 .off1 = td_var_offset(end_fsync),
1082 .help = "Include fsync at the end of job",
1083 .def = "0",
1084 },
1085 {
1086 .name = "fsync_on_close",
1087 .type = FIO_OPT_BOOL,
1088 .off1 = td_var_offset(fsync_on_close),
1089 .help = "fsync files on close",
1090 .def = "0",
1091 },
1092 {
1093 .name = "unlink",
1094 .type = FIO_OPT_BOOL,
1095 .off1 = td_var_offset(unlink),
1096 .help = "Unlink created files after job has completed",
1097 .def = "0",
1098 },
1099 {
1100 .name = "exitall",
1101 .type = FIO_OPT_STR_SET,
1102 .cb = str_exitall_cb,
1103 .help = "Terminate all jobs when one exits",
1104 },
1105 {
1106 .name = "stonewall",
1107 .type = FIO_OPT_STR_SET,
1108 .off1 = td_var_offset(stonewall),
1109 .help = "Insert a hard barrier between this job and previous",
1110 },
1111 {
Jens Axboeb3d62a72007-03-20 14:23:26 +01001112 .name = "new_group",
1113 .type = FIO_OPT_STR_SET,
1114 .off1 = td_var_offset(new_group),
1115 .help = "Mark the start of a new group (for reporting)",
1116 },
1117 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001118 .name = "thread",
1119 .type = FIO_OPT_STR_SET,
1120 .off1 = td_var_offset(use_thread),
1121 .help = "Use threads instead of forks",
1122 },
1123 {
1124 .name = "write_bw_log",
1125 .type = FIO_OPT_STR_SET,
1126 .off1 = td_var_offset(write_bw_log),
1127 .help = "Write log of bandwidth during run",
1128 },
1129 {
1130 .name = "write_lat_log",
1131 .type = FIO_OPT_STR_SET,
1132 .off1 = td_var_offset(write_lat_log),
1133 .help = "Write log of latency during run",
1134 },
1135 {
1136 .name = "hugepage-size",
Aaron Carroll357f6182008-02-20 09:14:13 +01001137 .type = FIO_OPT_STR_VAL_INT,
Jens Axboe214e1ec2007-03-15 10:48:13 +01001138 .off1 = td_var_offset(hugepage_size),
1139 .help = "When using hugepages, specify size of each page",
1140 .def = __stringify(FIO_HUGE_PAGE),
1141 },
1142 {
1143 .name = "group_reporting",
1144 .type = FIO_OPT_STR_SET,
1145 .off1 = td_var_offset(group_reporting),
1146 .help = "Do reporting on a per-group basis",
1147 },
1148 {
Jens Axboee9459e52007-04-17 15:46:32 +02001149 .name = "zero_buffers",
1150 .type = FIO_OPT_STR_SET,
1151 .off1 = td_var_offset(zero_buffers),
1152 .help = "Init IO buffers to all zeroes",
1153 },
Jens Axboe0a839f32007-04-26 09:02:34 +02001154#ifdef FIO_HAVE_DISK_UTIL
1155 {
1156 .name = "disk_util",
1157 .type = FIO_OPT_BOOL,
1158 .off1 = td_var_offset(do_disk_util),
1159 .help = "Log disk utilization stats",
1160 .def = "1",
1161 },
1162#endif
Jens Axboee9459e52007-04-17 15:46:32 +02001163 {
Jens Axboe214e1ec2007-03-15 10:48:13 +01001164 .name = NULL,
1165 },
1166};
1167
1168void fio_options_dup_and_init(struct option *long_options)
1169{
1170 struct fio_option *o;
1171 unsigned int i;
1172
1173 options_init(options);
1174
1175 i = 0;
1176 while (long_options[i].name)
1177 i++;
1178
1179 o = &options[0];
1180 while (o->name) {
1181 long_options[i].name = o->name;
1182 long_options[i].val = FIO_GETOPT_JOB;
1183 if (o->type == FIO_OPT_STR_SET)
1184 long_options[i].has_arg = no_argument;
1185 else
1186 long_options[i].has_arg = required_argument;
1187
1188 i++;
1189 o++;
1190 assert(i < FIO_NR_OPTIONS);
1191 }
1192}
1193
1194int fio_option_parse(struct thread_data *td, const char *opt)
1195{
1196 return parse_option(opt, options, td);
1197}
1198
1199int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
1200{
1201 return parse_cmd_option(opt, val, options, td);
1202}
1203
1204void fio_fill_default_options(struct thread_data *td)
1205{
1206 fill_default_options(td, options);
1207}
1208
1209int fio_show_option_help(const char *opt)
1210{
1211 return show_cmd_help(options, opt);
1212}
Jens Axboed23bb322007-03-23 15:57:56 +01001213
1214static void __options_mem(struct thread_data *td, int alloc)
1215{
1216 struct thread_options *o = &td->o;
1217 struct fio_option *opt;
1218 char **ptr;
1219 int i;
1220
1221 for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) {
1222 if (opt->type != FIO_OPT_STR_STORE)
1223 continue;
1224
1225 ptr = (void *) o + opt->off1;
1226 if (*ptr) {
1227 if (alloc)
1228 *ptr = strdup(*ptr);
1229 else {
1230 free(*ptr);
1231 *ptr = NULL;
1232 }
1233 }
1234 }
1235}
1236
1237/*
1238 * dupe FIO_OPT_STR_STORE options
1239 */
1240void options_mem_dupe(struct thread_data *td)
1241{
1242 __options_mem(td, 1);
1243}
1244
Jens Axboe22d66212007-03-27 20:06:25 +02001245void options_mem_free(struct thread_data fio_unused *td)
Jens Axboed23bb322007-03-23 15:57:56 +01001246{
Jens Axboe22d66212007-03-27 20:06:25 +02001247#if 0
Jens Axboed23bb322007-03-23 15:57:56 +01001248 __options_mem(td, 0);
Jens Axboe22d66212007-03-27 20:06:25 +02001249#endif
Jens Axboed23bb322007-03-23 15:57:56 +01001250}