btrace2fio: expand rate options, bug fixes
[fio.git] / options.c
CommitLineData
214e1eca
JA
1#include <stdio.h>
2#include <stdlib.h>
3#include <unistd.h>
4#include <ctype.h>
5#include <string.h>
214e1eca 6#include <assert.h>
921c766f 7#include <libgen.h>
5921e80c
JA
8#include <fcntl.h>
9#include <sys/types.h>
10#include <sys/stat.h>
214e1eca
JA
11
12#include "fio.h"
4f5af7b2 13#include "verify.h"
214e1eca 14#include "parse.h"
eef32359 15#include "lib/fls.h"
9f988e2e 16#include "options.h"
214e1eca 17
5d7c5d34
JA
18#include "crc/crc32c.h"
19
214e1eca
JA
20/*
21 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
22 */
23static char *get_opt_postfix(const char *str)
24{
25 char *p = strstr(str, ":");
26
27 if (!p)
28 return NULL;
29
30 p++;
31 strip_blank_front(&p);
32 strip_blank_end(p);
33 return strdup(p);
34}
35
0e92f873
RR
36static int converthexchartoint(char a)
37{
38 int base;
39
3c3ed070 40 switch (a) {
0e92f873
RR
41 case '0'...'9':
42 base = '0';
43 break;
44 case 'A'...'F':
45 base = 'A' - 10;
46 break;
47 case 'a'...'f':
48 base = 'a' - 10;
49 break;
50 default:
51 base = 0;
52 }
3c3ed070 53 return a - base;
0e92f873
RR
54}
55
564ca972
JA
56static int bs_cmp(const void *p1, const void *p2)
57{
58 const struct bssplit *bsp1 = p1;
59 const struct bssplit *bsp2 = p2;
60
61 return bsp1->perc < bsp2->perc;
62}
63
83ea422a 64static int bssplit_ddir(struct thread_options *o, int ddir, char *str)
564ca972 65{
720e84ad 66 struct bssplit *bssplit;
564ca972
JA
67 unsigned int i, perc, perc_missing;
68 unsigned int max_bs, min_bs;
69 long long val;
720e84ad 70 char *fname;
564ca972 71
83ea422a 72 o->bssplit_nr[ddir] = 4;
720e84ad 73 bssplit = malloc(4 * sizeof(struct bssplit));
564ca972
JA
74
75 i = 0;
76 max_bs = 0;
77 min_bs = -1;
78 while ((fname = strsep(&str, ":")) != NULL) {
79 char *perc_str;
80
81 if (!strlen(fname))
82 break;
83
84 /*
85 * grow struct buffer, if needed
86 */
83ea422a
JA
87 if (i == o->bssplit_nr[ddir]) {
88 o->bssplit_nr[ddir] <<= 1;
89 bssplit = realloc(bssplit, o->bssplit_nr[ddir]
5ec10eaa 90 * sizeof(struct bssplit));
564ca972
JA
91 }
92
93 perc_str = strstr(fname, "/");
94 if (perc_str) {
95 *perc_str = '\0';
96 perc_str++;
97 perc = atoi(perc_str);
98 if (perc > 100)
99 perc = 100;
100 else if (!perc)
101 perc = -1;
102 } else
103 perc = -1;
104
0de5b26f 105 if (str_to_decimal(fname, &val, 1, o, 0)) {
564ca972 106 log_err("fio: bssplit conversion failed\n");
d8b97c8e 107 free(bssplit);
564ca972
JA
108 return 1;
109 }
110
111 if (val > max_bs)
112 max_bs = val;
113 if (val < min_bs)
114 min_bs = val;
115
720e84ad
JA
116 bssplit[i].bs = val;
117 bssplit[i].perc = perc;
564ca972
JA
118 i++;
119 }
120
83ea422a 121 o->bssplit_nr[ddir] = i;
564ca972
JA
122
123 /*
124 * Now check if the percentages add up, and how much is missing
125 */
126 perc = perc_missing = 0;
83ea422a 127 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
720e84ad 128 struct bssplit *bsp = &bssplit[i];
564ca972
JA
129
130 if (bsp->perc == (unsigned char) -1)
131 perc_missing++;
132 else
133 perc += bsp->perc;
134 }
135
40bafa33 136 if (perc > 100 && perc_missing > 1) {
564ca972 137 log_err("fio: bssplit percentages add to more than 100%%\n");
720e84ad 138 free(bssplit);
564ca972
JA
139 return 1;
140 }
141 /*
142 * If values didn't have a percentage set, divide the remains between
143 * them.
144 */
145 if (perc_missing) {
40bafa33
JA
146 if (perc_missing == 1)
147 perc = 100;
83ea422a 148 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
720e84ad 149 struct bssplit *bsp = &bssplit[i];
564ca972
JA
150
151 if (bsp->perc == (unsigned char) -1)
152 bsp->perc = (100 - perc) / perc_missing;
153 }
154 }
155
83ea422a
JA
156 o->min_bs[ddir] = min_bs;
157 o->max_bs[ddir] = max_bs;
564ca972
JA
158
159 /*
160 * now sort based on percentages, for ease of lookup
161 */
83ea422a
JA
162 qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
163 o->bssplit[ddir] = bssplit;
720e84ad 164 return 0;
720e84ad
JA
165}
166
167static int str_bssplit_cb(void *data, const char *input)
168{
169 struct thread_data *td = data;
6eaf09d6 170 char *str, *p, *odir, *ddir;
720e84ad
JA
171 int ret = 0;
172
52c0cea3
JA
173 if (parse_dryrun())
174 return 0;
175
720e84ad
JA
176 p = str = strdup(input);
177
178 strip_blank_front(&str);
179 strip_blank_end(str);
180
181 odir = strchr(str, ',');
182 if (odir) {
6eaf09d6
SL
183 ddir = strchr(odir + 1, ',');
184 if (ddir) {
d79db122 185 ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1);
6eaf09d6
SL
186 if (!ret)
187 *ddir = '\0';
188 } else {
189 char *op;
190
191 op = strdup(odir + 1);
d79db122 192 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
6eaf09d6
SL
193
194 free(op);
195 }
d79db122
JA
196 if (!ret)
197 ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1);
720e84ad
JA
198 if (!ret) {
199 *odir = '\0';
83ea422a 200 ret = bssplit_ddir(&td->o, DDIR_READ, str);
720e84ad
JA
201 }
202 } else {
203 char *op;
204
205 op = strdup(str);
d79db122 206 ret = bssplit_ddir(&td->o, DDIR_WRITE, op);
6eaf09d6 207 free(op);
720e84ad 208
6eaf09d6
SL
209 if (!ret) {
210 op = strdup(str);
d79db122 211 ret = bssplit_ddir(&td->o, DDIR_TRIM, op);
6eaf09d6
SL
212 free(op);
213 }
83ea422a 214 ret = bssplit_ddir(&td->o, DDIR_READ, str);
720e84ad 215 }
564ca972
JA
216
217 free(p);
720e84ad 218 return ret;
564ca972
JA
219}
220
8b28bd41
DM
221static int str2error(char *str)
222{
a94eb99a 223 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
8b28bd41
DM
224 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
225 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
226 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
227 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
228 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
229 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
a94eb99a 230 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
8b28bd41
DM
231 int i = 0, num = sizeof(err) / sizeof(void *);
232
a94eb99a 233 while (i < num) {
8b28bd41
DM
234 if (!strcmp(err[i], str))
235 return i + 1;
236 i++;
237 }
238 return 0;
239}
240
241static int ignore_error_type(struct thread_data *td, int etype, char *str)
242{
243 unsigned int i;
244 int *error;
245 char *fname;
246
247 if (etype >= ERROR_TYPE_CNT) {
248 log_err("Illegal error type\n");
249 return 1;
250 }
251
252 td->o.ignore_error_nr[etype] = 4;
253 error = malloc(4 * sizeof(struct bssplit));
254
255 i = 0;
256 while ((fname = strsep(&str, ":")) != NULL) {
257
258 if (!strlen(fname))
259 break;
260
261 /*
262 * grow struct buffer, if needed
263 */
264 if (i == td->o.ignore_error_nr[etype]) {
265 td->o.ignore_error_nr[etype] <<= 1;
266 error = realloc(error, td->o.ignore_error_nr[etype]
267 * sizeof(int));
268 }
269 if (fname[0] == 'E') {
270 error[i] = str2error(fname);
271 } else {
272 error[i] = atoi(fname);
273 if (error[i] < 0)
1616e025 274 error[i] = -error[i];
8b28bd41
DM
275 }
276 if (!error[i]) {
277 log_err("Unknown error %s, please use number value \n",
278 fname);
0fddbf7a 279 free(error);
8b28bd41
DM
280 return 1;
281 }
282 i++;
283 }
284 if (i) {
285 td->o.continue_on_error |= 1 << etype;
286 td->o.ignore_error_nr[etype] = i;
287 td->o.ignore_error[etype] = error;
c7b086be
JA
288 } else
289 free(error);
290
8b28bd41
DM
291 return 0;
292
293}
294
295static int str_ignore_error_cb(void *data, const char *input)
296{
297 struct thread_data *td = data;
298 char *str, *p, *n;
299 int type = 0, ret = 1;
52c0cea3
JA
300
301 if (parse_dryrun())
302 return 0;
303
8b28bd41
DM
304 p = str = strdup(input);
305
306 strip_blank_front(&str);
307 strip_blank_end(str);
308
309 while (p) {
310 n = strchr(p, ',');
311 if (n)
312 *n++ = '\0';
313 ret = ignore_error_type(td, type, p);
314 if (ret)
315 break;
316 p = n;
317 type++;
318 }
319 free(str);
320 return ret;
321}
322
211097b2
JA
323static int str_rw_cb(void *data, const char *str)
324{
325 struct thread_data *td = data;
83ea422a 326 struct thread_options *o = &td->o;
27ca949f 327 char *nr;
211097b2 328
52c0cea3
JA
329 if (parse_dryrun())
330 return 0;
331
83ea422a
JA
332 o->ddir_seq_nr = 1;
333 o->ddir_seq_add = 0;
059b0802 334
27ca949f 335 nr = get_opt_postfix(str);
059b0802
JA
336 if (!nr)
337 return 0;
338
339 if (td_random(td))
83ea422a 340 o->ddir_seq_nr = atoi(nr);
059b0802
JA
341 else {
342 long long val;
343
0de5b26f 344 if (str_to_decimal(nr, &val, 1, o, 0)) {
059b0802
JA
345 log_err("fio: rw postfix parsing failed\n");
346 free(nr);
347 return 1;
348 }
349
83ea422a 350 o->ddir_seq_add = val;
182ec6ee 351 }
211097b2 352
059b0802 353 free(nr);
211097b2
JA
354 return 0;
355}
356
214e1eca
JA
357static int str_mem_cb(void *data, const char *mem)
358{
359 struct thread_data *td = data;
360
d9759b1e 361 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP)
836fcc0f 362 td->o.mmapfile = get_opt_postfix(mem);
214e1eca
JA
363
364 return 0;
365}
366
c223da83
JA
367static int fio_clock_source_cb(void *data, const char *str)
368{
369 struct thread_data *td = data;
370
371 fio_clock_source = td->o.clocksource;
fa80feae 372 fio_clock_source_set = 1;
01423eae 373 fio_clock_init();
c223da83
JA
374 return 0;
375}
376
85bc833b 377static int str_rwmix_read_cb(void *data, unsigned long long *val)
cb499fc4
JA
378{
379 struct thread_data *td = data;
380
381 td->o.rwmix[DDIR_READ] = *val;
382 td->o.rwmix[DDIR_WRITE] = 100 - *val;
383 return 0;
384}
385
85bc833b 386static int str_rwmix_write_cb(void *data, unsigned long long *val)
cb499fc4
JA
387{
388 struct thread_data *td = data;
389
390 td->o.rwmix[DDIR_WRITE] = *val;
391 td->o.rwmix[DDIR_READ] = 100 - *val;
392 return 0;
393}
394
214e1eca
JA
395static int str_exitall_cb(void)
396{
397 exitall_on_terminate = 1;
398 return 0;
399}
400
214e1eca 401#ifdef FIO_HAVE_CPU_AFFINITY
50b5860b 402int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
c2acfbac 403{
50b5860b 404 unsigned int i, index, cpus_in_mask;
c2acfbac 405 const long max_cpu = cpus_online();
c2acfbac 406
50b5860b
JA
407 cpus_in_mask = fio_cpu_count(mask);
408 cpu_index = cpu_index % cpus_in_mask;
409
410 index = 0;
c2acfbac 411 for (i = 0; i < max_cpu; i++) {
50b5860b 412 if (!fio_cpu_isset(mask, i))
c2acfbac 413 continue;
50b5860b
JA
414
415 if (cpu_index != index)
416 fio_cpu_clear(mask, i);
417
418 index++;
c2acfbac
JA
419 }
420
421 return fio_cpu_count(mask);
422}
423
85bc833b 424static int str_cpumask_cb(void *data, unsigned long long *val)
d2e268b0
JA
425{
426 struct thread_data *td = data;
214e1eca 427 unsigned int i;
b03daafb 428 long max_cpu;
d2ce18b5
JA
429 int ret;
430
52c0cea3
JA
431 if (parse_dryrun())
432 return 0;
433
d2ce18b5
JA
434 ret = fio_cpuset_init(&td->o.cpumask);
435 if (ret < 0) {
436 log_err("fio: cpuset_init failed\n");
437 td_verror(td, ret, "fio_cpuset_init");
438 return 1;
439 }
214e1eca 440
c00a2289 441 max_cpu = cpus_online();
214e1eca 442
62a7273d
JA
443 for (i = 0; i < sizeof(int) * 8; i++) {
444 if ((1 << i) & *val) {
b03daafb
JA
445 if (i > max_cpu) {
446 log_err("fio: CPU %d too large (max=%ld)\n", i,
447 max_cpu);
448 return 1;
449 }
62a7273d 450 dprint(FD_PARSE, "set cpu allowed %d\n", i);
6d459ee7 451 fio_cpu_set(&td->o.cpumask, i);
62a7273d
JA
452 }
453 }
d2e268b0
JA
454
455 td->o.cpumask_set = 1;
456 return 0;
214e1eca
JA
457}
458
e8462bd8
JA
459static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
460 const char *input)
214e1eca 461{
d2e268b0 462 char *cpu, *str, *p;
b03daafb 463 long max_cpu;
19608d6c 464 int ret = 0;
d2e268b0 465
e8462bd8 466 ret = fio_cpuset_init(mask);
d2ce18b5
JA
467 if (ret < 0) {
468 log_err("fio: cpuset_init failed\n");
469 td_verror(td, ret, "fio_cpuset_init");
470 return 1;
471 }
d2e268b0
JA
472
473 p = str = strdup(input);
214e1eca 474
d2e268b0
JA
475 strip_blank_front(&str);
476 strip_blank_end(str);
477
c00a2289 478 max_cpu = cpus_online();
b03daafb 479
d2e268b0 480 while ((cpu = strsep(&str, ",")) != NULL) {
62a7273d
JA
481 char *str2, *cpu2;
482 int icpu, icpu2;
483
d2e268b0
JA
484 if (!strlen(cpu))
485 break;
62a7273d
JA
486
487 str2 = cpu;
488 icpu2 = -1;
489 while ((cpu2 = strsep(&str2, "-")) != NULL) {
490 if (!strlen(cpu2))
491 break;
492
493 icpu2 = atoi(cpu2);
494 }
495
496 icpu = atoi(cpu);
497 if (icpu2 == -1)
498 icpu2 = icpu;
499 while (icpu <= icpu2) {
6d459ee7 500 if (icpu >= FIO_MAX_CPUS) {
19608d6c 501 log_err("fio: your OS only supports up to"
6d459ee7 502 " %d CPUs\n", (int) FIO_MAX_CPUS);
19608d6c
JA
503 ret = 1;
504 break;
505 }
b03daafb
JA
506 if (icpu > max_cpu) {
507 log_err("fio: CPU %d too large (max=%ld)\n",
508 icpu, max_cpu);
509 ret = 1;
510 break;
511 }
0b9d69ec 512
62a7273d 513 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
e8462bd8 514 fio_cpu_set(mask, icpu);
62a7273d
JA
515 icpu++;
516 }
19608d6c
JA
517 if (ret)
518 break;
d2e268b0
JA
519 }
520
521 free(p);
19608d6c
JA
522 if (!ret)
523 td->o.cpumask_set = 1;
524 return ret;
214e1eca 525}
e8462bd8
JA
526
527static int str_cpus_allowed_cb(void *data, const char *input)
528{
529 struct thread_data *td = data;
530 int ret;
531
52c0cea3
JA
532 if (parse_dryrun())
533 return 0;
534
e8462bd8
JA
535 ret = set_cpus_allowed(td, &td->o.cpumask, input);
536 if (!ret)
537 td->o.cpumask_set = 1;
538
539 return ret;
540}
541
542static int str_verify_cpus_allowed_cb(void *data, const char *input)
543{
544 struct thread_data *td = data;
545 int ret;
546
547 ret = set_cpus_allowed(td, &td->o.verify_cpumask, input);
548 if (!ret)
549 td->o.verify_cpumask_set = 1;
550
551 return ret;
552}
d2e268b0 553#endif
214e1eca 554
67bf9823 555#ifdef CONFIG_LIBNUMA
d0b937ed
YR
556static int str_numa_cpunodes_cb(void *data, char *input)
557{
558 struct thread_data *td = data;
43522848 559 struct bitmask *verify_bitmask;
d0b937ed 560
52c0cea3
JA
561 if (parse_dryrun())
562 return 0;
563
d0b937ed
YR
564 /* numa_parse_nodestring() parses a character string list
565 * of nodes into a bit mask. The bit mask is allocated by
566 * numa_allocate_nodemask(), so it should be freed by
567 * numa_free_nodemask().
568 */
43522848
DG
569 verify_bitmask = numa_parse_nodestring(input);
570 if (verify_bitmask == NULL) {
d0b937ed
YR
571 log_err("fio: numa_parse_nodestring failed\n");
572 td_verror(td, 1, "str_numa_cpunodes_cb");
573 return 1;
574 }
43522848 575 numa_free_nodemask(verify_bitmask);
d0b937ed 576
43522848 577 td->o.numa_cpunodes = strdup(input);
d0b937ed
YR
578 td->o.numa_cpumask_set = 1;
579 return 0;
580}
581
582static int str_numa_mpol_cb(void *data, char *input)
583{
584 struct thread_data *td = data;
585 const char * const policy_types[] =
05d6f44b 586 { "default", "prefer", "bind", "interleave", "local", NULL };
d0b937ed 587 int i;
52c0cea3 588 char *nodelist;
43522848 589 struct bitmask *verify_bitmask;
52c0cea3
JA
590
591 if (parse_dryrun())
592 return 0;
d0b937ed 593
52c0cea3 594 nodelist = strchr(input, ':');
d0b937ed
YR
595 if (nodelist) {
596 /* NUL-terminate mode */
597 *nodelist++ = '\0';
598 }
599
600 for (i = 0; i <= MPOL_LOCAL; i++) {
601 if (!strcmp(input, policy_types[i])) {
602 td->o.numa_mem_mode = i;
603 break;
604 }
605 }
606 if (i > MPOL_LOCAL) {
607 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
608 goto out;
609 }
610
611 switch (td->o.numa_mem_mode) {
612 case MPOL_PREFERRED:
613 /*
614 * Insist on a nodelist of one node only
615 */
616 if (nodelist) {
617 char *rest = nodelist;
618 while (isdigit(*rest))
619 rest++;
620 if (*rest) {
621 log_err("fio: one node only for \'prefer\'\n");
622 goto out;
623 }
624 } else {
625 log_err("fio: one node is needed for \'prefer\'\n");
626 goto out;
627 }
628 break;
629 case MPOL_INTERLEAVE:
630 /*
631 * Default to online nodes with memory if no nodelist
632 */
633 if (!nodelist)
634 nodelist = strdup("all");
635 break;
636 case MPOL_LOCAL:
637 case MPOL_DEFAULT:
638 /*
639 * Don't allow a nodelist
640 */
641 if (nodelist) {
642 log_err("fio: NO nodelist for \'local\'\n");
643 goto out;
644 }
645 break;
646 case MPOL_BIND:
647 /*
648 * Insist on a nodelist
649 */
650 if (!nodelist) {
651 log_err("fio: a nodelist is needed for \'bind\'\n");
652 goto out;
653 }
654 break;
655 }
656
657
658 /* numa_parse_nodestring() parses a character string list
659 * of nodes into a bit mask. The bit mask is allocated by
660 * numa_allocate_nodemask(), so it should be freed by
661 * numa_free_nodemask().
662 */
663 switch (td->o.numa_mem_mode) {
664 case MPOL_PREFERRED:
665 td->o.numa_mem_prefer_node = atoi(nodelist);
666 break;
667 case MPOL_INTERLEAVE:
668 case MPOL_BIND:
43522848
DG
669 verify_bitmask = numa_parse_nodestring(nodelist);
670 if (verify_bitmask == NULL) {
d0b937ed
YR
671 log_err("fio: numa_parse_nodestring failed\n");
672 td_verror(td, 1, "str_numa_memnodes_cb");
673 return 1;
674 }
43522848
DG
675 td->o.numa_memnodes = strdup(nodelist);
676 numa_free_nodemask(verify_bitmask);
b74e419e 677
d0b937ed
YR
678 break;
679 case MPOL_LOCAL:
680 case MPOL_DEFAULT:
681 default:
682 break;
683 }
684
685 td->o.numa_memmask_set = 1;
686 return 0;
687
688out:
689 return 1;
690}
691#endif
692
214e1eca
JA
693static int str_fst_cb(void *data, const char *str)
694{
695 struct thread_data *td = data;
696 char *nr = get_opt_postfix(str);
697
698 td->file_service_nr = 1;
182ec6ee 699 if (nr) {
214e1eca 700 td->file_service_nr = atoi(nr);
182ec6ee
JA
701 free(nr);
702 }
214e1eca
JA
703
704 return 0;
705}
706
67bf9823 707#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
708static int str_sfr_cb(void *data, const char *str)
709{
710 struct thread_data *td = data;
711 char *nr = get_opt_postfix(str);
712
713 td->sync_file_range_nr = 1;
714 if (nr) {
715 td->sync_file_range_nr = atoi(nr);
716 free(nr);
717 }
718
719 return 0;
720}
3ae06371 721#endif
44f29692 722
e25839d4
JA
723static int str_random_distribution_cb(void *data, const char *str)
724{
725 struct thread_data *td = data;
726 double val;
727 char *nr;
728
52c0cea3
JA
729 if (parse_dryrun())
730 return 0;
731
925fee33
JA
732 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
733 val = 1.1;
734 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
735 val = 0.2;
736 else
e25839d4
JA
737 return 0;
738
739 nr = get_opt_postfix(str);
925fee33 740 if (nr && !str_to_float(nr, &val)) {
e25839d4
JA
741 log_err("fio: random postfix parsing failed\n");
742 free(nr);
743 return 1;
744 }
745
078189c1
JA
746 free(nr);
747
18ded917
JA
748 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
749 if (val == 1.00) {
750 log_err("fio: zipf theta must different than 1.0\n");
751 return 1;
752 }
1e5324e7 753 td->o.zipf_theta.u.f = val;
18ded917 754 } else {
078189c1
JA
755 if (val <= 0.00 || val >= 1.00) {
756 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
757 return 1;
758 }
1e5324e7 759 td->o.pareto_h.u.f = val;
fcef0b35 760 }
921c766f
JA
761
762 return 0;
763}
764
8e827d35 765/*
bcbfeefa 766 * Return next name in the string. Files are separated with ':'. If the ':'
8e827d35
JA
767 * is escaped with a '\', then that ':' is part of the filename and does not
768 * indicate a new file.
769 */
bcbfeefa 770static char *get_next_name(char **ptr)
8e827d35
JA
771{
772 char *str = *ptr;
773 char *p, *start;
774
775 if (!str || !strlen(str))
776 return NULL;
777
778 start = str;
779 do {
780 /*
781 * No colon, we are done
782 */
783 p = strchr(str, ':');
784 if (!p) {
785 *ptr = NULL;
786 break;
787 }
788
789 /*
790 * We got a colon, but it's the first character. Skip and
791 * continue
792 */
793 if (p == start) {
794 str = ++start;
795 continue;
796 }
797
798 if (*(p - 1) != '\\') {
799 *p = '\0';
800 *ptr = p + 1;
801 break;
802 }
803
804 memmove(p - 1, p, strlen(p) + 1);
805 str = p;
806 } while (1);
807
808 return start;
809}
810
bcbfeefa
CE
811
812static int get_max_name_idx(char *input)
813{
814 unsigned int cur_idx;
815 char *str, *p;
816
817 p = str = strdup(input);
818 for (cur_idx = 0; ; cur_idx++)
819 if (get_next_name(&str) == NULL)
820 break;
821
822 free(p);
823 return cur_idx;
824}
825
826/*
827 * Returns the directory at the index, indexes > entires will be
828 * assigned via modulo division of the index
829 */
830int set_name_idx(char *target, char *input, int index)
831{
832 unsigned int cur_idx;
833 int len;
834 char *fname, *str, *p;
835
836 p = str = strdup(input);
837
838 index %= get_max_name_idx(input);
839 for (cur_idx = 0; cur_idx <= index; cur_idx++)
840 fname = get_next_name(&str);
841
842 len = sprintf(target, "%s/", fname);
843 free(p);
844
845 return len;
846}
847
214e1eca
JA
848static int str_filename_cb(void *data, const char *input)
849{
850 struct thread_data *td = data;
851 char *fname, *str, *p;
852
853 p = str = strdup(input);
854
855 strip_blank_front(&str);
856 strip_blank_end(str);
857
858 if (!td->files_index)
2dc1bbeb 859 td->o.nr_files = 0;
214e1eca 860
bcbfeefa 861 while ((fname = get_next_name(&str)) != NULL) {
214e1eca
JA
862 if (!strlen(fname))
863 break;
5903e7b7 864 add_file(td, fname, 0, 1);
214e1eca
JA
865 }
866
867 free(p);
868 return 0;
869}
870
bcbfeefa 871static int str_directory_cb(void *data, const char fio_unused *unused)
214e1eca
JA
872{
873 struct thread_data *td = data;
874 struct stat sb;
bcbfeefa
CE
875 char *dirname, *str, *p;
876 int ret = 0;
214e1eca 877
f9633d72
JA
878 if (parse_dryrun())
879 return 0;
880
bcbfeefa
CE
881 p = str = strdup(td->o.directory);
882 while ((dirname = get_next_name(&str)) != NULL) {
883 if (lstat(dirname, &sb) < 0) {
884 ret = errno;
921c766f 885
bcbfeefa
CE
886 log_err("fio: %s is not a directory\n", dirname);
887 td_verror(td, ret, "lstat");
888 goto out;
889 }
890 if (!S_ISDIR(sb.st_mode)) {
891 log_err("fio: %s is not a directory\n", dirname);
892 ret = 1;
893 goto out;
894 }
214e1eca
JA
895 }
896
bcbfeefa
CE
897out:
898 free(p);
899 return ret;
214e1eca
JA
900}
901
f2a2803a
JA
902static int str_lockfile_cb(void *data, const char fio_unused *str)
903{
904 struct thread_data *td = data;
905
906 if (td->files_index) {
907 log_err("fio: lockfile= option must precede filename=\n");
908 return 1;
909 }
910
911 return 0;
912}
913
214e1eca
JA
914static int str_opendir_cb(void *data, const char fio_unused *str)
915{
916 struct thread_data *td = data;
917
52c0cea3
JA
918 if (parse_dryrun())
919 return 0;
920
214e1eca 921 if (!td->files_index)
2dc1bbeb 922 td->o.nr_files = 0;
214e1eca 923
2dc1bbeb 924 return add_dir_files(td, td->o.opendir);
214e1eca
JA
925}
926
ce35b1ec
JA
927static int pattern_cb(char *pattern, unsigned int max_size,
928 const char *input, unsigned int *pattern_bytes)
90059d65 929{
0e92f873 930 long off;
ce35b1ec
JA
931 int i = 0, j = 0, len, k, base = 10;
932 uint32_t pattern_length;
3c3ed070 933 char *loc1, *loc2;
0e92f873 934
02975b64
JA
935 /*
936 * Check if it's a string input
937 */
938 loc1 = strchr(input, '\"');
939 if (loc1) {
940 do {
941 loc1++;
942 if (*loc1 == '\0' || *loc1 == '\"')
943 break;
944
945 pattern[i] = *loc1;
946 i++;
947 } while (i < max_size);
948
949 if (!i)
950 return 1;
951
952 goto fill;
953 }
954
955 /*
956 * No string, find out if it's decimal or hexidecimal
957 */
0e92f873
RR
958 loc1 = strstr(input, "0x");
959 loc2 = strstr(input, "0X");
960 if (loc1 || loc2)
961 base = 16;
962 off = strtol(input, NULL, base);
963 if (off != LONG_MAX || errno != ERANGE) {
964 while (off) {
ce35b1ec 965 pattern[i] = off & 0xff;
0e92f873
RR
966 off >>= 8;
967 i++;
968 }
969 } else {
970 len = strlen(input);
971 k = len - 1;
972 if (base == 16) {
973 if (loc1)
974 j = loc1 - input + 2;
975 else
976 j = loc2 - input + 2;
977 } else
978 return 1;
ce35b1ec 979 if (len - j < max_size * 2) {
0e92f873
RR
980 while (k >= j) {
981 off = converthexchartoint(input[k--]);
982 if (k >= j)
983 off += (converthexchartoint(input[k--])
984 * 16);
ce35b1ec 985 pattern[i++] = (char) off;
0e92f873
RR
986 }
987 }
988 }
efcd9dcc
SL
989
990 /*
991 * Fill the pattern all the way to the end. This greatly reduces
992 * the number of memcpy's we have to do when verifying the IO.
993 */
02975b64 994fill:
e078de4a 995 pattern_length = i;
ce35b1ec
JA
996 while (i > 1 && i * 2 <= max_size) {
997 memcpy(&pattern[i], &pattern[0], i);
efcd9dcc
SL
998 i *= 2;
999 }
e078de4a
JA
1000
1001 /*
1002 * Fill remainder, if the pattern multiple ends up not being
ce35b1ec 1003 * max_size.
e078de4a 1004 */
ce35b1ec
JA
1005 while (i > 1 && i < max_size) {
1006 unsigned int b = min(pattern_length, max_size - i);
e078de4a 1007
ce35b1ec 1008 memcpy(&pattern[i], &pattern[0], b);
e078de4a
JA
1009 i += b;
1010 }
1011
9a2a86d0
SL
1012 if (i == 1) {
1013 /*
d2ba0d7c
JA
1014 * The code in verify_io_u_pattern assumes a single byte
1015 * pattern fills the whole verify pattern buffer.
9a2a86d0 1016 */
ce35b1ec
JA
1017 memset(pattern, pattern[0], max_size);
1018 }
1019
1020 *pattern_bytes = i;
1021 return 0;
1022}
1023
1024static int str_buffer_pattern_cb(void *data, const char *input)
1025{
1026 struct thread_data *td = data;
1027 int ret;
1028
1029 ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input,
1030 &td->o.buffer_pattern_bytes);
1031
d2ba0d7c 1032 if (!ret && td->o.buffer_pattern_bytes) {
ce35b1ec
JA
1033 td->o.refill_buffers = 0;
1034 td->o.scramble_buffers = 0;
1035 td->o.zero_buffers = 0;
d2ba0d7c
JA
1036 } else {
1037 log_err("fio: failed parsing pattern `%s`\n", input);
1038 ret = 1;
9a2a86d0 1039 }
efcd9dcc 1040
ce35b1ec
JA
1041 return ret;
1042}
1043
bedc9dc2
JA
1044static int str_buffer_compress_cb(void *data, unsigned long long *il)
1045{
1046 struct thread_data *td = data;
1047
1048 td->flags |= TD_F_COMPRESS;
1049 td->o.compress_percentage = *il;
1050 return 0;
1051}
1052
ce35b1ec
JA
1053static int str_verify_pattern_cb(void *data, const char *input)
1054{
1055 struct thread_data *td = data;
1056 int ret;
1057
1058 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1059 &td->o.verify_pattern_bytes);
efcd9dcc 1060
92bf48d5
JA
1061 /*
1062 * VERIFY_META could already be set
1063 */
ce35b1ec 1064 if (!ret && td->o.verify == VERIFY_NONE)
92bf48d5 1065 td->o.verify = VERIFY_PATTERN;
efcd9dcc 1066
ce35b1ec 1067 return ret;
90059d65 1068}
214e1eca 1069
993bf48b
JA
1070static int str_gtod_reduce_cb(void *data, int *il)
1071{
1072 struct thread_data *td = data;
1073 int val = *il;
1074
02af0988 1075 td->o.disable_lat = !!val;
993bf48b
JA
1076 td->o.disable_clat = !!val;
1077 td->o.disable_slat = !!val;
1078 td->o.disable_bw = !!val;
0dc1bc03 1079 td->o.clat_percentiles = !val;
993bf48b
JA
1080 if (val)
1081 td->tv_cache_mask = 63;
1082
1083 return 0;
1084}
1085
85bc833b 1086static int str_gtod_cpu_cb(void *data, long long *il)
be4ecfdf
JA
1087{
1088 struct thread_data *td = data;
1089 int val = *il;
1090
1091 td->o.gtod_cpu = val;
1092 td->o.gtod_offload = 1;
1093 return 0;
1094}
1095
7bb59102
JA
1096static int str_size_cb(void *data, unsigned long long *__val)
1097{
1098 struct thread_data *td = data;
1099 unsigned long long v = *__val;
1100
1101 if (parse_is_percent(v)) {
1102 td->o.size = 0;
1103 td->o.size_percent = -1ULL - v;
1104 } else
1105 td->o.size = v;
1106
1107 return 0;
1108}
1109
896cac2a
JA
1110static int rw_verify(struct fio_option *o, void *data)
1111{
1112 struct thread_data *td = data;
1113
1114 if (read_only && td_write(td)) {
1115 log_err("fio: job <%s> has write bit set, but fio is in"
1116 " read-only mode\n", td->o.name);
1117 return 1;
1118 }
1119
1120 return 0;
1121}
1122
276ca4f7 1123static int gtod_cpu_verify(struct fio_option *o, void *data)
29d43ff9 1124{
276ca4f7 1125#ifndef FIO_HAVE_CPU_AFFINITY
29d43ff9
JA
1126 struct thread_data *td = data;
1127
29d43ff9
JA
1128 if (td->o.gtod_cpu) {
1129 log_err("fio: platform must support CPU affinity for"
1130 "gettimeofday() offloading\n");
1131 return 1;
1132 }
1133#endif
1134
1135 return 0;
1136}
1137
9af4a244
JA
1138/*
1139 * Option grouping
1140 */
1141static struct opt_group fio_opt_groups[] = {
1142 {
e8b0e958
JA
1143 .name = "General",
1144 .mask = FIO_OPT_C_GENERAL,
9af4a244
JA
1145 },
1146 {
e8b0e958
JA
1147 .name = "I/O",
1148 .mask = FIO_OPT_C_IO,
9af4a244
JA
1149 },
1150 {
e8b0e958
JA
1151 .name = "File",
1152 .mask = FIO_OPT_C_FILE,
9af4a244
JA
1153 },
1154 {
e8b0e958
JA
1155 .name = "Statistics",
1156 .mask = FIO_OPT_C_STAT,
9af4a244
JA
1157 },
1158 {
e8b0e958
JA
1159 .name = "Logging",
1160 .mask = FIO_OPT_C_LOG,
9af4a244 1161 },
13fca827
JA
1162 {
1163 .name = "Profiles",
1164 .mask = FIO_OPT_C_PROFILE,
1165 },
e231bbe6 1166 {
e8b0e958 1167 .name = NULL,
e231bbe6 1168 },
e8b0e958
JA
1169};
1170
1171static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1172 unsigned int inv_mask)
1173{
1174 struct opt_group *og;
1175 int i;
1176
1177 if (*mask == inv_mask || !*mask)
1178 return NULL;
1179
1180 for (i = 0; ogs[i].name; i++) {
1181 og = &ogs[i];
1182
1183 if (*mask & og->mask) {
1184 *mask &= ~(og->mask);
1185 return og;
1186 }
1187 }
1188
1189 return NULL;
1190}
1191
1192struct opt_group *opt_group_from_mask(unsigned int *mask)
1193{
1194 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1195}
1196
1197static struct opt_group fio_opt_cat_groups[] = {
3e260a46
JA
1198 {
1199 .name = "Latency profiling",
1200 .mask = FIO_OPT_G_LATPROF,
1201 },
9af4a244 1202 {
e8b0e958
JA
1203 .name = "Rate",
1204 .mask = FIO_OPT_G_RATE,
9af4a244
JA
1205 },
1206 {
e8b0e958
JA
1207 .name = "Zone",
1208 .mask = FIO_OPT_G_ZONE,
9af4a244
JA
1209 },
1210 {
e8b0e958
JA
1211 .name = "Read/write mix",
1212 .mask = FIO_OPT_G_RWMIX,
9af4a244
JA
1213 },
1214 {
1215 .name = "Verify",
1216 .mask = FIO_OPT_G_VERIFY,
1217 },
1218 {
e8b0e958
JA
1219 .name = "Trim",
1220 .mask = FIO_OPT_G_TRIM,
9af4a244
JA
1221 },
1222 {
e8b0e958
JA
1223 .name = "I/O Logging",
1224 .mask = FIO_OPT_G_IOLOG,
9af4a244
JA
1225 },
1226 {
e8b0e958
JA
1227 .name = "I/O Depth",
1228 .mask = FIO_OPT_G_IO_DEPTH,
9af4a244
JA
1229 },
1230 {
e8b0e958
JA
1231 .name = "I/O Flow",
1232 .mask = FIO_OPT_G_IO_FLOW,
9af4a244 1233 },
0626037e
JA
1234 {
1235 .name = "Description",
1236 .mask = FIO_OPT_G_DESC,
1237 },
1238 {
1239 .name = "Filename",
1240 .mask = FIO_OPT_G_FILENAME,
1241 },
1242 {
1243 .name = "General I/O",
1244 .mask = FIO_OPT_G_IO_BASIC,
1245 },
a1f6afec
JA
1246 {
1247 .name = "Cgroups",
1248 .mask = FIO_OPT_G_CGROUP,
1249 },
1250 {
1251 .name = "Runtime",
1252 .mask = FIO_OPT_G_RUNTIME,
1253 },
10860056
JA
1254 {
1255 .name = "Process",
1256 .mask = FIO_OPT_G_PROCESS,
1257 },
1258 {
1259 .name = "Job credentials / priority",
1260 .mask = FIO_OPT_G_CRED,
1261 },
1262 {
1263 .name = "Clock settings",
1264 .mask = FIO_OPT_G_CLOCK,
1265 },
3ceb458f
JA
1266 {
1267 .name = "I/O Type",
1268 .mask = FIO_OPT_G_IO_TYPE,
1269 },
1270 {
1271 .name = "I/O Thinktime",
1272 .mask = FIO_OPT_G_THINKTIME,
1273 },
1274 {
1275 .name = "Randomizations",
1276 .mask = FIO_OPT_G_RANDOM,
1277 },
1278 {
1279 .name = "I/O buffers",
1280 .mask = FIO_OPT_G_IO_BUF,
1281 },
13fca827
JA
1282 {
1283 .name = "Tiobench profile",
1284 .mask = FIO_OPT_G_TIOBENCH,
1285 },
1286
9af4a244
JA
1287 {
1288 .name = NULL,
e8b0e958 1289 }
9af4a244
JA
1290};
1291
e8b0e958 1292struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
9af4a244 1293{
e8b0e958 1294 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
9af4a244
JA
1295}
1296
214e1eca
JA
1297/*
1298 * Map of job/command line options
1299 */
9af4a244 1300struct fio_option fio_options[FIO_MAX_OPTS] = {
214e1eca
JA
1301 {
1302 .name = "description",
e8b0e958 1303 .lname = "Description of job",
214e1eca
JA
1304 .type = FIO_OPT_STR_STORE,
1305 .off1 = td_var_offset(description),
1306 .help = "Text job description",
e8b0e958 1307 .category = FIO_OPT_C_GENERAL,
0626037e 1308 .group = FIO_OPT_G_DESC,
214e1eca
JA
1309 },
1310 {
1311 .name = "name",
e8b0e958 1312 .lname = "Job name",
214e1eca
JA
1313 .type = FIO_OPT_STR_STORE,
1314 .off1 = td_var_offset(name),
1315 .help = "Name of this job",
e8b0e958 1316 .category = FIO_OPT_C_GENERAL,
0626037e 1317 .group = FIO_OPT_G_DESC,
214e1eca 1318 },
214e1eca
JA
1319 {
1320 .name = "filename",
e8b0e958 1321 .lname = "Filename(s)",
214e1eca
JA
1322 .type = FIO_OPT_STR_STORE,
1323 .off1 = td_var_offset(filename),
1324 .cb = str_filename_cb,
f0d524b0 1325 .prio = -1, /* must come after "directory" */
214e1eca 1326 .help = "File(s) to use for the workload",
e8b0e958 1327 .category = FIO_OPT_C_FILE,
0626037e 1328 .group = FIO_OPT_G_FILENAME,
214e1eca 1329 },
90fef2d1 1330 {
e8b0e958
JA
1331 .name = "directory",
1332 .lname = "Directory",
1333 .type = FIO_OPT_STR_STORE,
1334 .off1 = td_var_offset(directory),
1335 .cb = str_directory_cb,
1336 .help = "Directory to store files in",
1337 .category = FIO_OPT_C_FILE,
0626037e 1338 .group = FIO_OPT_G_FILENAME,
90fef2d1 1339 },
de98bd30
JA
1340 {
1341 .name = "filename_format",
1342 .type = FIO_OPT_STR_STORE,
1343 .off1 = td_var_offset(filename_format),
1344 .prio = -1, /* must come after "directory" */
1345 .help = "Override default $jobname.$jobnum.$filenum naming",
1346 .def = "$jobname.$jobnum.$filenum",
93bb626a
JA
1347 .category = FIO_OPT_C_FILE,
1348 .group = FIO_OPT_G_FILENAME,
ad705bcb 1349 },
29c1349f
JA
1350 {
1351 .name = "lockfile",
e8b0e958 1352 .lname = "Lockfile",
4d4e80f2 1353 .type = FIO_OPT_STR,
4d4e80f2 1354 .off1 = td_var_offset(file_lock_mode),
29c1349f 1355 .help = "Lock file when doing IO to it",
bc6a0a5d 1356 .prio = 1,
29c1349f 1357 .parent = "filename",
d71c154c 1358 .hide = 0,
4d4e80f2 1359 .def = "none",
f2a2803a 1360 .cb = str_lockfile_cb,
e8b0e958 1361 .category = FIO_OPT_C_FILE,
0626037e 1362 .group = FIO_OPT_G_FILENAME,
4d4e80f2
JA
1363 .posval = {
1364 { .ival = "none",
1365 .oval = FILE_LOCK_NONE,
1366 .help = "No file locking",
1367 },
1368 { .ival = "exclusive",
1369 .oval = FILE_LOCK_EXCLUSIVE,
1370 .help = "Exclusive file lock",
1371 },
1372 {
1373 .ival = "readwrite",
1374 .oval = FILE_LOCK_READWRITE,
1375 .help = "Read vs write lock",
1376 },
1377 },
29c1349f 1378 },
214e1eca
JA
1379 {
1380 .name = "opendir",
e8b0e958 1381 .lname = "Open directory",
214e1eca
JA
1382 .type = FIO_OPT_STR_STORE,
1383 .off1 = td_var_offset(opendir),
1384 .cb = str_opendir_cb,
1385 .help = "Recursively add files from this directory and down",
e8b0e958 1386 .category = FIO_OPT_C_FILE,
0626037e 1387 .group = FIO_OPT_G_FILENAME,
214e1eca
JA
1388 },
1389 {
1390 .name = "rw",
e8b0e958 1391 .lname = "Read/write",
d3aad8f2 1392 .alias = "readwrite",
214e1eca 1393 .type = FIO_OPT_STR,
211097b2 1394 .cb = str_rw_cb,
214e1eca
JA
1395 .off1 = td_var_offset(td_ddir),
1396 .help = "IO direction",
1397 .def = "read",
896cac2a 1398 .verify = rw_verify,
e8b0e958 1399 .category = FIO_OPT_C_IO,
0626037e 1400 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1401 .posval = {
1402 { .ival = "read",
1403 .oval = TD_DDIR_READ,
1404 .help = "Sequential read",
1405 },
1406 { .ival = "write",
1407 .oval = TD_DDIR_WRITE,
1408 .help = "Sequential write",
1409 },
6eaf09d6
SL
1410 { .ival = "trim",
1411 .oval = TD_DDIR_TRIM,
1412 .help = "Sequential trim",
1413 },
214e1eca
JA
1414 { .ival = "randread",
1415 .oval = TD_DDIR_RANDREAD,
1416 .help = "Random read",
1417 },
1418 { .ival = "randwrite",
1419 .oval = TD_DDIR_RANDWRITE,
1420 .help = "Random write",
1421 },
6eaf09d6
SL
1422 { .ival = "randtrim",
1423 .oval = TD_DDIR_RANDTRIM,
1424 .help = "Random trim",
1425 },
214e1eca
JA
1426 { .ival = "rw",
1427 .oval = TD_DDIR_RW,
1428 .help = "Sequential read and write mix",
1429 },
10b023db
JA
1430 { .ival = "readwrite",
1431 .oval = TD_DDIR_RW,
1432 .help = "Sequential read and write mix",
1433 },
214e1eca
JA
1434 { .ival = "randrw",
1435 .oval = TD_DDIR_RANDRW,
1436 .help = "Random read and write mix"
1437 },
1438 },
1439 },
38dad62d
JA
1440 {
1441 .name = "rw_sequencer",
e8b0e958 1442 .lname = "RW Sequencer",
38dad62d
JA
1443 .type = FIO_OPT_STR,
1444 .off1 = td_var_offset(rw_seq),
1445 .help = "IO offset generator modifier",
1446 .def = "sequential",
e8b0e958 1447 .category = FIO_OPT_C_IO,
0626037e 1448 .group = FIO_OPT_G_IO_BASIC,
38dad62d
JA
1449 .posval = {
1450 { .ival = "sequential",
1451 .oval = RW_SEQ_SEQ,
1452 .help = "Generate sequential offsets",
1453 },
1454 { .ival = "identical",
1455 .oval = RW_SEQ_IDENT,
1456 .help = "Generate identical offsets",
1457 },
1458 },
1459 },
1460
214e1eca
JA
1461 {
1462 .name = "ioengine",
e8b0e958 1463 .lname = "IO Engine",
214e1eca
JA
1464 .type = FIO_OPT_STR_STORE,
1465 .off1 = td_var_offset(ioengine),
1466 .help = "IO engine to use",
58483fa4 1467 .def = FIO_PREFERRED_ENGINE,
e8b0e958 1468 .category = FIO_OPT_C_IO,
0626037e 1469 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1470 .posval = {
1471 { .ival = "sync",
1472 .help = "Use read/write",
1473 },
a31041ea 1474 { .ival = "psync",
1475 .help = "Use pread/pwrite",
1476 },
1d2af02a 1477 { .ival = "vsync",
03e20d68 1478 .help = "Use readv/writev",
1d2af02a 1479 },
07fc0acd
JA
1480#ifdef CONFIG_PWRITEV
1481 { .ival = "pvsync",
1482 .help = "Use preadv/pwritev",
1483 },
1484#endif
67bf9823 1485#ifdef CONFIG_LIBAIO
214e1eca
JA
1486 { .ival = "libaio",
1487 .help = "Linux native asynchronous IO",
1488 },
1489#endif
67bf9823 1490#ifdef CONFIG_POSIXAIO
214e1eca
JA
1491 { .ival = "posixaio",
1492 .help = "POSIX asynchronous IO",
1493 },
417f0068 1494#endif
997843cb 1495#ifdef CONFIG_SOLARISAIO
417f0068
JA
1496 { .ival = "solarisaio",
1497 .help = "Solaris native asynchronous IO",
1498 },
214e1eca 1499#endif
4700b234 1500#ifdef CONFIG_WINDOWSAIO
03e20d68 1501 { .ival = "windowsaio",
3be80071 1502 .help = "Windows native asynchronous IO"
de890a1e 1503 },
fc5c0345
DG
1504#endif
1505#ifdef CONFIG_RBD
1506 { .ival = "rbd",
1507 .help = "Rados Block Device asynchronous IO"
1508 },
3be80071 1509#endif
214e1eca 1510 { .ival = "mmap",
03e20d68 1511 .help = "Memory mapped IO"
214e1eca 1512 },
67bf9823 1513#ifdef CONFIG_LINUX_SPLICE
214e1eca
JA
1514 { .ival = "splice",
1515 .help = "splice/vmsplice based IO",
1516 },
9cce02e8
JA
1517 { .ival = "netsplice",
1518 .help = "splice/vmsplice to/from the network",
1519 },
214e1eca
JA
1520#endif
1521#ifdef FIO_HAVE_SGIO
1522 { .ival = "sg",
1523 .help = "SCSI generic v3 IO",
1524 },
1525#endif
1526 { .ival = "null",
1527 .help = "Testing engine (no data transfer)",
1528 },
1529 { .ival = "net",
1530 .help = "Network IO",
1531 },
214e1eca 1532 { .ival = "cpuio",
03e20d68 1533 .help = "CPU cycle burner engine",
214e1eca 1534 },
67bf9823 1535#ifdef CONFIG_GUASI
b8c82a46
JA
1536 { .ival = "guasi",
1537 .help = "GUASI IO engine",
1538 },
79a43187
JA
1539#endif
1540#ifdef FIO_HAVE_BINJECT
1541 { .ival = "binject",
1542 .help = "binject direct inject block engine",
1543 },
21b8aee8 1544#endif
67bf9823 1545#ifdef CONFIG_RDMA
21b8aee8 1546 { .ival = "rdma",
1547 .help = "RDMA IO engine",
1548 },
8200b8c7 1549#endif
67bf9823 1550#ifdef CONFIG_FUSION_AW
8200b8c7
JA
1551 { .ival = "fusion-aw-sync",
1552 .help = "Fusion-io atomic write engine",
1553 },
1ecc95ca 1554#endif
997843cb 1555#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1ecc95ca
JA
1556 { .ival = "e4defrag",
1557 .help = "ext4 defrag engine",
1558 },
1559#endif
997843cb 1560#ifdef CONFIG_LINUX_FALLOCATE
1ecc95ca
JA
1561 { .ival = "falloc",
1562 .help = "fallocate() file based engine",
1563 },
b8c82a46 1564#endif
a7c386f4 1565#ifdef CONFIG_GFAPI
1566 { .ival = "gfapi",
cc47f094 1567 .help = "Glusterfs libgfapi(sync) based engine"
1568 },
1569 { .ival = "gfapi_async",
1570 .help = "Glusterfs libgfapi(async) based engine"
a7c386f4 1571 },
1572#endif
1b10477b 1573#ifdef CONFIG_LIBHDFS
b74e419e 1574 { .ival = "libhdfs",
1b10477b
MM
1575 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1576 },
1577#endif
214e1eca
JA
1578 { .ival = "external",
1579 .help = "Load external engine (append name)",
1580 },
1581 },
1582 },
1583 {
1584 .name = "iodepth",
e8b0e958 1585 .lname = "IO Depth",
214e1eca
JA
1586 .type = FIO_OPT_INT,
1587 .off1 = td_var_offset(iodepth),
03e20d68 1588 .help = "Number of IO buffers to keep in flight",
757aff4f 1589 .minval = 1,
20eb06bd 1590 .interval = 1,
214e1eca 1591 .def = "1",
e8b0e958 1592 .category = FIO_OPT_C_IO,
0626037e 1593 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1594 },
1595 {
1596 .name = "iodepth_batch",
e8b0e958 1597 .lname = "IO Depth batch",
4950421a 1598 .alias = "iodepth_batch_submit",
214e1eca
JA
1599 .type = FIO_OPT_INT,
1600 .off1 = td_var_offset(iodepth_batch),
d65db441 1601 .help = "Number of IO buffers to submit in one go",
afdf9352 1602 .parent = "iodepth",
d71c154c 1603 .hide = 1,
a2e6f8ac 1604 .minval = 1,
20eb06bd 1605 .interval = 1,
a2e6f8ac 1606 .def = "1",
e8b0e958 1607 .category = FIO_OPT_C_IO,
0626037e 1608 .group = FIO_OPT_G_IO_BASIC,
4950421a
JA
1609 },
1610 {
1611 .name = "iodepth_batch_complete",
e8b0e958 1612 .lname = "IO Depth batch complete",
4950421a
JA
1613 .type = FIO_OPT_INT,
1614 .off1 = td_var_offset(iodepth_batch_complete),
d65db441 1615 .help = "Number of IO buffers to retrieve in one go",
4950421a 1616 .parent = "iodepth",
d71c154c 1617 .hide = 1,
4950421a 1618 .minval = 0,
20eb06bd 1619 .interval = 1,
4950421a 1620 .def = "1",
e8b0e958 1621 .category = FIO_OPT_C_IO,
0626037e 1622 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1623 },
1624 {
1625 .name = "iodepth_low",
e8b0e958 1626 .lname = "IO Depth batch low",
214e1eca
JA
1627 .type = FIO_OPT_INT,
1628 .off1 = td_var_offset(iodepth_low),
1629 .help = "Low water mark for queuing depth",
afdf9352 1630 .parent = "iodepth",
d71c154c 1631 .hide = 1,
20eb06bd 1632 .interval = 1,
e8b0e958 1633 .category = FIO_OPT_C_IO,
0626037e 1634 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1635 },
1636 {
1637 .name = "size",
e8b0e958 1638 .lname = "Size",
214e1eca 1639 .type = FIO_OPT_STR_VAL,
7bb59102 1640 .cb = str_size_cb,
214e1eca 1641 .help = "Total size of device or files",
20eb06bd 1642 .interval = 1024 * 1024,
e8b0e958
JA
1643 .category = FIO_OPT_C_IO,
1644 .group = FIO_OPT_G_INVALID,
214e1eca 1645 },
77731b29
JA
1646 {
1647 .name = "io_limit",
1648 .lname = "IO Limit",
1649 .type = FIO_OPT_STR_VAL,
1650 .off1 = td_var_offset(io_limit),
1651 .interval = 1024 * 1024,
1652 .category = FIO_OPT_C_IO,
1653 .group = FIO_OPT_G_INVALID,
1654 },
aa31f1f1
SL
1655 {
1656 .name = "fill_device",
e8b0e958 1657 .lname = "Fill device",
74586c1e 1658 .alias = "fill_fs",
aa31f1f1
SL
1659 .type = FIO_OPT_BOOL,
1660 .off1 = td_var_offset(fill_device),
1661 .help = "Write until an ENOSPC error occurs",
1662 .def = "0",
e8b0e958
JA
1663 .category = FIO_OPT_C_FILE,
1664 .group = FIO_OPT_G_INVALID,
aa31f1f1 1665 },
214e1eca
JA
1666 {
1667 .name = "filesize",
e8b0e958 1668 .lname = "File size",
214e1eca
JA
1669 .type = FIO_OPT_STR_VAL,
1670 .off1 = td_var_offset(file_size_low),
1671 .off2 = td_var_offset(file_size_high),
c3edbdba 1672 .minval = 1,
214e1eca 1673 .help = "Size of individual files",
20eb06bd 1674 .interval = 1024 * 1024,
e8b0e958
JA
1675 .category = FIO_OPT_C_FILE,
1676 .group = FIO_OPT_G_INVALID,
214e1eca 1677 },
bedc9dc2
JA
1678 {
1679 .name = "file_append",
1680 .lname = "File append",
1681 .type = FIO_OPT_BOOL,
1682 .off1 = td_var_offset(file_append),
1683 .help = "IO will start at the end of the file(s)",
1684 .def = "0",
1685 .category = FIO_OPT_C_FILE,
1686 .group = FIO_OPT_G_INVALID,
1687 },
67a1000f
JA
1688 {
1689 .name = "offset",
e8b0e958 1690 .lname = "IO offset",
67a1000f
JA
1691 .alias = "fileoffset",
1692 .type = FIO_OPT_STR_VAL,
1693 .off1 = td_var_offset(start_offset),
1694 .help = "Start IO from this offset",
1695 .def = "0",
20eb06bd 1696 .interval = 1024 * 1024,
e8b0e958
JA
1697 .category = FIO_OPT_C_IO,
1698 .group = FIO_OPT_G_INVALID,
67a1000f 1699 },
2d7cd868
JA
1700 {
1701 .name = "offset_increment",
e8b0e958 1702 .lname = "IO offset increment",
2d7cd868
JA
1703 .type = FIO_OPT_STR_VAL,
1704 .off1 = td_var_offset(offset_increment),
1705 .help = "What is the increment from one offset to the next",
1706 .parent = "offset",
d71c154c 1707 .hide = 1,
2d7cd868 1708 .def = "0",
20eb06bd 1709 .interval = 1024 * 1024,
e8b0e958
JA
1710 .category = FIO_OPT_C_IO,
1711 .group = FIO_OPT_G_INVALID,
2d7cd868 1712 },
ddf24e42
JA
1713 {
1714 .name = "number_ios",
1715 .lname = "Number of IOs to perform",
1716 .type = FIO_OPT_STR_VAL,
1717 .off1 = td_var_offset(number_ios),
1718 .help = "Force job completion of this number of IOs",
1719 .def = "0",
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
1722 },
214e1eca
JA
1723 {
1724 .name = "bs",
e8b0e958 1725 .lname = "Block size",
d3aad8f2 1726 .alias = "blocksize",
e01b22b8 1727 .type = FIO_OPT_INT,
214e1eca
JA
1728 .off1 = td_var_offset(bs[DDIR_READ]),
1729 .off2 = td_var_offset(bs[DDIR_WRITE]),
6eaf09d6 1730 .off3 = td_var_offset(bs[DDIR_TRIM]),
c3edbdba 1731 .minval = 1,
214e1eca
JA
1732 .help = "Block size unit",
1733 .def = "4k",
67a1000f 1734 .parent = "rw",
d71c154c 1735 .hide = 1,
20eb06bd 1736 .interval = 512,
e8b0e958
JA
1737 .category = FIO_OPT_C_IO,
1738 .group = FIO_OPT_G_INVALID,
214e1eca 1739 },
2b7a01d0
JA
1740 {
1741 .name = "ba",
e8b0e958 1742 .lname = "Block size align",
2b7a01d0 1743 .alias = "blockalign",
e01b22b8 1744 .type = FIO_OPT_INT,
2b7a01d0
JA
1745 .off1 = td_var_offset(ba[DDIR_READ]),
1746 .off2 = td_var_offset(ba[DDIR_WRITE]),
6eaf09d6 1747 .off3 = td_var_offset(ba[DDIR_TRIM]),
2b7a01d0
JA
1748 .minval = 1,
1749 .help = "IO block offset alignment",
1750 .parent = "rw",
d71c154c 1751 .hide = 1,
20eb06bd 1752 .interval = 512,
e8b0e958
JA
1753 .category = FIO_OPT_C_IO,
1754 .group = FIO_OPT_G_INVALID,
2b7a01d0 1755 },
214e1eca
JA
1756 {
1757 .name = "bsrange",
e8b0e958 1758 .lname = "Block size range",
d3aad8f2 1759 .alias = "blocksize_range",
214e1eca
JA
1760 .type = FIO_OPT_RANGE,
1761 .off1 = td_var_offset(min_bs[DDIR_READ]),
1762 .off2 = td_var_offset(max_bs[DDIR_READ]),
1763 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1764 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
6eaf09d6
SL
1765 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1766 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
c3edbdba 1767 .minval = 1,
214e1eca 1768 .help = "Set block size range (in more detail than bs)",
67a1000f 1769 .parent = "rw",
d71c154c 1770 .hide = 1,
20eb06bd 1771 .interval = 4096,
e8b0e958
JA
1772 .category = FIO_OPT_C_IO,
1773 .group = FIO_OPT_G_INVALID,
214e1eca 1774 },
564ca972
JA
1775 {
1776 .name = "bssplit",
e8b0e958 1777 .lname = "Block size split",
564ca972
JA
1778 .type = FIO_OPT_STR,
1779 .cb = str_bssplit_cb,
1780 .help = "Set a specific mix of block sizes",
1781 .parent = "rw",
d71c154c 1782 .hide = 1,
e8b0e958
JA
1783 .category = FIO_OPT_C_IO,
1784 .group = FIO_OPT_G_INVALID,
564ca972 1785 },
214e1eca
JA
1786 {
1787 .name = "bs_unaligned",
e8b0e958 1788 .lname = "Block size unaligned",
d3aad8f2 1789 .alias = "blocksize_unaligned",
214e1eca
JA
1790 .type = FIO_OPT_STR_SET,
1791 .off1 = td_var_offset(bs_unaligned),
1792 .help = "Don't sector align IO buffer sizes",
67a1000f 1793 .parent = "rw",
d71c154c 1794 .hide = 1,
e8b0e958
JA
1795 .category = FIO_OPT_C_IO,
1796 .group = FIO_OPT_G_INVALID,
214e1eca 1797 },
6aca9b3d
JA
1798 {
1799 .name = "bs_is_seq_rand",
1800 .lname = "Block size division is seq/random (not read/write)",
1801 .type = FIO_OPT_BOOL,
1802 .off1 = td_var_offset(bs_is_seq_rand),
1803 .help = "Consider any blocksize setting to be sequential,ramdom",
1804 .def = "0",
1805 .parent = "blocksize",
1806 .category = FIO_OPT_C_IO,
1807 .group = FIO_OPT_G_INVALID,
1808 },
214e1eca
JA
1809 {
1810 .name = "randrepeat",
e8b0e958 1811 .lname = "Random repeatable",
214e1eca
JA
1812 .type = FIO_OPT_BOOL,
1813 .off1 = td_var_offset(rand_repeatable),
1814 .help = "Use repeatable random IO pattern",
1815 .def = "1",
67a1000f 1816 .parent = "rw",
d71c154c 1817 .hide = 1,
e8b0e958 1818 .category = FIO_OPT_C_IO,
3ceb458f 1819 .group = FIO_OPT_G_RANDOM,
214e1eca 1820 },
04778baf
JA
1821 {
1822 .name = "randseed",
1823 .lname = "The random generator seed",
363cffa7 1824 .type = FIO_OPT_STR_VAL,
04778baf
JA
1825 .off1 = td_var_offset(rand_seed),
1826 .help = "Set the random generator seed value",
1827 .parent = "rw",
1828 .category = FIO_OPT_C_IO,
1829 .group = FIO_OPT_G_RANDOM,
1830 },
2615cc4b
JA
1831 {
1832 .name = "use_os_rand",
e8b0e958 1833 .lname = "Use OS random",
2615cc4b
JA
1834 .type = FIO_OPT_BOOL,
1835 .off1 = td_var_offset(use_os_rand),
1836 .help = "Set to use OS random generator",
1837 .def = "0",
1838 .parent = "rw",
d71c154c 1839 .hide = 1,
e8b0e958 1840 .category = FIO_OPT_C_IO,
3ceb458f 1841 .group = FIO_OPT_G_RANDOM,
2615cc4b 1842 },
214e1eca
JA
1843 {
1844 .name = "norandommap",
e8b0e958 1845 .lname = "No randommap",
214e1eca
JA
1846 .type = FIO_OPT_STR_SET,
1847 .off1 = td_var_offset(norandommap),
1848 .help = "Accept potential duplicate random blocks",
67a1000f 1849 .parent = "rw",
d71c154c 1850 .hide = 1,
b2452a43 1851 .hide_on_set = 1,
e8b0e958 1852 .category = FIO_OPT_C_IO,
3ceb458f 1853 .group = FIO_OPT_G_RANDOM,
214e1eca 1854 },
2b386d25
JA
1855 {
1856 .name = "softrandommap",
e8b0e958 1857 .lname = "Soft randommap",
2b386d25
JA
1858 .type = FIO_OPT_BOOL,
1859 .off1 = td_var_offset(softrandommap),
f66ab3c8 1860 .help = "Set norandommap if randommap allocation fails",
2b386d25 1861 .parent = "norandommap",
d71c154c 1862 .hide = 1,
2b386d25 1863 .def = "0",
e8b0e958 1864 .category = FIO_OPT_C_IO,
3ceb458f 1865 .group = FIO_OPT_G_RANDOM,
2b386d25 1866 },
8055e41d
JA
1867 {
1868 .name = "random_generator",
1869 .type = FIO_OPT_STR,
1870 .off1 = td_var_offset(random_generator),
1871 .help = "Type of random number generator to use",
1872 .def = "tausworthe",
1873 .posval = {
1874 { .ival = "tausworthe",
1875 .oval = FIO_RAND_GEN_TAUSWORTHE,
1876 .help = "Strong Tausworthe generator",
1877 },
1878 { .ival = "lfsr",
1879 .oval = FIO_RAND_GEN_LFSR,
1880 .help = "Variable length LFSR",
1881 },
1882 },
48107598
JA
1883 .category = FIO_OPT_C_IO,
1884 .group = FIO_OPT_G_RANDOM,
8055e41d 1885 },
e25839d4
JA
1886 {
1887 .name = "random_distribution",
1888 .type = FIO_OPT_STR,
1889 .off1 = td_var_offset(random_distribution),
1890 .cb = str_random_distribution_cb,
1891 .help = "Random offset distribution generator",
1892 .def = "random",
1893 .posval = {
1894 { .ival = "random",
1895 .oval = FIO_RAND_DIST_RANDOM,
1896 .help = "Completely random",
1897 },
1898 { .ival = "zipf",
1899 .oval = FIO_RAND_DIST_ZIPF,
1900 .help = "Zipf distribution",
1901 },
925fee33
JA
1902 { .ival = "pareto",
1903 .oval = FIO_RAND_DIST_PARETO,
1904 .help = "Pareto distribution",
1905 },
e25839d4 1906 },
48107598
JA
1907 .category = FIO_OPT_C_IO,
1908 .group = FIO_OPT_G_RANDOM,
e25839d4 1909 },
211c9b89
JA
1910 {
1911 .name = "percentage_random",
1912 .lname = "Percentage Random",
1913 .type = FIO_OPT_INT,
d9472271
JA
1914 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1915 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1916 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
211c9b89
JA
1917 .maxval = 100,
1918 .help = "Percentage of seq/random mix that should be random",
d9472271 1919 .def = "100,100,100",
211c9b89
JA
1920 .interval = 5,
1921 .inverse = "percentage_sequential",
1922 .category = FIO_OPT_C_IO,
1923 .group = FIO_OPT_G_RANDOM,
1924 },
1925 {
1926 .name = "percentage_sequential",
1927 .lname = "Percentage Sequential",
d9472271 1928 .type = FIO_OPT_DEPRECATED,
211c9b89
JA
1929 .category = FIO_OPT_C_IO,
1930 .group = FIO_OPT_G_RANDOM,
1931 },
56e2a5fc
CE
1932 {
1933 .name = "allrandrepeat",
1934 .type = FIO_OPT_BOOL,
1935 .off1 = td_var_offset(allrand_repeatable),
1936 .help = "Use repeatable random numbers for everything",
1937 .def = "0",
a869d9c6
JA
1938 .category = FIO_OPT_C_IO,
1939 .group = FIO_OPT_G_RANDOM,
56e2a5fc 1940 },
214e1eca
JA
1941 {
1942 .name = "nrfiles",
e8b0e958 1943 .lname = "Number of files",
d7c8be03 1944 .alias = "nr_files",
214e1eca
JA
1945 .type = FIO_OPT_INT,
1946 .off1 = td_var_offset(nr_files),
1947 .help = "Split job workload between this number of files",
1948 .def = "1",
20eb06bd 1949 .interval = 1,
e8b0e958
JA
1950 .category = FIO_OPT_C_FILE,
1951 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1952 },
1953 {
1954 .name = "openfiles",
e8b0e958 1955 .lname = "Number of open files",
214e1eca
JA
1956 .type = FIO_OPT_INT,
1957 .off1 = td_var_offset(open_files),
1958 .help = "Number of files to keep open at the same time",
e8b0e958
JA
1959 .category = FIO_OPT_C_FILE,
1960 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1961 },
1962 {
1963 .name = "file_service_type",
e8b0e958 1964 .lname = "File service type",
214e1eca
JA
1965 .type = FIO_OPT_STR,
1966 .cb = str_fst_cb,
1967 .off1 = td_var_offset(file_service_type),
1968 .help = "How to select which file to service next",
1969 .def = "roundrobin",
e8b0e958
JA
1970 .category = FIO_OPT_C_FILE,
1971 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1972 .posval = {
1973 { .ival = "random",
1974 .oval = FIO_FSERVICE_RANDOM,
1975 .help = "Choose a file at random",
1976 },
1977 { .ival = "roundrobin",
1978 .oval = FIO_FSERVICE_RR,
1979 .help = "Round robin select files",
1980 },
a086c257
JA
1981 { .ival = "sequential",
1982 .oval = FIO_FSERVICE_SEQ,
1983 .help = "Finish one file before moving to the next",
1984 },
214e1eca 1985 },
67a1000f 1986 .parent = "nrfiles",
d71c154c 1987 .hide = 1,
67a1000f 1988 },
97ac992c 1989#ifdef CONFIG_POSIX_FALLOCATE
7bc8c2cf
JA
1990 {
1991 .name = "fallocate",
e8b0e958 1992 .lname = "Fallocate",
a596f047
EG
1993 .type = FIO_OPT_STR,
1994 .off1 = td_var_offset(fallocate_mode),
1995 .help = "Whether pre-allocation is performed when laying out files",
1996 .def = "posix",
e8b0e958
JA
1997 .category = FIO_OPT_C_FILE,
1998 .group = FIO_OPT_G_INVALID,
a596f047
EG
1999 .posval = {
2000 { .ival = "none",
2001 .oval = FIO_FALLOCATE_NONE,
2002 .help = "Do not pre-allocate space",
2003 },
2004 { .ival = "posix",
2005 .oval = FIO_FALLOCATE_POSIX,
2006 .help = "Use posix_fallocate()",
2007 },
97ac992c 2008#ifdef CONFIG_LINUX_FALLOCATE
a596f047
EG
2009 { .ival = "keep",
2010 .oval = FIO_FALLOCATE_KEEP_SIZE,
2011 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2012 },
7bc8c2cf 2013#endif
a596f047
EG
2014 /* Compatibility with former boolean values */
2015 { .ival = "0",
2016 .oval = FIO_FALLOCATE_NONE,
2017 .help = "Alias for 'none'",
2018 },
2019 { .ival = "1",
2020 .oval = FIO_FALLOCATE_POSIX,
2021 .help = "Alias for 'posix'",
2022 },
2023 },
2024 },
97ac992c 2025#endif /* CONFIG_POSIX_FALLOCATE */
67a1000f
JA
2026 {
2027 .name = "fadvise_hint",
e8b0e958 2028 .lname = "Fadvise hint",
67a1000f
JA
2029 .type = FIO_OPT_BOOL,
2030 .off1 = td_var_offset(fadvise_hint),
2031 .help = "Use fadvise() to advise the kernel on IO pattern",
2032 .def = "1",
e8b0e958
JA
2033 .category = FIO_OPT_C_FILE,
2034 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2035 },
2036 {
2037 .name = "fsync",
e8b0e958 2038 .lname = "Fsync",
214e1eca
JA
2039 .type = FIO_OPT_INT,
2040 .off1 = td_var_offset(fsync_blocks),
2041 .help = "Issue fsync for writes every given number of blocks",
2042 .def = "0",
20eb06bd 2043 .interval = 1,
e8b0e958
JA
2044 .category = FIO_OPT_C_FILE,
2045 .group = FIO_OPT_G_INVALID,
214e1eca 2046 },
5f9099ea
JA
2047 {
2048 .name = "fdatasync",
e8b0e958 2049 .lname = "Fdatasync",
5f9099ea
JA
2050 .type = FIO_OPT_INT,
2051 .off1 = td_var_offset(fdatasync_blocks),
2052 .help = "Issue fdatasync for writes every given number of blocks",
2053 .def = "0",
20eb06bd 2054 .interval = 1,
e8b0e958
JA
2055 .category = FIO_OPT_C_FILE,
2056 .group = FIO_OPT_G_INVALID,
5f9099ea 2057 },
1ef2b6be
JA
2058 {
2059 .name = "write_barrier",
e8b0e958 2060 .lname = "Write barrier",
1ef2b6be
JA
2061 .type = FIO_OPT_INT,
2062 .off1 = td_var_offset(barrier_blocks),
2063 .help = "Make every Nth write a barrier write",
2064 .def = "0",
20eb06bd 2065 .interval = 1,
e8b0e958
JA
2066 .category = FIO_OPT_C_IO,
2067 .group = FIO_OPT_G_INVALID,
1ef2b6be 2068 },
67bf9823 2069#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
2070 {
2071 .name = "sync_file_range",
e8b0e958 2072 .lname = "Sync file range",
44f29692
JA
2073 .posval = {
2074 { .ival = "wait_before",
2075 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2076 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
ebadc0ce 2077 .orval = 1,
44f29692
JA
2078 },
2079 { .ival = "write",
2080 .oval = SYNC_FILE_RANGE_WRITE,
2081 .help = "SYNC_FILE_RANGE_WRITE",
ebadc0ce 2082 .orval = 1,
44f29692
JA
2083 },
2084 {
2085 .ival = "wait_after",
2086 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2087 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
ebadc0ce 2088 .orval = 1,
44f29692
JA
2089 },
2090 },
3843deb3 2091 .type = FIO_OPT_STR_MULTI,
44f29692
JA
2092 .cb = str_sfr_cb,
2093 .off1 = td_var_offset(sync_file_range),
2094 .help = "Use sync_file_range()",
e8b0e958
JA
2095 .category = FIO_OPT_C_FILE,
2096 .group = FIO_OPT_G_INVALID,
44f29692
JA
2097 },
2098#endif
214e1eca
JA
2099 {
2100 .name = "direct",
e8b0e958 2101 .lname = "Direct I/O",
214e1eca
JA
2102 .type = FIO_OPT_BOOL,
2103 .off1 = td_var_offset(odirect),
2104 .help = "Use O_DIRECT IO (negates buffered)",
2105 .def = "0",
a01a1bc5 2106 .inverse = "buffered",
e8b0e958 2107 .category = FIO_OPT_C_IO,
3ceb458f 2108 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2109 },
d01612f3
CM
2110 {
2111 .name = "atomic",
2112 .lname = "Atomic I/O",
2113 .type = FIO_OPT_BOOL,
2114 .off1 = td_var_offset(oatomic),
2115 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2116 .def = "0",
2117 .category = FIO_OPT_C_IO,
2118 .group = FIO_OPT_G_IO_TYPE,
2119 },
214e1eca
JA
2120 {
2121 .name = "buffered",
e8b0e958 2122 .lname = "Buffered I/O",
214e1eca
JA
2123 .type = FIO_OPT_BOOL,
2124 .off1 = td_var_offset(odirect),
2125 .neg = 1,
2126 .help = "Use buffered IO (negates direct)",
2127 .def = "1",
a01a1bc5 2128 .inverse = "direct",
e8b0e958 2129 .category = FIO_OPT_C_IO,
3ceb458f 2130 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2131 },
2132 {
2133 .name = "overwrite",
e8b0e958 2134 .lname = "Overwrite",
214e1eca
JA
2135 .type = FIO_OPT_BOOL,
2136 .off1 = td_var_offset(overwrite),
2137 .help = "When writing, set whether to overwrite current data",
2138 .def = "0",
e8b0e958
JA
2139 .category = FIO_OPT_C_FILE,
2140 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2141 },
2142 {
2143 .name = "loops",
e8b0e958 2144 .lname = "Loops",
214e1eca
JA
2145 .type = FIO_OPT_INT,
2146 .off1 = td_var_offset(loops),
2147 .help = "Number of times to run the job",
2148 .def = "1",
20eb06bd 2149 .interval = 1,
e8b0e958 2150 .category = FIO_OPT_C_GENERAL,
a1f6afec 2151 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2152 },
2153 {
2154 .name = "numjobs",
e8b0e958 2155 .lname = "Number of jobs",
214e1eca
JA
2156 .type = FIO_OPT_INT,
2157 .off1 = td_var_offset(numjobs),
2158 .help = "Duplicate this job this many times",
2159 .def = "1",
20eb06bd 2160 .interval = 1,
e8b0e958 2161 .category = FIO_OPT_C_GENERAL,
a1f6afec 2162 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2163 },
2164 {
2165 .name = "startdelay",
e8b0e958 2166 .lname = "Start delay",
a5737c93 2167 .type = FIO_OPT_STR_VAL_TIME,
214e1eca 2168 .off1 = td_var_offset(start_delay),
23ed19b0 2169 .off2 = td_var_offset(start_delay_high),
214e1eca
JA
2170 .help = "Only start job when this period has passed",
2171 .def = "0",
0de5b26f 2172 .is_seconds = 1,
e8b0e958 2173 .category = FIO_OPT_C_GENERAL,
a1f6afec 2174 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2175 },
2176 {
2177 .name = "runtime",
e8b0e958 2178 .lname = "Runtime",
214e1eca
JA
2179 .alias = "timeout",
2180 .type = FIO_OPT_STR_VAL_TIME,
2181 .off1 = td_var_offset(timeout),
2182 .help = "Stop workload when this amount of time has passed",
2183 .def = "0",
0de5b26f 2184 .is_seconds = 1,
e8b0e958 2185 .category = FIO_OPT_C_GENERAL,
a1f6afec 2186 .group = FIO_OPT_G_RUNTIME,
214e1eca 2187 },
cf4464ca
JA
2188 {
2189 .name = "time_based",
e8b0e958 2190 .lname = "Time based",
cf4464ca
JA
2191 .type = FIO_OPT_STR_SET,
2192 .off1 = td_var_offset(time_based),
2193 .help = "Keep running until runtime/timeout is met",
e8b0e958 2194 .category = FIO_OPT_C_GENERAL,
a1f6afec 2195 .group = FIO_OPT_G_RUNTIME,
cf4464ca 2196 },
62167762
JC
2197 {
2198 .name = "verify_only",
2199 .lname = "Verify only",
2200 .type = FIO_OPT_STR_SET,
2201 .off1 = td_var_offset(verify_only),
2202 .help = "Verifies previously written data is still valid",
2203 .category = FIO_OPT_C_GENERAL,
2204 .group = FIO_OPT_G_RUNTIME,
2205 },
721938ae
JA
2206 {
2207 .name = "ramp_time",
e8b0e958 2208 .lname = "Ramp time",
721938ae
JA
2209 .type = FIO_OPT_STR_VAL_TIME,
2210 .off1 = td_var_offset(ramp_time),
2211 .help = "Ramp up time before measuring performance",
0de5b26f 2212 .is_seconds = 1,
e8b0e958 2213 .category = FIO_OPT_C_GENERAL,
a1f6afec 2214 .group = FIO_OPT_G_RUNTIME,
721938ae 2215 },
c223da83
JA
2216 {
2217 .name = "clocksource",
e8b0e958 2218 .lname = "Clock source",
c223da83
JA
2219 .type = FIO_OPT_STR,
2220 .cb = fio_clock_source_cb,
2221 .off1 = td_var_offset(clocksource),
2222 .help = "What type of timing source to use",
e8b0e958 2223 .category = FIO_OPT_C_GENERAL,
10860056 2224 .group = FIO_OPT_G_CLOCK,
c223da83 2225 .posval = {
67bf9823 2226#ifdef CONFIG_GETTIMEOFDAY
c223da83
JA
2227 { .ival = "gettimeofday",
2228 .oval = CS_GTOD,
2229 .help = "Use gettimeofday(2) for timing",
2230 },
67bf9823
JA
2231#endif
2232#ifdef CONFIG_CLOCK_GETTIME
c223da83
JA
2233 { .ival = "clock_gettime",
2234 .oval = CS_CGETTIME,
2235 .help = "Use clock_gettime(2) for timing",
2236 },
67bf9823 2237#endif
c223da83
JA
2238#ifdef ARCH_HAVE_CPU_CLOCK
2239 { .ival = "cpu",
2240 .oval = CS_CPUCLOCK,
2241 .help = "Use CPU private clock",
2242 },
2243#endif
2244 },
2245 },
214e1eca
JA
2246 {
2247 .name = "mem",
d3aad8f2 2248 .alias = "iomem",
e8b0e958 2249 .lname = "I/O Memory",
214e1eca
JA
2250 .type = FIO_OPT_STR,
2251 .cb = str_mem_cb,
2252 .off1 = td_var_offset(mem_type),
2253 .help = "Backing type for IO buffers",
2254 .def = "malloc",
e8b0e958
JA
2255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2257 .posval = {
2258 { .ival = "malloc",
2259 .oval = MEM_MALLOC,
2260 .help = "Use malloc(3) for IO buffers",
2261 },
c8931876 2262#ifndef CONFIG_NO_SHM
37c8cdfe
JA
2263 { .ival = "shm",
2264 .oval = MEM_SHM,
2265 .help = "Use shared memory segments for IO buffers",
2266 },
214e1eca
JA
2267#ifdef FIO_HAVE_HUGETLB
2268 { .ival = "shmhuge",
2269 .oval = MEM_SHMHUGE,
2270 .help = "Like shm, but use huge pages",
2271 },
c8931876 2272#endif
b370e46a 2273#endif
37c8cdfe
JA
2274 { .ival = "mmap",
2275 .oval = MEM_MMAP,
2276 .help = "Use mmap(2) (file or anon) for IO buffers",
2277 },
214e1eca
JA
2278#ifdef FIO_HAVE_HUGETLB
2279 { .ival = "mmaphuge",
2280 .oval = MEM_MMAPHUGE,
2281 .help = "Like mmap, but use huge pages",
2282 },
2283#endif
2284 },
2285 },
d529ee19
JA
2286 {
2287 .name = "iomem_align",
2288 .alias = "mem_align",
e8b0e958 2289 .lname = "I/O memory alignment",
d529ee19
JA
2290 .type = FIO_OPT_INT,
2291 .off1 = td_var_offset(mem_align),
2292 .minval = 0,
2293 .help = "IO memory buffer offset alignment",
2294 .def = "0",
2295 .parent = "iomem",
d71c154c 2296 .hide = 1,
e8b0e958
JA
2297 .category = FIO_OPT_C_IO,
2298 .group = FIO_OPT_G_INVALID,
d529ee19 2299 },
214e1eca
JA
2300 {
2301 .name = "verify",
e8b0e958 2302 .lname = "Verify",
214e1eca
JA
2303 .type = FIO_OPT_STR,
2304 .off1 = td_var_offset(verify),
2305 .help = "Verify data written",
2306 .def = "0",
e8b0e958 2307 .category = FIO_OPT_C_IO,
3ceb458f 2308 .group = FIO_OPT_G_VERIFY,
214e1eca
JA
2309 .posval = {
2310 { .ival = "0",
2311 .oval = VERIFY_NONE,
2312 .help = "Don't do IO verification",
2313 },
fcca4b58
JA
2314 { .ival = "md5",
2315 .oval = VERIFY_MD5,
2316 .help = "Use md5 checksums for verification",
2317 },
d77a7af3
JA
2318 { .ival = "crc64",
2319 .oval = VERIFY_CRC64,
2320 .help = "Use crc64 checksums for verification",
2321 },
214e1eca
JA
2322 { .ival = "crc32",
2323 .oval = VERIFY_CRC32,
2324 .help = "Use crc32 checksums for verification",
2325 },
af497e6a 2326 { .ival = "crc32c-intel",
e3aaafc4
JA
2327 .oval = VERIFY_CRC32C,
2328 .help = "Use crc32c checksums for verification (hw assisted, if available)",
af497e6a 2329 },
bac39e0e
JA
2330 { .ival = "crc32c",
2331 .oval = VERIFY_CRC32C,
e3aaafc4 2332 .help = "Use crc32c checksums for verification (hw assisted, if available)",
bac39e0e 2333 },
969f7ed3
JA
2334 { .ival = "crc16",
2335 .oval = VERIFY_CRC16,
2336 .help = "Use crc16 checksums for verification",
2337 },
1e154bdb
JA
2338 { .ival = "crc7",
2339 .oval = VERIFY_CRC7,
2340 .help = "Use crc7 checksums for verification",
2341 },
7c353ceb
JA
2342 { .ival = "sha1",
2343 .oval = VERIFY_SHA1,
2344 .help = "Use sha1 checksums for verification",
2345 },
cd14cc10
JA
2346 { .ival = "sha256",
2347 .oval = VERIFY_SHA256,
2348 .help = "Use sha256 checksums for verification",
2349 },
2350 { .ival = "sha512",
2351 .oval = VERIFY_SHA512,
2352 .help = "Use sha512 checksums for verification",
2353 },
844ea602
JA
2354 { .ival = "xxhash",
2355 .oval = VERIFY_XXHASH,
2356 .help = "Use xxhash checksums for verification",
2357 },
7437ee87
SL
2358 { .ival = "meta",
2359 .oval = VERIFY_META,
2360 .help = "Use io information",
2361 },
36690c9b
JA
2362 {
2363 .ival = "null",
2364 .oval = VERIFY_NULL,
2365 .help = "Pretend to verify",
2366 },
214e1eca
JA
2367 },
2368 },
005c565a
JA
2369 {
2370 .name = "do_verify",
e8b0e958 2371 .lname = "Perform verify step",
68e1f29a 2372 .type = FIO_OPT_BOOL,
005c565a
JA
2373 .off1 = td_var_offset(do_verify),
2374 .help = "Run verification stage after write",
2375 .def = "1",
2376 .parent = "verify",
d71c154c 2377 .hide = 1,
e8b0e958
JA
2378 .category = FIO_OPT_C_IO,
2379 .group = FIO_OPT_G_VERIFY,
005c565a 2380 },
160b966d
JA
2381 {
2382 .name = "verifysort",
e8b0e958 2383 .lname = "Verify sort",
160b966d
JA
2384 .type = FIO_OPT_BOOL,
2385 .off1 = td_var_offset(verifysort),
2386 .help = "Sort written verify blocks for read back",
2387 .def = "1",
c83f2df1 2388 .parent = "verify",
d71c154c 2389 .hide = 1,
e8b0e958
JA
2390 .category = FIO_OPT_C_IO,
2391 .group = FIO_OPT_G_VERIFY,
160b966d 2392 },
1ae83d45
JA
2393 {
2394 .name = "verifysort_nr",
2395 .type = FIO_OPT_INT,
2396 .off1 = td_var_offset(verifysort_nr),
2397 .help = "Pre-load and sort verify blocks for a read workload",
2398 .minval = 0,
2399 .maxval = 131072,
2400 .def = "1024",
2401 .parent = "verify",
836fcc0f
JA
2402 .category = FIO_OPT_C_IO,
2403 .group = FIO_OPT_G_VERIFY,
1ae83d45 2404 },
3f9f4e26 2405 {
a59e170d 2406 .name = "verify_interval",
e8b0e958 2407 .lname = "Verify interval",
e01b22b8 2408 .type = FIO_OPT_INT,
a59e170d 2409 .off1 = td_var_offset(verify_interval),
819a9680 2410 .minval = 2 * sizeof(struct verify_header),
a59e170d 2411 .help = "Store verify buffer header every N bytes",
afdf9352 2412 .parent = "verify",
d71c154c 2413 .hide = 1,
20eb06bd 2414 .interval = 2 * sizeof(struct verify_header),
e8b0e958
JA
2415 .category = FIO_OPT_C_IO,
2416 .group = FIO_OPT_G_VERIFY,
3f9f4e26 2417 },
546a9142 2418 {
a59e170d 2419 .name = "verify_offset",
e8b0e958 2420 .lname = "Verify offset",
e01b22b8 2421 .type = FIO_OPT_INT,
a59e170d 2422 .help = "Offset verify header location by N bytes",
203160d5
JA
2423 .off1 = td_var_offset(verify_offset),
2424 .minval = sizeof(struct verify_header),
afdf9352 2425 .parent = "verify",
d71c154c 2426 .hide = 1,
e8b0e958
JA
2427 .category = FIO_OPT_C_IO,
2428 .group = FIO_OPT_G_VERIFY,
546a9142 2429 },
e28218f3
SL
2430 {
2431 .name = "verify_pattern",
e8b0e958 2432 .lname = "Verify pattern",
0e92f873 2433 .type = FIO_OPT_STR,
e28218f3
SL
2434 .cb = str_verify_pattern_cb,
2435 .help = "Fill pattern for IO buffers",
2436 .parent = "verify",
d71c154c 2437 .hide = 1,
e8b0e958
JA
2438 .category = FIO_OPT_C_IO,
2439 .group = FIO_OPT_G_VERIFY,
e28218f3 2440 },
a12a3b4d
JA
2441 {
2442 .name = "verify_fatal",
e8b0e958 2443 .lname = "Verify fatal",
68e1f29a 2444 .type = FIO_OPT_BOOL,
a12a3b4d
JA
2445 .off1 = td_var_offset(verify_fatal),
2446 .def = "0",
2447 .help = "Exit on a single verify failure, don't continue",
2448 .parent = "verify",
d71c154c 2449 .hide = 1,
e8b0e958
JA
2450 .category = FIO_OPT_C_IO,
2451 .group = FIO_OPT_G_VERIFY,
a12a3b4d 2452 },
b463e936
JA
2453 {
2454 .name = "verify_dump",
e8b0e958 2455 .lname = "Verify dump",
b463e936
JA
2456 .type = FIO_OPT_BOOL,
2457 .off1 = td_var_offset(verify_dump),
ef71e317 2458 .def = "0",
b463e936
JA
2459 .help = "Dump contents of good and bad blocks on failure",
2460 .parent = "verify",
d71c154c 2461 .hide = 1,
e8b0e958
JA
2462 .category = FIO_OPT_C_IO,
2463 .group = FIO_OPT_G_VERIFY,
b463e936 2464 },
e8462bd8
JA
2465 {
2466 .name = "verify_async",
e8b0e958 2467 .lname = "Verify asynchronously",
e8462bd8
JA
2468 .type = FIO_OPT_INT,
2469 .off1 = td_var_offset(verify_async),
2470 .def = "0",
2471 .help = "Number of async verifier threads to use",
2472 .parent = "verify",
d71c154c 2473 .hide = 1,
e8b0e958
JA
2474 .category = FIO_OPT_C_IO,
2475 .group = FIO_OPT_G_VERIFY,
e8462bd8 2476 },
9e144189
JA
2477 {
2478 .name = "verify_backlog",
e8b0e958 2479 .lname = "Verify backlog",
9e144189
JA
2480 .type = FIO_OPT_STR_VAL,
2481 .off1 = td_var_offset(verify_backlog),
2482 .help = "Verify after this number of blocks are written",
2483 .parent = "verify",
d71c154c 2484 .hide = 1,
e8b0e958
JA
2485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_VERIFY,
9e144189
JA
2487 },
2488 {
2489 .name = "verify_backlog_batch",
e8b0e958 2490 .lname = "Verify backlog batch",
9e144189
JA
2491 .type = FIO_OPT_INT,
2492 .off1 = td_var_offset(verify_batch),
2493 .help = "Verify this number of IO blocks",
0d29de83 2494 .parent = "verify",
d71c154c 2495 .hide = 1,
e8b0e958
JA
2496 .category = FIO_OPT_C_IO,
2497 .group = FIO_OPT_G_VERIFY,
9e144189 2498 },
e8462bd8
JA
2499#ifdef FIO_HAVE_CPU_AFFINITY
2500 {
2501 .name = "verify_async_cpus",
e8b0e958 2502 .lname = "Async verify CPUs",
e8462bd8
JA
2503 .type = FIO_OPT_STR,
2504 .cb = str_verify_cpus_allowed_cb,
2505 .help = "Set CPUs allowed for async verify threads",
2506 .parent = "verify_async",
d71c154c 2507 .hide = 1,
e8b0e958
JA
2508 .category = FIO_OPT_C_IO,
2509 .group = FIO_OPT_G_VERIFY,
e8462bd8 2510 },
0d29de83 2511#endif
51aa2da8
JA
2512 {
2513 .name = "experimental_verify",
2514 .off1 = td_var_offset(experimental_verify),
2515 .type = FIO_OPT_BOOL,
b31eaac9 2516 .help = "Enable experimental verification",
836fcc0f
JA
2517 .category = FIO_OPT_C_IO,
2518 .group = FIO_OPT_G_VERIFY,
51aa2da8 2519 },
0d29de83
JA
2520#ifdef FIO_HAVE_TRIM
2521 {
2522 .name = "trim_percentage",
e8b0e958 2523 .lname = "Trim percentage",
0d29de83 2524 .type = FIO_OPT_INT,
203160d5 2525 .off1 = td_var_offset(trim_percentage),
20eb06bd 2526 .minval = 0,
0d29de83
JA
2527 .maxval = 100,
2528 .help = "Number of verify blocks to discard/trim",
2529 .parent = "verify",
2530 .def = "0",
20eb06bd 2531 .interval = 1,
d71c154c 2532 .hide = 1,
e8b0e958
JA
2533 .category = FIO_OPT_C_IO,
2534 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2535 },
2536 {
2537 .name = "trim_verify_zero",
e8b0e958 2538 .lname = "Verify trim zero",
20eb06bd 2539 .type = FIO_OPT_BOOL,
0d29de83
JA
2540 .help = "Verify that trim/discarded blocks are returned as zeroes",
2541 .off1 = td_var_offset(trim_zero),
2542 .parent = "trim_percentage",
d71c154c 2543 .hide = 1,
0d29de83 2544 .def = "1",
e8b0e958
JA
2545 .category = FIO_OPT_C_IO,
2546 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2547 },
2548 {
2549 .name = "trim_backlog",
e8b0e958 2550 .lname = "Trim backlog",
0d29de83
JA
2551 .type = FIO_OPT_STR_VAL,
2552 .off1 = td_var_offset(trim_backlog),
2553 .help = "Trim after this number of blocks are written",
2554 .parent = "trim_percentage",
d71c154c 2555 .hide = 1,
20eb06bd 2556 .interval = 1,
e8b0e958
JA
2557 .category = FIO_OPT_C_IO,
2558 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2559 },
2560 {
2561 .name = "trim_backlog_batch",
e8b0e958 2562 .lname = "Trim backlog batch",
0d29de83
JA
2563 .type = FIO_OPT_INT,
2564 .off1 = td_var_offset(trim_batch),
2565 .help = "Trim this number of IO blocks",
2566 .parent = "trim_percentage",
d71c154c 2567 .hide = 1,
20eb06bd 2568 .interval = 1,
e8b0e958
JA
2569 .category = FIO_OPT_C_IO,
2570 .group = FIO_OPT_G_TRIM,
0d29de83 2571 },
e8462bd8 2572#endif
214e1eca
JA
2573 {
2574 .name = "write_iolog",
e8b0e958 2575 .lname = "Write I/O log",
214e1eca
JA
2576 .type = FIO_OPT_STR_STORE,
2577 .off1 = td_var_offset(write_iolog_file),
2578 .help = "Store IO pattern to file",
e8b0e958
JA
2579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_IOLOG,
214e1eca
JA
2581 },
2582 {
2583 .name = "read_iolog",
e8b0e958 2584 .lname = "Read I/O log",
214e1eca
JA
2585 .type = FIO_OPT_STR_STORE,
2586 .off1 = td_var_offset(read_iolog_file),
2587 .help = "Playback IO pattern from file",
e8b0e958
JA
2588 .category = FIO_OPT_C_IO,
2589 .group = FIO_OPT_G_IOLOG,
214e1eca 2590 },
64bbb865
DN
2591 {
2592 .name = "replay_no_stall",
e8b0e958 2593 .lname = "Don't stall on replay",
20eb06bd 2594 .type = FIO_OPT_BOOL,
64bbb865
DN
2595 .off1 = td_var_offset(no_stall),
2596 .def = "0",
87e7a972 2597 .parent = "read_iolog",
d71c154c 2598 .hide = 1,
64bbb865 2599 .help = "Playback IO pattern file as fast as possible without stalls",
e8b0e958
JA
2600 .category = FIO_OPT_C_IO,
2601 .group = FIO_OPT_G_IOLOG,
64bbb865 2602 },
d1c46c04
DN
2603 {
2604 .name = "replay_redirect",
e8b0e958 2605 .lname = "Redirect device for replay",
d1c46c04
DN
2606 .type = FIO_OPT_STR_STORE,
2607 .off1 = td_var_offset(replay_redirect),
2608 .parent = "read_iolog",
d71c154c 2609 .hide = 1,
d1c46c04 2610 .help = "Replay all I/O onto this device, regardless of trace device",
e8b0e958
JA
2611 .category = FIO_OPT_C_IO,
2612 .group = FIO_OPT_G_IOLOG,
d1c46c04 2613 },
214e1eca
JA
2614 {
2615 .name = "exec_prerun",
e8b0e958 2616 .lname = "Pre-execute runnable",
214e1eca
JA
2617 .type = FIO_OPT_STR_STORE,
2618 .off1 = td_var_offset(exec_prerun),
2619 .help = "Execute this file prior to running job",
e8b0e958
JA
2620 .category = FIO_OPT_C_GENERAL,
2621 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2622 },
2623 {
2624 .name = "exec_postrun",
e8b0e958 2625 .lname = "Post-execute runnable",
214e1eca
JA
2626 .type = FIO_OPT_STR_STORE,
2627 .off1 = td_var_offset(exec_postrun),
2628 .help = "Execute this file after running job",
e8b0e958
JA
2629 .category = FIO_OPT_C_GENERAL,
2630 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2631 },
2632#ifdef FIO_HAVE_IOSCHED_SWITCH
2633 {
2634 .name = "ioscheduler",
e8b0e958 2635 .lname = "I/O scheduler",
214e1eca
JA
2636 .type = FIO_OPT_STR_STORE,
2637 .off1 = td_var_offset(ioscheduler),
2638 .help = "Use this IO scheduler on the backing device",
e8b0e958
JA
2639 .category = FIO_OPT_C_FILE,
2640 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2641 },
2642#endif
2643 {
2644 .name = "zonesize",
e8b0e958 2645 .lname = "Zone size",
214e1eca
JA
2646 .type = FIO_OPT_STR_VAL,
2647 .off1 = td_var_offset(zone_size),
ed335855
SN
2648 .help = "Amount of data to read per zone",
2649 .def = "0",
20eb06bd 2650 .interval = 1024 * 1024,
e8b0e958
JA
2651 .category = FIO_OPT_C_IO,
2652 .group = FIO_OPT_G_ZONE,
ed335855
SN
2653 },
2654 {
2655 .name = "zonerange",
e8b0e958 2656 .lname = "Zone range",
ed335855
SN
2657 .type = FIO_OPT_STR_VAL,
2658 .off1 = td_var_offset(zone_range),
214e1eca
JA
2659 .help = "Give size of an IO zone",
2660 .def = "0",
20eb06bd 2661 .interval = 1024 * 1024,
e8b0e958
JA
2662 .category = FIO_OPT_C_IO,
2663 .group = FIO_OPT_G_ZONE,
214e1eca
JA
2664 },
2665 {
2666 .name = "zoneskip",
e8b0e958 2667 .lname = "Zone skip",
214e1eca
JA
2668 .type = FIO_OPT_STR_VAL,
2669 .off1 = td_var_offset(zone_skip),
2670 .help = "Space between IO zones",
2671 .def = "0",
20eb06bd 2672 .interval = 1024 * 1024,
e8b0e958
JA
2673 .category = FIO_OPT_C_IO,
2674 .group = FIO_OPT_G_ZONE,
214e1eca
JA
2675 },
2676 {
2677 .name = "lockmem",
e8b0e958 2678 .lname = "Lock memory",
214e1eca 2679 .type = FIO_OPT_STR_VAL,
1b79a070 2680 .off1 = td_var_offset(lockmem),
81c6b6cd 2681 .help = "Lock down this amount of memory (per worker)",
214e1eca 2682 .def = "0",
20eb06bd 2683 .interval = 1024 * 1024,
e8b0e958
JA
2684 .category = FIO_OPT_C_GENERAL,
2685 .group = FIO_OPT_G_INVALID,
214e1eca 2686 },
214e1eca
JA
2687 {
2688 .name = "rwmixread",
e8b0e958 2689 .lname = "Read/write mix read",
214e1eca 2690 .type = FIO_OPT_INT,
cb499fc4 2691 .cb = str_rwmix_read_cb,
214e1eca
JA
2692 .maxval = 100,
2693 .help = "Percentage of mixed workload that is reads",
2694 .def = "50",
20eb06bd 2695 .interval = 5,
90265353 2696 .inverse = "rwmixwrite",
e8b0e958
JA
2697 .category = FIO_OPT_C_IO,
2698 .group = FIO_OPT_G_RWMIX,
214e1eca
JA
2699 },
2700 {
2701 .name = "rwmixwrite",
e8b0e958 2702 .lname = "Read/write mix write",
214e1eca 2703 .type = FIO_OPT_INT,
cb499fc4 2704 .cb = str_rwmix_write_cb,
214e1eca
JA
2705 .maxval = 100,
2706 .help = "Percentage of mixed workload that is writes",
2707 .def = "50",
20eb06bd 2708 .interval = 5,
90265353 2709 .inverse = "rwmixread",
e8b0e958
JA
2710 .category = FIO_OPT_C_IO,
2711 .group = FIO_OPT_G_RWMIX,
214e1eca 2712 },
afdf9352
JA
2713 {
2714 .name = "rwmixcycle",
e8b0e958 2715 .lname = "Read/write mix cycle",
15ca150e 2716 .type = FIO_OPT_DEPRECATED,
e8b0e958
JA
2717 .category = FIO_OPT_C_IO,
2718 .group = FIO_OPT_G_RWMIX,
afdf9352 2719 },
214e1eca
JA
2720 {
2721 .name = "nice",
e8b0e958 2722 .lname = "Nice",
214e1eca
JA
2723 .type = FIO_OPT_INT,
2724 .off1 = td_var_offset(nice),
2725 .help = "Set job CPU nice value",
2726 .minval = -19,
2727 .maxval = 20,
2728 .def = "0",
20eb06bd 2729 .interval = 1,
e8b0e958 2730 .category = FIO_OPT_C_GENERAL,
10860056 2731 .group = FIO_OPT_G_CRED,
214e1eca
JA
2732 },
2733#ifdef FIO_HAVE_IOPRIO
2734 {
2735 .name = "prio",
e8b0e958 2736 .lname = "I/O nice priority",
214e1eca 2737 .type = FIO_OPT_INT,
28727df7 2738 .off1 = td_var_offset(ioprio),
214e1eca
JA
2739 .help = "Set job IO priority value",
2740 .minval = 0,
2741 .maxval = 7,
20eb06bd 2742 .interval = 1,
e8b0e958 2743 .category = FIO_OPT_C_GENERAL,
10860056 2744 .group = FIO_OPT_G_CRED,
214e1eca
JA
2745 },
2746 {
2747 .name = "prioclass",
e8b0e958 2748 .lname = "I/O nice priority class",
214e1eca 2749 .type = FIO_OPT_INT,
28727df7 2750 .off1 = td_var_offset(ioprio_class),
214e1eca
JA
2751 .help = "Set job IO priority class",
2752 .minval = 0,
2753 .maxval = 3,
20eb06bd 2754 .interval = 1,
e8b0e958 2755 .category = FIO_OPT_C_GENERAL,
10860056 2756 .group = FIO_OPT_G_CRED,
214e1eca
JA
2757 },
2758#endif
2759 {
2760 .name = "thinktime",
e8b0e958 2761 .lname = "Thinktime",
214e1eca
JA
2762 .type = FIO_OPT_INT,
2763 .off1 = td_var_offset(thinktime),
2764 .help = "Idle time between IO buffers (usec)",
2765 .def = "0",
e8b0e958 2766 .category = FIO_OPT_C_IO,
3ceb458f 2767 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2768 },
2769 {
2770 .name = "thinktime_spin",
e8b0e958 2771 .lname = "Thinktime spin",
214e1eca
JA
2772 .type = FIO_OPT_INT,
2773 .off1 = td_var_offset(thinktime_spin),
2774 .help = "Start think time by spinning this amount (usec)",
2775 .def = "0",
afdf9352 2776 .parent = "thinktime",
d71c154c 2777 .hide = 1,
e8b0e958 2778 .category = FIO_OPT_C_IO,
3ceb458f 2779 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2780 },
2781 {
2782 .name = "thinktime_blocks",
e8b0e958 2783 .lname = "Thinktime blocks",
214e1eca
JA
2784 .type = FIO_OPT_INT,
2785 .off1 = td_var_offset(thinktime_blocks),
2786 .help = "IO buffer period between 'thinktime'",
2787 .def = "1",
afdf9352 2788 .parent = "thinktime",
d71c154c 2789 .hide = 1,
e8b0e958 2790 .category = FIO_OPT_C_IO,
3ceb458f 2791 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2792 },
2793 {
2794 .name = "rate",
e8b0e958 2795 .lname = "I/O rate",
e01b22b8 2796 .type = FIO_OPT_INT,
6eaf09d6
SL
2797 .off1 = td_var_offset(rate[DDIR_READ]),
2798 .off2 = td_var_offset(rate[DDIR_WRITE]),
2799 .off3 = td_var_offset(rate[DDIR_TRIM]),
214e1eca 2800 .help = "Set bandwidth rate",
e8b0e958
JA
2801 .category = FIO_OPT_C_IO,
2802 .group = FIO_OPT_G_RATE,
214e1eca
JA
2803 },
2804 {
2805 .name = "ratemin",
e8b0e958 2806 .lname = "I/O min rate",
e01b22b8 2807 .type = FIO_OPT_INT,
6eaf09d6
SL
2808 .off1 = td_var_offset(ratemin[DDIR_READ]),
2809 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2810 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
4e991c23 2811 .help = "Job must meet this rate or it will be shutdown",
afdf9352 2812 .parent = "rate",
d71c154c 2813 .hide = 1,
e8b0e958
JA
2814 .category = FIO_OPT_C_IO,
2815 .group = FIO_OPT_G_RATE,
4e991c23
JA
2816 },
2817 {
2818 .name = "rate_iops",
e8b0e958 2819 .lname = "I/O rate IOPS",
e01b22b8 2820 .type = FIO_OPT_INT,
6eaf09d6
SL
2821 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2822 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2823 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
4e991c23 2824 .help = "Limit IO used to this number of IO operations/sec",
d71c154c 2825 .hide = 1,
e8b0e958
JA
2826 .category = FIO_OPT_C_IO,
2827 .group = FIO_OPT_G_RATE,
4e991c23
JA
2828 },
2829 {
2830 .name = "rate_iops_min",
e8b0e958 2831 .lname = "I/O min rate IOPS",
e01b22b8 2832 .type = FIO_OPT_INT,
6eaf09d6
SL
2833 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2834 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2835 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
03e20d68 2836 .help = "Job must meet this rate or it will be shut down",
afdf9352 2837 .parent = "rate_iops",
d71c154c 2838 .hide = 1,
e8b0e958
JA
2839 .category = FIO_OPT_C_IO,
2840 .group = FIO_OPT_G_RATE,
214e1eca
JA
2841 },
2842 {
2843 .name = "ratecycle",
e8b0e958 2844 .lname = "I/O rate cycle",
214e1eca
JA
2845 .type = FIO_OPT_INT,
2846 .off1 = td_var_offset(ratecycle),
2847 .help = "Window average for rate limits (msec)",
2848 .def = "1000",
afdf9352 2849 .parent = "rate",
d71c154c 2850 .hide = 1,
e8b0e958
JA
2851 .category = FIO_OPT_C_IO,
2852 .group = FIO_OPT_G_RATE,
214e1eca 2853 },
15501535
JA
2854 {
2855 .name = "max_latency",
2856 .type = FIO_OPT_INT,
2857 .off1 = td_var_offset(max_latency),
2858 .help = "Maximum tolerated IO latency (usec)",
1e5324e7 2859 .category = FIO_OPT_C_IO,
3e260a46
JA
2860 .group = FIO_OPT_G_LATPROF,
2861 },
2862 {
2863 .name = "latency_target",
2864 .lname = "Latency Target (usec)",
2865 .type = FIO_OPT_STR_VAL_TIME,
2866 .off1 = td_var_offset(latency_target),
2867 .help = "Ramp to max queue depth supporting this latency",
2868 .category = FIO_OPT_C_IO,
2869 .group = FIO_OPT_G_LATPROF,
2870 },
2871 {
2872 .name = "latency_window",
2873 .lname = "Latency Window (usec)",
2874 .type = FIO_OPT_STR_VAL_TIME,
2875 .off1 = td_var_offset(latency_window),
2876 .help = "Time to sustain latency_target",
2877 .category = FIO_OPT_C_IO,
2878 .group = FIO_OPT_G_LATPROF,
2879 },
2880 {
2881 .name = "latency_percentile",
2882 .lname = "Latency Percentile",
2883 .type = FIO_OPT_FLOAT_LIST,
2884 .off1 = td_var_offset(latency_percentile),
2885 .help = "Percentile of IOs must be below latency_target",
2886 .def = "100",
2887 .maxlen = 1,
2888 .minfp = 0.0,
2889 .maxfp = 100.0,
2890 .category = FIO_OPT_C_IO,
2891 .group = FIO_OPT_G_LATPROF,
15501535 2892 },
214e1eca
JA
2893 {
2894 .name = "invalidate",
e8b0e958 2895 .lname = "Cache invalidate",
214e1eca
JA
2896 .type = FIO_OPT_BOOL,
2897 .off1 = td_var_offset(invalidate_cache),
2898 .help = "Invalidate buffer/page cache prior to running job",
2899 .def = "1",
e8b0e958 2900 .category = FIO_OPT_C_IO,
3ceb458f 2901 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2902 },
2903 {
2904 .name = "sync",
e8b0e958 2905 .lname = "Synchronous I/O",
214e1eca
JA
2906 .type = FIO_OPT_BOOL,
2907 .off1 = td_var_offset(sync_io),
2908 .help = "Use O_SYNC for buffered writes",
2909 .def = "0",
67a1000f 2910 .parent = "buffered",
d71c154c 2911 .hide = 1,
e8b0e958 2912 .category = FIO_OPT_C_IO,
3ceb458f 2913 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2914 },
214e1eca
JA
2915 {
2916 .name = "create_serialize",
e8b0e958 2917 .lname = "Create serialize",
214e1eca
JA
2918 .type = FIO_OPT_BOOL,
2919 .off1 = td_var_offset(create_serialize),
2920 .help = "Serialize creating of job files",
2921 .def = "1",
e8b0e958
JA
2922 .category = FIO_OPT_C_FILE,
2923 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2924 },
2925 {
2926 .name = "create_fsync",
e8b0e958 2927 .lname = "Create fsync",
214e1eca
JA
2928 .type = FIO_OPT_BOOL,
2929 .off1 = td_var_offset(create_fsync),
03e20d68 2930 .help = "fsync file after creation",
214e1eca 2931 .def = "1",
e8b0e958
JA
2932 .category = FIO_OPT_C_FILE,
2933 .group = FIO_OPT_G_INVALID,
214e1eca 2934 },
814452bd
JA
2935 {
2936 .name = "create_on_open",
e8b0e958 2937 .lname = "Create on open",
814452bd
JA
2938 .type = FIO_OPT_BOOL,
2939 .off1 = td_var_offset(create_on_open),
2940 .help = "Create files when they are opened for IO",
2941 .def = "0",
e8b0e958
JA
2942 .category = FIO_OPT_C_FILE,
2943 .group = FIO_OPT_G_INVALID,
814452bd 2944 },
25460cf6
JA
2945 {
2946 .name = "create_only",
2947 .type = FIO_OPT_BOOL,
2948 .off1 = td_var_offset(create_only),
2949 .help = "Only perform file creation phase",
d17fda71 2950 .category = FIO_OPT_C_FILE,
25460cf6
JA
2951 .def = "0",
2952 },
0b9d69ec 2953 {
afad68f7 2954 .name = "pre_read",
e8b0e958 2955 .lname = "Pre-read files",
afad68f7
ZY
2956 .type = FIO_OPT_BOOL,
2957 .off1 = td_var_offset(pre_read),
03e20d68 2958 .help = "Pre-read files before starting official testing",
afad68f7 2959 .def = "0",
e8b0e958
JA
2960 .category = FIO_OPT_C_FILE,
2961 .group = FIO_OPT_G_INVALID,
afad68f7 2962 },
214e1eca
JA
2963#ifdef FIO_HAVE_CPU_AFFINITY
2964 {
2965 .name = "cpumask",
e8b0e958 2966 .lname = "CPU mask",
214e1eca
JA
2967 .type = FIO_OPT_INT,
2968 .cb = str_cpumask_cb,
2969 .help = "CPU affinity mask",
e8b0e958 2970 .category = FIO_OPT_C_GENERAL,
10860056 2971 .group = FIO_OPT_G_CRED,
214e1eca 2972 },
d2e268b0
JA
2973 {
2974 .name = "cpus_allowed",
e8b0e958 2975 .lname = "CPUs allowed",
d2e268b0
JA
2976 .type = FIO_OPT_STR,
2977 .cb = str_cpus_allowed_cb,
2978 .help = "Set CPUs allowed",
e8b0e958 2979 .category = FIO_OPT_C_GENERAL,
10860056 2980 .group = FIO_OPT_G_CRED,
d2e268b0 2981 },
c2acfbac
JA
2982 {
2983 .name = "cpus_allowed_policy",
2984 .lname = "CPUs allowed distribution policy",
2985 .type = FIO_OPT_STR,
2986 .off1 = td_var_offset(cpus_allowed_policy),
2987 .help = "Distribution policy for cpus_allowed",
2988 .parent = "cpus_allowed",
2989 .prio = 1,
2990 .posval = {
2991 { .ival = "shared",
2992 .oval = FIO_CPUS_SHARED,
2993 .help = "Mask shared between threads",
2994 },
2995 { .ival = "split",
2996 .oval = FIO_CPUS_SPLIT,
2997 .help = "Mask split between threads",
2998 },
2999 },
3000 .category = FIO_OPT_C_GENERAL,
3001 .group = FIO_OPT_G_CRED,
3002 },
d0b937ed 3003#endif
67bf9823 3004#ifdef CONFIG_LIBNUMA
d0b937ed
YR
3005 {
3006 .name = "numa_cpu_nodes",
3007 .type = FIO_OPT_STR,
3008 .cb = str_numa_cpunodes_cb,
3009 .help = "NUMA CPU nodes bind",
6be54b2d
JA
3010 .category = FIO_OPT_C_GENERAL,
3011 .group = FIO_OPT_G_INVALID,
d0b937ed
YR
3012 },
3013 {
3014 .name = "numa_mem_policy",
3015 .type = FIO_OPT_STR,
3016 .cb = str_numa_mpol_cb,
3017 .help = "NUMA memory policy setup",
6be54b2d
JA
3018 .category = FIO_OPT_C_GENERAL,
3019 .group = FIO_OPT_G_INVALID,
d0b937ed 3020 },
214e1eca
JA
3021#endif
3022 {
3023 .name = "end_fsync",
e8b0e958 3024 .lname = "End fsync",
214e1eca
JA
3025 .type = FIO_OPT_BOOL,
3026 .off1 = td_var_offset(end_fsync),
3027 .help = "Include fsync at the end of job",
3028 .def = "0",
e8b0e958
JA
3029 .category = FIO_OPT_C_FILE,
3030 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3031 },
3032 {
3033 .name = "fsync_on_close",
e8b0e958 3034 .lname = "Fsync on close",
214e1eca
JA
3035 .type = FIO_OPT_BOOL,
3036 .off1 = td_var_offset(fsync_on_close),
3037 .help = "fsync files on close",
3038 .def = "0",
e8b0e958
JA
3039 .category = FIO_OPT_C_FILE,
3040 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3041 },
3042 {
3043 .name = "unlink",
e8b0e958 3044 .lname = "Unlink file",
214e1eca
JA
3045 .type = FIO_OPT_BOOL,
3046 .off1 = td_var_offset(unlink),
3047 .help = "Unlink created files after job has completed",
3048 .def = "0",
e8b0e958
JA
3049 .category = FIO_OPT_C_FILE,
3050 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3051 },
3052 {
3053 .name = "exitall",
e8b0e958 3054 .lname = "Exit-all on terminate",
214e1eca
JA
3055 .type = FIO_OPT_STR_SET,
3056 .cb = str_exitall_cb,
3057 .help = "Terminate all jobs when one exits",
e8b0e958 3058 .category = FIO_OPT_C_GENERAL,
a1f6afec 3059 .group = FIO_OPT_G_PROCESS,
214e1eca
JA
3060 },
3061 {
3062 .name = "stonewall",
e8b0e958 3063 .lname = "Wait for previous",
d392365e 3064 .alias = "wait_for_previous",
214e1eca
JA
3065 .type = FIO_OPT_STR_SET,
3066 .off1 = td_var_offset(stonewall),
3067 .help = "Insert a hard barrier between this job and previous",
e8b0e958 3068 .category = FIO_OPT_C_GENERAL,
a1f6afec 3069 .group = FIO_OPT_G_PROCESS,
214e1eca 3070 },
b3d62a75
JA
3071 {
3072 .name = "new_group",
e8b0e958 3073 .lname = "New group",
b3d62a75
JA
3074 .type = FIO_OPT_STR_SET,
3075 .off1 = td_var_offset(new_group),
3076 .help = "Mark the start of a new group (for reporting)",
e8b0e958 3077 .category = FIO_OPT_C_GENERAL,
a1f6afec 3078 .group = FIO_OPT_G_PROCESS,
b3d62a75 3079 },
214e1eca
JA
3080 {
3081 .name = "thread",
e8b0e958 3082 .lname = "Thread",
214e1eca
JA
3083 .type = FIO_OPT_STR_SET,
3084 .off1 = td_var_offset(use_thread),
20eb06bd 3085 .help = "Use threads instead of processes",
c8931876
JA
3086#ifdef CONFIG_NO_SHM
3087 .def = "1",
3088 .no_warn_def = 1,
3089#endif
e8b0e958 3090 .category = FIO_OPT_C_GENERAL,
a1f6afec 3091 .group = FIO_OPT_G_PROCESS,
214e1eca
JA
3092 },
3093 {
3094 .name = "write_bw_log",
e8b0e958 3095 .lname = "Write bandwidth log",
203160d5
JA
3096 .type = FIO_OPT_STR_STORE,
3097 .off1 = td_var_offset(bw_log_file),
214e1eca 3098 .help = "Write log of bandwidth during run",
e8b0e958
JA
3099 .category = FIO_OPT_C_LOG,
3100 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3101 },
3102 {
3103 .name = "write_lat_log",
e8b0e958 3104 .lname = "Write latency log",
203160d5
JA
3105 .type = FIO_OPT_STR_STORE,
3106 .off1 = td_var_offset(lat_log_file),
214e1eca 3107 .help = "Write log of latency during run",
e8b0e958
JA
3108 .category = FIO_OPT_C_LOG,
3109 .group = FIO_OPT_G_INVALID,
214e1eca 3110 },
c8eeb9df
JA
3111 {
3112 .name = "write_iops_log",
e8b0e958 3113 .lname = "Write IOPS log",
577c83bd 3114 .type = FIO_OPT_STR_STORE,
203160d5 3115 .off1 = td_var_offset(iops_log_file),
c8eeb9df 3116 .help = "Write log of IOPS during run",
e8b0e958
JA
3117 .category = FIO_OPT_C_LOG,
3118 .group = FIO_OPT_G_INVALID,
c8eeb9df 3119 },
b8bc8cba
JA
3120 {
3121 .name = "log_avg_msec",
e8b0e958 3122 .lname = "Log averaging (msec)",
b8bc8cba
JA
3123 .type = FIO_OPT_INT,
3124 .off1 = td_var_offset(log_avg_msec),
3125 .help = "Average bw/iops/lat logs over this period of time",
3126 .def = "0",
e8b0e958
JA
3127 .category = FIO_OPT_C_LOG,
3128 .group = FIO_OPT_G_INVALID,
b8bc8cba 3129 },
ae588852
JA
3130 {
3131 .name = "log_offset",
3132 .lname = "Log offset of IO",
3133 .type = FIO_OPT_BOOL,
3134 .off1 = td_var_offset(log_offset),
3135 .help = "Include offset of IO for each log entry",
3136 .def = "0",
3137 .category = FIO_OPT_C_LOG,
3138 .group = FIO_OPT_G_INVALID,
3139 },
aee2ab67
JA
3140#ifdef CONFIG_ZLIB
3141 {
3142 .name = "log_compression",
3143 .lname = "Log compression",
3144 .type = FIO_OPT_INT,
3145 .off1 = td_var_offset(log_gz),
3146 .help = "Log in compressed chunks of this size",
3147 .minval = 32 * 1024 * 1024ULL,
3148 .maxval = 512 * 1024 * 1024ULL,
3149 .category = FIO_OPT_C_LOG,
3150 .group = FIO_OPT_G_INVALID,
3151 },
b26317c9
JA
3152 {
3153 .name = "log_store_compressed",
3154 .lname = "Log store compressed",
3155 .type = FIO_OPT_BOOL,
3156 .off1 = td_var_offset(log_gz_store),
3157 .help = "Store logs in a compressed format",
3158 .category = FIO_OPT_C_LOG,
3159 .group = FIO_OPT_G_INVALID,
3160 },
aee2ab67 3161#endif
c504ee55
JA
3162 {
3163 .name = "bwavgtime",
3164 .lname = "Bandwidth average time",
3165 .type = FIO_OPT_INT,
3166 .off1 = td_var_offset(bw_avg_time),
3167 .help = "Time window over which to calculate bandwidth"
3168 " (msec)",
3169 .def = "500",
3170 .parent = "write_bw_log",
3171 .hide = 1,
3172 .interval = 100,
3173 .category = FIO_OPT_C_LOG,
3174 .group = FIO_OPT_G_INVALID,
3175 },
3176 {
3177 .name = "iopsavgtime",
3178 .lname = "IOPS average time",
3179 .type = FIO_OPT_INT,
3180 .off1 = td_var_offset(iops_avg_time),
3181 .help = "Time window over which to calculate IOPS (msec)",
3182 .def = "500",
3183 .parent = "write_iops_log",
3184 .hide = 1,
3185 .interval = 100,
3186 .category = FIO_OPT_C_LOG,
3187 .group = FIO_OPT_G_INVALID,
3188 },
214e1eca
JA
3189 {
3190 .name = "group_reporting",
e8b0e958 3191 .lname = "Group reporting",
d2507043 3192 .type = FIO_OPT_STR_SET,
214e1eca
JA
3193 .off1 = td_var_offset(group_reporting),
3194 .help = "Do reporting on a per-group basis",
10860056 3195 .category = FIO_OPT_C_STAT,
e8b0e958 3196 .group = FIO_OPT_G_INVALID,
214e1eca 3197 },
e9459e5a
JA
3198 {
3199 .name = "zero_buffers",
e8b0e958 3200 .lname = "Zero I/O buffers",
e9459e5a
JA
3201 .type = FIO_OPT_STR_SET,
3202 .off1 = td_var_offset(zero_buffers),
3203 .help = "Init IO buffers to all zeroes",
e8b0e958 3204 .category = FIO_OPT_C_IO,
3ceb458f 3205 .group = FIO_OPT_G_IO_BUF,
e9459e5a 3206 },
5973cafb
JA
3207 {
3208 .name = "refill_buffers",
e8b0e958 3209 .lname = "Refill I/O buffers",
5973cafb
JA
3210 .type = FIO_OPT_STR_SET,
3211 .off1 = td_var_offset(refill_buffers),
3212 .help = "Refill IO buffers on every IO submit",
e8b0e958 3213 .category = FIO_OPT_C_IO,
3ceb458f 3214 .group = FIO_OPT_G_IO_BUF,
5973cafb 3215 },
fd68418e
JA
3216 {
3217 .name = "scramble_buffers",
e8b0e958 3218 .lname = "Scramble I/O buffers",
fd68418e
JA
3219 .type = FIO_OPT_BOOL,
3220 .off1 = td_var_offset(scramble_buffers),
3221 .help = "Slightly scramble buffers on every IO submit",
3222 .def = "1",
e8b0e958 3223 .category = FIO_OPT_C_IO,
3ceb458f 3224 .group = FIO_OPT_G_IO_BUF,
fd68418e 3225 },
ce35b1ec
JA
3226 {
3227 .name = "buffer_pattern",
3228 .lname = "Buffer pattern",
3229 .type = FIO_OPT_STR,
3230 .cb = str_buffer_pattern_cb,
3231 .help = "Fill pattern for IO buffers",
3232 .category = FIO_OPT_C_IO,
3233 .group = FIO_OPT_G_IO_BUF,
3234 },
9c42684e
JA
3235 {
3236 .name = "buffer_compress_percentage",
e8b0e958 3237 .lname = "Buffer compression percentage",
9c42684e 3238 .type = FIO_OPT_INT,
bedc9dc2 3239 .cb = str_buffer_compress_cb,
9c42684e 3240 .maxval = 100,
e7f5de90 3241 .minval = 0,
9c42684e 3242 .help = "How compressible the buffer is (approximately)",
20eb06bd 3243 .interval = 5,
e8b0e958 3244 .category = FIO_OPT_C_IO,
3ceb458f 3245 .group = FIO_OPT_G_IO_BUF,
9c42684e 3246 },
f97a43a1
JA
3247 {
3248 .name = "buffer_compress_chunk",
e8b0e958 3249 .lname = "Buffer compression chunk size",
f97a43a1
JA
3250 .type = FIO_OPT_INT,
3251 .off1 = td_var_offset(compress_chunk),
207b18e4 3252 .parent = "buffer_compress_percentage",
d71c154c 3253 .hide = 1,
f97a43a1 3254 .help = "Size of compressible region in buffer",
20eb06bd 3255 .interval = 256,
e8b0e958 3256 .category = FIO_OPT_C_IO,
3ceb458f 3257 .group = FIO_OPT_G_IO_BUF,
f97a43a1 3258 },
83349190
YH
3259 {
3260 .name = "clat_percentiles",
e8b0e958 3261 .lname = "Completion latency percentiles",
83349190
YH
3262 .type = FIO_OPT_BOOL,
3263 .off1 = td_var_offset(clat_percentiles),
3264 .help = "Enable the reporting of completion latency percentiles",
467b35ed 3265 .def = "1",
e8b0e958
JA
3266 .category = FIO_OPT_C_STAT,
3267 .group = FIO_OPT_G_INVALID,
83349190
YH
3268 },
3269 {
3270 .name = "percentile_list",
e8b0e958 3271 .lname = "Completion latency percentile list",
83349190
YH
3272 .type = FIO_OPT_FLOAT_LIST,
3273 .off1 = td_var_offset(percentile_list),
435d195a 3274 .off2 = td_var_offset(percentile_precision),
83349190 3275 .help = "Specify a custom list of percentiles to report",
fd112d34 3276 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
83349190
YH
3277 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3278 .minfp = 0.0,
3279 .maxfp = 100.0,
e8b0e958
JA
3280 .category = FIO_OPT_C_STAT,
3281 .group = FIO_OPT_G_INVALID,
83349190
YH
3282 },
3283
0a839f30
JA
3284#ifdef FIO_HAVE_DISK_UTIL
3285 {
3286 .name = "disk_util",
e8b0e958 3287 .lname = "Disk utilization",
0a839f30
JA
3288 .type = FIO_OPT_BOOL,
3289 .off1 = td_var_offset(do_disk_util),
f66ab3c8 3290 .help = "Log disk utilization statistics",
0a839f30 3291 .def = "1",
e8b0e958
JA
3292 .category = FIO_OPT_C_STAT,
3293 .group = FIO_OPT_G_INVALID,
0a839f30
JA
3294 },
3295#endif
993bf48b
JA
3296 {
3297 .name = "gtod_reduce",
e8b0e958 3298 .lname = "Reduce gettimeofday() calls",
993bf48b
JA
3299 .type = FIO_OPT_BOOL,
3300 .help = "Greatly reduce number of gettimeofday() calls",
3301 .cb = str_gtod_reduce_cb,
3302 .def = "0",
a4ed77fe 3303 .hide_on_set = 1,
e8b0e958
JA
3304 .category = FIO_OPT_C_STAT,
3305 .group = FIO_OPT_G_INVALID,
993bf48b 3306 },
02af0988
JA
3307 {
3308 .name = "disable_lat",
e8b0e958 3309 .lname = "Disable all latency stats",
02af0988
JA
3310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(disable_lat),
3312 .help = "Disable latency numbers",
3313 .parent = "gtod_reduce",
d71c154c 3314 .hide = 1,
02af0988 3315 .def = "0",
e8b0e958
JA
3316 .category = FIO_OPT_C_STAT,
3317 .group = FIO_OPT_G_INVALID,
02af0988 3318 },
9520ebb9
JA
3319 {
3320 .name = "disable_clat",
e8b0e958 3321 .lname = "Disable completion latency stats",
9520ebb9
JA
3322 .type = FIO_OPT_BOOL,
3323 .off1 = td_var_offset(disable_clat),
3324 .help = "Disable completion latency numbers",
993bf48b 3325 .parent = "gtod_reduce",
d71c154c 3326 .hide = 1,
9520ebb9 3327 .def = "0",
e8b0e958
JA
3328 .category = FIO_OPT_C_STAT,
3329 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
3330 },
3331 {
3332 .name = "disable_slat",
e8b0e958 3333 .lname = "Disable submission latency stats",
9520ebb9
JA
3334 .type = FIO_OPT_BOOL,
3335 .off1 = td_var_offset(disable_slat),
03e20d68 3336 .help = "Disable submission latency numbers",
993bf48b 3337 .parent = "gtod_reduce",
d71c154c 3338 .hide = 1,
9520ebb9 3339 .def = "0",
e8b0e958
JA
3340 .category = FIO_OPT_C_STAT,
3341 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
3342 },
3343 {
3344 .name = "disable_bw_measurement",
e8b0e958 3345 .lname = "Disable bandwidth stats",
9520ebb9
JA
3346 .type = FIO_OPT_BOOL,
3347 .off1 = td_var_offset(disable_bw),
3348 .help = "Disable bandwidth logging",
993bf48b 3349 .parent = "gtod_reduce",
d71c154c 3350 .hide = 1,
9520ebb9 3351 .def = "0",
e8b0e958
JA
3352 .category = FIO_OPT_C_STAT,
3353 .group = FIO_OPT_G_INVALID,
9520ebb9 3354 },
be4ecfdf
JA
3355 {
3356 .name = "gtod_cpu",
e8b0e958 3357 .lname = "Dedicated gettimeofday() CPU",
be4ecfdf
JA
3358 .type = FIO_OPT_INT,
3359 .cb = str_gtod_cpu_cb,
03e20d68 3360 .help = "Set up dedicated gettimeofday() thread on this CPU",
29d43ff9 3361 .verify = gtod_cpu_verify,
e8b0e958 3362 .category = FIO_OPT_C_GENERAL,
10860056 3363 .group = FIO_OPT_G_CLOCK,
be4ecfdf 3364 },
771e58be
JA
3365 {
3366 .name = "unified_rw_reporting",
3367 .type = FIO_OPT_BOOL,
3368 .off1 = td_var_offset(unified_rw_rep),
3369 .help = "Unify reporting across data direction",
3370 .def = "0",
90b7a96d
JA
3371 .category = FIO_OPT_C_GENERAL,
3372 .group = FIO_OPT_G_INVALID,
771e58be 3373 },
f2bba182
RR
3374 {
3375 .name = "continue_on_error",
e8b0e958 3376 .lname = "Continue on error",
06842027 3377 .type = FIO_OPT_STR,
f2bba182 3378 .off1 = td_var_offset(continue_on_error),
03e20d68 3379 .help = "Continue on non-fatal errors during IO",
06842027 3380 .def = "none",
e8b0e958 3381 .category = FIO_OPT_C_GENERAL,
bc3f552f 3382 .group = FIO_OPT_G_ERR,
06842027
SL
3383 .posval = {
3384 { .ival = "none",
3385 .oval = ERROR_TYPE_NONE,
3386 .help = "Exit when an error is encountered",
3387 },
3388 { .ival = "read",
3389 .oval = ERROR_TYPE_READ,
3390 .help = "Continue on read errors only",
3391 },
3392 { .ival = "write",
3393 .oval = ERROR_TYPE_WRITE,
3394 .help = "Continue on write errors only",
3395 },
3396 { .ival = "io",
3397 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3398 .help = "Continue on any IO errors",
3399 },
3400 { .ival = "verify",
3401 .oval = ERROR_TYPE_VERIFY,
3402 .help = "Continue on verify errors only",
3403 },
3404 { .ival = "all",
3405 .oval = ERROR_TYPE_ANY,
3406 .help = "Continue on all io and verify errors",
3407 },
3408 { .ival = "0",
3409 .oval = ERROR_TYPE_NONE,
3410 .help = "Alias for 'none'",
3411 },
3412 { .ival = "1",
3413 .oval = ERROR_TYPE_ANY,
3414 .help = "Alias for 'all'",
3415 },
3416 },
f2bba182 3417 },
8b28bd41
DM
3418 {
3419 .name = "ignore_error",
3420 .type = FIO_OPT_STR,
3421 .cb = str_ignore_error_cb,
3422 .help = "Set a specific list of errors to ignore",
3423 .parent = "rw",
a94eb99a 3424 .category = FIO_OPT_C_GENERAL,
bc3f552f 3425 .group = FIO_OPT_G_ERR,
8b28bd41
DM
3426 },
3427 {
3428 .name = "error_dump",
3429 .type = FIO_OPT_BOOL,
3430 .off1 = td_var_offset(error_dump),
3431 .def = "0",
3432 .help = "Dump info on each error",
a94eb99a 3433 .category = FIO_OPT_C_GENERAL,
bc3f552f 3434 .group = FIO_OPT_G_ERR,
8b28bd41 3435 },
9ac8a797
JA
3436 {
3437 .name = "profile",
e8b0e958 3438 .lname = "Profile",
79d16311 3439 .type = FIO_OPT_STR_STORE,
9ac8a797 3440 .off1 = td_var_offset(profile),
9ac8a797 3441 .help = "Select a specific builtin performance test",
13fca827 3442 .category = FIO_OPT_C_PROFILE,
e8b0e958 3443 .group = FIO_OPT_G_INVALID,
9ac8a797 3444 },
a696fa2a
JA
3445 {
3446 .name = "cgroup",
e8b0e958 3447 .lname = "Cgroup",
a696fa2a
JA
3448 .type = FIO_OPT_STR_STORE,
3449 .off1 = td_var_offset(cgroup),
3450 .help = "Add job to cgroup of this name",
e8b0e958 3451 .category = FIO_OPT_C_GENERAL,
a1f6afec
JA
3452 .group = FIO_OPT_G_CGROUP,
3453 },
3454 {
3455 .name = "cgroup_nodelete",
3456 .lname = "Cgroup no-delete",
3457 .type = FIO_OPT_BOOL,
3458 .off1 = td_var_offset(cgroup_nodelete),
3459 .help = "Do not delete cgroups after job completion",
3460 .def = "0",
3461 .parent = "cgroup",
3462 .category = FIO_OPT_C_GENERAL,
3463 .group = FIO_OPT_G_CGROUP,
a696fa2a
JA
3464 },
3465 {
3466 .name = "cgroup_weight",
e8b0e958 3467 .lname = "Cgroup weight",
a696fa2a
JA
3468 .type = FIO_OPT_INT,
3469 .off1 = td_var_offset(cgroup_weight),
3470 .help = "Use given weight for cgroup",
3471 .minval = 100,
3472 .maxval = 1000,
a1f6afec 3473 .parent = "cgroup",
e8b0e958 3474 .category = FIO_OPT_C_GENERAL,
a1f6afec 3475 .group = FIO_OPT_G_CGROUP,
7de87099 3476 },
e0b0d892
JA
3477 {
3478 .name = "uid",
e8b0e958 3479 .lname = "User ID",
e0b0d892
JA
3480 .type = FIO_OPT_INT,
3481 .off1 = td_var_offset(uid),
3482 .help = "Run job with this user ID",
e8b0e958 3483 .category = FIO_OPT_C_GENERAL,
10860056 3484 .group = FIO_OPT_G_CRED,
e0b0d892
JA
3485 },
3486 {
3487 .name = "gid",
e8b0e958 3488 .lname = "Group ID",
e0b0d892
JA
3489 .type = FIO_OPT_INT,
3490 .off1 = td_var_offset(gid),
3491 .help = "Run job with this group ID",
e8b0e958 3492 .category = FIO_OPT_C_GENERAL,
10860056 3493 .group = FIO_OPT_G_CRED,
e0b0d892 3494 },
a1f6afec
JA
3495 {
3496 .name = "kb_base",
3497 .lname = "KB Base",
3498 .type = FIO_OPT_INT,
3499 .off1 = td_var_offset(kb_base),
a1f6afec
JA
3500 .prio = 1,
3501 .def = "1024",
ba9c7219
JA
3502 .posval = {
3503 { .ival = "1024",
3504 .oval = 1024,
3505 .help = "Use 1024 as the K base",
3506 },
3507 { .ival = "1000",
3508 .oval = 1000,
3509 .help = "Use 1000 as the K base",
3510 },
3511 },
a1f6afec
JA
3512 .help = "How many bytes per KB for reporting (1000 or 1024)",
3513 .category = FIO_OPT_C_GENERAL,
3514 .group = FIO_OPT_G_INVALID,
3515 },
cf3a0518
JA
3516 {
3517 .name = "unit_base",
ba9c7219 3518 .lname = "Base unit for reporting (Bits or Bytes)",
cf3a0518
JA
3519 .type = FIO_OPT_INT,
3520 .off1 = td_var_offset(unit_base),
cf3a0518 3521 .prio = 1,
71a08258
JA
3522 .posval = {
3523 { .ival = "0",
3524 .oval = 0,
3525 .help = "Auto-detect",
3526 },
3527 { .ival = "8",
3528 .oval = 8,
3529 .help = "Normal (byte based)",
3530 },
3531 { .ival = "1",
3532 .oval = 1,
3533 .help = "Bit based",
3534 },
3535 },
cf3a0518
JA
3536 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3537 .category = FIO_OPT_C_GENERAL,
3538 .group = FIO_OPT_G_INVALID,
3539 },
3ceb458f
JA
3540 {
3541 .name = "hugepage-size",
3542 .lname = "Hugepage size",
3543 .type = FIO_OPT_INT,
3544 .off1 = td_var_offset(hugepage_size),
3545 .help = "When using hugepages, specify size of each page",
3546 .def = __fio_stringify(FIO_HUGE_PAGE),
3547 .interval = 1024 * 1024,
3548 .category = FIO_OPT_C_GENERAL,
3549 .group = FIO_OPT_G_INVALID,
3550 },
9e684a49
DE
3551 {
3552 .name = "flow_id",
e8b0e958 3553 .lname = "I/O flow ID",
9e684a49
DE
3554 .type = FIO_OPT_INT,
3555 .off1 = td_var_offset(flow_id),
3556 .help = "The flow index ID to use",
3557 .def = "0",
e8b0e958
JA
3558 .category = FIO_OPT_C_IO,