Basic support for dedupe
[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
5c94b008
JA
1053static int str_dedupe_cb(void *data, unsigned long long *il)
1054{
1055 struct thread_data *td = data;
1056
1057 td->flags |= TD_F_COMPRESS;
1058 td->o.dedupe_percentage = *il;
1059 td->o.refill_buffers = 1;
1060 return 0;
1061}
1062
ce35b1ec
JA
1063static int str_verify_pattern_cb(void *data, const char *input)
1064{
1065 struct thread_data *td = data;
1066 int ret;
1067
1068 ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input,
1069 &td->o.verify_pattern_bytes);
efcd9dcc 1070
92bf48d5
JA
1071 /*
1072 * VERIFY_META could already be set
1073 */
ce35b1ec 1074 if (!ret && td->o.verify == VERIFY_NONE)
92bf48d5 1075 td->o.verify = VERIFY_PATTERN;
efcd9dcc 1076
ce35b1ec 1077 return ret;
90059d65 1078}
214e1eca 1079
993bf48b
JA
1080static int str_gtod_reduce_cb(void *data, int *il)
1081{
1082 struct thread_data *td = data;
1083 int val = *il;
1084
02af0988 1085 td->o.disable_lat = !!val;
993bf48b
JA
1086 td->o.disable_clat = !!val;
1087 td->o.disable_slat = !!val;
1088 td->o.disable_bw = !!val;
0dc1bc03 1089 td->o.clat_percentiles = !val;
993bf48b
JA
1090 if (val)
1091 td->tv_cache_mask = 63;
1092
1093 return 0;
1094}
1095
85bc833b 1096static int str_gtod_cpu_cb(void *data, long long *il)
be4ecfdf
JA
1097{
1098 struct thread_data *td = data;
1099 int val = *il;
1100
1101 td->o.gtod_cpu = val;
1102 td->o.gtod_offload = 1;
1103 return 0;
1104}
1105
7bb59102
JA
1106static int str_size_cb(void *data, unsigned long long *__val)
1107{
1108 struct thread_data *td = data;
1109 unsigned long long v = *__val;
1110
1111 if (parse_is_percent(v)) {
1112 td->o.size = 0;
1113 td->o.size_percent = -1ULL - v;
1114 } else
1115 td->o.size = v;
1116
1117 return 0;
1118}
1119
896cac2a
JA
1120static int rw_verify(struct fio_option *o, void *data)
1121{
1122 struct thread_data *td = data;
1123
1124 if (read_only && td_write(td)) {
1125 log_err("fio: job <%s> has write bit set, but fio is in"
1126 " read-only mode\n", td->o.name);
1127 return 1;
1128 }
1129
1130 return 0;
1131}
1132
276ca4f7 1133static int gtod_cpu_verify(struct fio_option *o, void *data)
29d43ff9 1134{
276ca4f7 1135#ifndef FIO_HAVE_CPU_AFFINITY
29d43ff9
JA
1136 struct thread_data *td = data;
1137
29d43ff9
JA
1138 if (td->o.gtod_cpu) {
1139 log_err("fio: platform must support CPU affinity for"
1140 "gettimeofday() offloading\n");
1141 return 1;
1142 }
1143#endif
1144
1145 return 0;
1146}
1147
9af4a244
JA
1148/*
1149 * Option grouping
1150 */
1151static struct opt_group fio_opt_groups[] = {
1152 {
e8b0e958
JA
1153 .name = "General",
1154 .mask = FIO_OPT_C_GENERAL,
9af4a244
JA
1155 },
1156 {
e8b0e958
JA
1157 .name = "I/O",
1158 .mask = FIO_OPT_C_IO,
9af4a244
JA
1159 },
1160 {
e8b0e958
JA
1161 .name = "File",
1162 .mask = FIO_OPT_C_FILE,
9af4a244
JA
1163 },
1164 {
e8b0e958
JA
1165 .name = "Statistics",
1166 .mask = FIO_OPT_C_STAT,
9af4a244
JA
1167 },
1168 {
e8b0e958
JA
1169 .name = "Logging",
1170 .mask = FIO_OPT_C_LOG,
9af4a244 1171 },
13fca827
JA
1172 {
1173 .name = "Profiles",
1174 .mask = FIO_OPT_C_PROFILE,
1175 },
e231bbe6 1176 {
e8b0e958 1177 .name = NULL,
e231bbe6 1178 },
e8b0e958
JA
1179};
1180
1181static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask,
1182 unsigned int inv_mask)
1183{
1184 struct opt_group *og;
1185 int i;
1186
1187 if (*mask == inv_mask || !*mask)
1188 return NULL;
1189
1190 for (i = 0; ogs[i].name; i++) {
1191 og = &ogs[i];
1192
1193 if (*mask & og->mask) {
1194 *mask &= ~(og->mask);
1195 return og;
1196 }
1197 }
1198
1199 return NULL;
1200}
1201
1202struct opt_group *opt_group_from_mask(unsigned int *mask)
1203{
1204 return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID);
1205}
1206
1207static struct opt_group fio_opt_cat_groups[] = {
3e260a46
JA
1208 {
1209 .name = "Latency profiling",
1210 .mask = FIO_OPT_G_LATPROF,
1211 },
9af4a244 1212 {
e8b0e958
JA
1213 .name = "Rate",
1214 .mask = FIO_OPT_G_RATE,
9af4a244
JA
1215 },
1216 {
e8b0e958
JA
1217 .name = "Zone",
1218 .mask = FIO_OPT_G_ZONE,
9af4a244
JA
1219 },
1220 {
e8b0e958
JA
1221 .name = "Read/write mix",
1222 .mask = FIO_OPT_G_RWMIX,
9af4a244
JA
1223 },
1224 {
1225 .name = "Verify",
1226 .mask = FIO_OPT_G_VERIFY,
1227 },
1228 {
e8b0e958
JA
1229 .name = "Trim",
1230 .mask = FIO_OPT_G_TRIM,
9af4a244
JA
1231 },
1232 {
e8b0e958
JA
1233 .name = "I/O Logging",
1234 .mask = FIO_OPT_G_IOLOG,
9af4a244
JA
1235 },
1236 {
e8b0e958
JA
1237 .name = "I/O Depth",
1238 .mask = FIO_OPT_G_IO_DEPTH,
9af4a244
JA
1239 },
1240 {
e8b0e958
JA
1241 .name = "I/O Flow",
1242 .mask = FIO_OPT_G_IO_FLOW,
9af4a244 1243 },
0626037e
JA
1244 {
1245 .name = "Description",
1246 .mask = FIO_OPT_G_DESC,
1247 },
1248 {
1249 .name = "Filename",
1250 .mask = FIO_OPT_G_FILENAME,
1251 },
1252 {
1253 .name = "General I/O",
1254 .mask = FIO_OPT_G_IO_BASIC,
1255 },
a1f6afec
JA
1256 {
1257 .name = "Cgroups",
1258 .mask = FIO_OPT_G_CGROUP,
1259 },
1260 {
1261 .name = "Runtime",
1262 .mask = FIO_OPT_G_RUNTIME,
1263 },
10860056
JA
1264 {
1265 .name = "Process",
1266 .mask = FIO_OPT_G_PROCESS,
1267 },
1268 {
1269 .name = "Job credentials / priority",
1270 .mask = FIO_OPT_G_CRED,
1271 },
1272 {
1273 .name = "Clock settings",
1274 .mask = FIO_OPT_G_CLOCK,
1275 },
3ceb458f
JA
1276 {
1277 .name = "I/O Type",
1278 .mask = FIO_OPT_G_IO_TYPE,
1279 },
1280 {
1281 .name = "I/O Thinktime",
1282 .mask = FIO_OPT_G_THINKTIME,
1283 },
1284 {
1285 .name = "Randomizations",
1286 .mask = FIO_OPT_G_RANDOM,
1287 },
1288 {
1289 .name = "I/O buffers",
1290 .mask = FIO_OPT_G_IO_BUF,
1291 },
13fca827
JA
1292 {
1293 .name = "Tiobench profile",
1294 .mask = FIO_OPT_G_TIOBENCH,
1295 },
1296
9af4a244
JA
1297 {
1298 .name = NULL,
e8b0e958 1299 }
9af4a244
JA
1300};
1301
e8b0e958 1302struct opt_group *opt_group_cat_from_mask(unsigned int *mask)
9af4a244 1303{
e8b0e958 1304 return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID);
9af4a244
JA
1305}
1306
214e1eca
JA
1307/*
1308 * Map of job/command line options
1309 */
9af4a244 1310struct fio_option fio_options[FIO_MAX_OPTS] = {
214e1eca
JA
1311 {
1312 .name = "description",
e8b0e958 1313 .lname = "Description of job",
214e1eca
JA
1314 .type = FIO_OPT_STR_STORE,
1315 .off1 = td_var_offset(description),
1316 .help = "Text job description",
e8b0e958 1317 .category = FIO_OPT_C_GENERAL,
0626037e 1318 .group = FIO_OPT_G_DESC,
214e1eca
JA
1319 },
1320 {
1321 .name = "name",
e8b0e958 1322 .lname = "Job name",
214e1eca
JA
1323 .type = FIO_OPT_STR_STORE,
1324 .off1 = td_var_offset(name),
1325 .help = "Name of this job",
e8b0e958 1326 .category = FIO_OPT_C_GENERAL,
0626037e 1327 .group = FIO_OPT_G_DESC,
214e1eca 1328 },
214e1eca
JA
1329 {
1330 .name = "filename",
e8b0e958 1331 .lname = "Filename(s)",
214e1eca
JA
1332 .type = FIO_OPT_STR_STORE,
1333 .off1 = td_var_offset(filename),
1334 .cb = str_filename_cb,
f0d524b0 1335 .prio = -1, /* must come after "directory" */
214e1eca 1336 .help = "File(s) to use for the workload",
e8b0e958 1337 .category = FIO_OPT_C_FILE,
0626037e 1338 .group = FIO_OPT_G_FILENAME,
214e1eca 1339 },
90fef2d1 1340 {
e8b0e958
JA
1341 .name = "directory",
1342 .lname = "Directory",
1343 .type = FIO_OPT_STR_STORE,
1344 .off1 = td_var_offset(directory),
1345 .cb = str_directory_cb,
1346 .help = "Directory to store files in",
1347 .category = FIO_OPT_C_FILE,
0626037e 1348 .group = FIO_OPT_G_FILENAME,
90fef2d1 1349 },
de98bd30
JA
1350 {
1351 .name = "filename_format",
1352 .type = FIO_OPT_STR_STORE,
1353 .off1 = td_var_offset(filename_format),
1354 .prio = -1, /* must come after "directory" */
1355 .help = "Override default $jobname.$jobnum.$filenum naming",
1356 .def = "$jobname.$jobnum.$filenum",
93bb626a
JA
1357 .category = FIO_OPT_C_FILE,
1358 .group = FIO_OPT_G_FILENAME,
ad705bcb 1359 },
29c1349f
JA
1360 {
1361 .name = "lockfile",
e8b0e958 1362 .lname = "Lockfile",
4d4e80f2 1363 .type = FIO_OPT_STR,
4d4e80f2 1364 .off1 = td_var_offset(file_lock_mode),
29c1349f 1365 .help = "Lock file when doing IO to it",
bc6a0a5d 1366 .prio = 1,
29c1349f 1367 .parent = "filename",
d71c154c 1368 .hide = 0,
4d4e80f2 1369 .def = "none",
f2a2803a 1370 .cb = str_lockfile_cb,
e8b0e958 1371 .category = FIO_OPT_C_FILE,
0626037e 1372 .group = FIO_OPT_G_FILENAME,
4d4e80f2
JA
1373 .posval = {
1374 { .ival = "none",
1375 .oval = FILE_LOCK_NONE,
1376 .help = "No file locking",
1377 },
1378 { .ival = "exclusive",
1379 .oval = FILE_LOCK_EXCLUSIVE,
1380 .help = "Exclusive file lock",
1381 },
1382 {
1383 .ival = "readwrite",
1384 .oval = FILE_LOCK_READWRITE,
1385 .help = "Read vs write lock",
1386 },
1387 },
29c1349f 1388 },
214e1eca
JA
1389 {
1390 .name = "opendir",
e8b0e958 1391 .lname = "Open directory",
214e1eca
JA
1392 .type = FIO_OPT_STR_STORE,
1393 .off1 = td_var_offset(opendir),
1394 .cb = str_opendir_cb,
1395 .help = "Recursively add files from this directory and down",
e8b0e958 1396 .category = FIO_OPT_C_FILE,
0626037e 1397 .group = FIO_OPT_G_FILENAME,
214e1eca
JA
1398 },
1399 {
1400 .name = "rw",
e8b0e958 1401 .lname = "Read/write",
d3aad8f2 1402 .alias = "readwrite",
214e1eca 1403 .type = FIO_OPT_STR,
211097b2 1404 .cb = str_rw_cb,
214e1eca
JA
1405 .off1 = td_var_offset(td_ddir),
1406 .help = "IO direction",
1407 .def = "read",
896cac2a 1408 .verify = rw_verify,
e8b0e958 1409 .category = FIO_OPT_C_IO,
0626037e 1410 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1411 .posval = {
1412 { .ival = "read",
1413 .oval = TD_DDIR_READ,
1414 .help = "Sequential read",
1415 },
1416 { .ival = "write",
1417 .oval = TD_DDIR_WRITE,
1418 .help = "Sequential write",
1419 },
6eaf09d6
SL
1420 { .ival = "trim",
1421 .oval = TD_DDIR_TRIM,
1422 .help = "Sequential trim",
1423 },
214e1eca
JA
1424 { .ival = "randread",
1425 .oval = TD_DDIR_RANDREAD,
1426 .help = "Random read",
1427 },
1428 { .ival = "randwrite",
1429 .oval = TD_DDIR_RANDWRITE,
1430 .help = "Random write",
1431 },
6eaf09d6
SL
1432 { .ival = "randtrim",
1433 .oval = TD_DDIR_RANDTRIM,
1434 .help = "Random trim",
1435 },
214e1eca
JA
1436 { .ival = "rw",
1437 .oval = TD_DDIR_RW,
1438 .help = "Sequential read and write mix",
1439 },
10b023db
JA
1440 { .ival = "readwrite",
1441 .oval = TD_DDIR_RW,
1442 .help = "Sequential read and write mix",
1443 },
214e1eca
JA
1444 { .ival = "randrw",
1445 .oval = TD_DDIR_RANDRW,
1446 .help = "Random read and write mix"
1447 },
1448 },
1449 },
38dad62d
JA
1450 {
1451 .name = "rw_sequencer",
e8b0e958 1452 .lname = "RW Sequencer",
38dad62d
JA
1453 .type = FIO_OPT_STR,
1454 .off1 = td_var_offset(rw_seq),
1455 .help = "IO offset generator modifier",
1456 .def = "sequential",
e8b0e958 1457 .category = FIO_OPT_C_IO,
0626037e 1458 .group = FIO_OPT_G_IO_BASIC,
38dad62d
JA
1459 .posval = {
1460 { .ival = "sequential",
1461 .oval = RW_SEQ_SEQ,
1462 .help = "Generate sequential offsets",
1463 },
1464 { .ival = "identical",
1465 .oval = RW_SEQ_IDENT,
1466 .help = "Generate identical offsets",
1467 },
1468 },
1469 },
1470
214e1eca
JA
1471 {
1472 .name = "ioengine",
e8b0e958 1473 .lname = "IO Engine",
214e1eca
JA
1474 .type = FIO_OPT_STR_STORE,
1475 .off1 = td_var_offset(ioengine),
1476 .help = "IO engine to use",
58483fa4 1477 .def = FIO_PREFERRED_ENGINE,
e8b0e958 1478 .category = FIO_OPT_C_IO,
0626037e 1479 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1480 .posval = {
1481 { .ival = "sync",
1482 .help = "Use read/write",
1483 },
a31041ea 1484 { .ival = "psync",
1485 .help = "Use pread/pwrite",
1486 },
1d2af02a 1487 { .ival = "vsync",
03e20d68 1488 .help = "Use readv/writev",
1d2af02a 1489 },
07fc0acd
JA
1490#ifdef CONFIG_PWRITEV
1491 { .ival = "pvsync",
1492 .help = "Use preadv/pwritev",
1493 },
1494#endif
67bf9823 1495#ifdef CONFIG_LIBAIO
214e1eca
JA
1496 { .ival = "libaio",
1497 .help = "Linux native asynchronous IO",
1498 },
1499#endif
67bf9823 1500#ifdef CONFIG_POSIXAIO
214e1eca
JA
1501 { .ival = "posixaio",
1502 .help = "POSIX asynchronous IO",
1503 },
417f0068 1504#endif
997843cb 1505#ifdef CONFIG_SOLARISAIO
417f0068
JA
1506 { .ival = "solarisaio",
1507 .help = "Solaris native asynchronous IO",
1508 },
214e1eca 1509#endif
4700b234 1510#ifdef CONFIG_WINDOWSAIO
03e20d68 1511 { .ival = "windowsaio",
3be80071 1512 .help = "Windows native asynchronous IO"
de890a1e 1513 },
fc5c0345
DG
1514#endif
1515#ifdef CONFIG_RBD
1516 { .ival = "rbd",
1517 .help = "Rados Block Device asynchronous IO"
1518 },
3be80071 1519#endif
214e1eca 1520 { .ival = "mmap",
03e20d68 1521 .help = "Memory mapped IO"
214e1eca 1522 },
67bf9823 1523#ifdef CONFIG_LINUX_SPLICE
214e1eca
JA
1524 { .ival = "splice",
1525 .help = "splice/vmsplice based IO",
1526 },
9cce02e8
JA
1527 { .ival = "netsplice",
1528 .help = "splice/vmsplice to/from the network",
1529 },
214e1eca
JA
1530#endif
1531#ifdef FIO_HAVE_SGIO
1532 { .ival = "sg",
1533 .help = "SCSI generic v3 IO",
1534 },
1535#endif
1536 { .ival = "null",
1537 .help = "Testing engine (no data transfer)",
1538 },
1539 { .ival = "net",
1540 .help = "Network IO",
1541 },
214e1eca 1542 { .ival = "cpuio",
03e20d68 1543 .help = "CPU cycle burner engine",
214e1eca 1544 },
67bf9823 1545#ifdef CONFIG_GUASI
b8c82a46
JA
1546 { .ival = "guasi",
1547 .help = "GUASI IO engine",
1548 },
79a43187
JA
1549#endif
1550#ifdef FIO_HAVE_BINJECT
1551 { .ival = "binject",
1552 .help = "binject direct inject block engine",
1553 },
21b8aee8 1554#endif
67bf9823 1555#ifdef CONFIG_RDMA
21b8aee8 1556 { .ival = "rdma",
1557 .help = "RDMA IO engine",
1558 },
8200b8c7 1559#endif
67bf9823 1560#ifdef CONFIG_FUSION_AW
8200b8c7
JA
1561 { .ival = "fusion-aw-sync",
1562 .help = "Fusion-io atomic write engine",
1563 },
1ecc95ca 1564#endif
997843cb 1565#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1ecc95ca
JA
1566 { .ival = "e4defrag",
1567 .help = "ext4 defrag engine",
1568 },
1569#endif
997843cb 1570#ifdef CONFIG_LINUX_FALLOCATE
1ecc95ca
JA
1571 { .ival = "falloc",
1572 .help = "fallocate() file based engine",
1573 },
b8c82a46 1574#endif
a7c386f4 1575#ifdef CONFIG_GFAPI
1576 { .ival = "gfapi",
cc47f094 1577 .help = "Glusterfs libgfapi(sync) based engine"
1578 },
1579 { .ival = "gfapi_async",
1580 .help = "Glusterfs libgfapi(async) based engine"
a7c386f4 1581 },
1582#endif
1b10477b 1583#ifdef CONFIG_LIBHDFS
b74e419e 1584 { .ival = "libhdfs",
1b10477b
MM
1585 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1586 },
1587#endif
214e1eca
JA
1588 { .ival = "external",
1589 .help = "Load external engine (append name)",
1590 },
1591 },
1592 },
1593 {
1594 .name = "iodepth",
e8b0e958 1595 .lname = "IO Depth",
214e1eca
JA
1596 .type = FIO_OPT_INT,
1597 .off1 = td_var_offset(iodepth),
03e20d68 1598 .help = "Number of IO buffers to keep in flight",
757aff4f 1599 .minval = 1,
20eb06bd 1600 .interval = 1,
214e1eca 1601 .def = "1",
e8b0e958 1602 .category = FIO_OPT_C_IO,
0626037e 1603 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1604 },
1605 {
1606 .name = "iodepth_batch",
e8b0e958 1607 .lname = "IO Depth batch",
4950421a 1608 .alias = "iodepth_batch_submit",
214e1eca
JA
1609 .type = FIO_OPT_INT,
1610 .off1 = td_var_offset(iodepth_batch),
d65db441 1611 .help = "Number of IO buffers to submit in one go",
afdf9352 1612 .parent = "iodepth",
d71c154c 1613 .hide = 1,
a2e6f8ac 1614 .minval = 1,
20eb06bd 1615 .interval = 1,
a2e6f8ac 1616 .def = "1",
e8b0e958 1617 .category = FIO_OPT_C_IO,
0626037e 1618 .group = FIO_OPT_G_IO_BASIC,
4950421a
JA
1619 },
1620 {
1621 .name = "iodepth_batch_complete",
e8b0e958 1622 .lname = "IO Depth batch complete",
4950421a
JA
1623 .type = FIO_OPT_INT,
1624 .off1 = td_var_offset(iodepth_batch_complete),
d65db441 1625 .help = "Number of IO buffers to retrieve in one go",
4950421a 1626 .parent = "iodepth",
d71c154c 1627 .hide = 1,
4950421a 1628 .minval = 0,
20eb06bd 1629 .interval = 1,
4950421a 1630 .def = "1",
e8b0e958 1631 .category = FIO_OPT_C_IO,
0626037e 1632 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1633 },
1634 {
1635 .name = "iodepth_low",
e8b0e958 1636 .lname = "IO Depth batch low",
214e1eca
JA
1637 .type = FIO_OPT_INT,
1638 .off1 = td_var_offset(iodepth_low),
1639 .help = "Low water mark for queuing depth",
afdf9352 1640 .parent = "iodepth",
d71c154c 1641 .hide = 1,
20eb06bd 1642 .interval = 1,
e8b0e958 1643 .category = FIO_OPT_C_IO,
0626037e 1644 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1645 },
1646 {
1647 .name = "size",
e8b0e958 1648 .lname = "Size",
214e1eca 1649 .type = FIO_OPT_STR_VAL,
7bb59102 1650 .cb = str_size_cb,
214e1eca 1651 .help = "Total size of device or files",
20eb06bd 1652 .interval = 1024 * 1024,
e8b0e958
JA
1653 .category = FIO_OPT_C_IO,
1654 .group = FIO_OPT_G_INVALID,
214e1eca 1655 },
77731b29
JA
1656 {
1657 .name = "io_limit",
1658 .lname = "IO Limit",
1659 .type = FIO_OPT_STR_VAL,
1660 .off1 = td_var_offset(io_limit),
1661 .interval = 1024 * 1024,
1662 .category = FIO_OPT_C_IO,
1663 .group = FIO_OPT_G_INVALID,
1664 },
aa31f1f1
SL
1665 {
1666 .name = "fill_device",
e8b0e958 1667 .lname = "Fill device",
74586c1e 1668 .alias = "fill_fs",
aa31f1f1
SL
1669 .type = FIO_OPT_BOOL,
1670 .off1 = td_var_offset(fill_device),
1671 .help = "Write until an ENOSPC error occurs",
1672 .def = "0",
e8b0e958
JA
1673 .category = FIO_OPT_C_FILE,
1674 .group = FIO_OPT_G_INVALID,
aa31f1f1 1675 },
214e1eca
JA
1676 {
1677 .name = "filesize",
e8b0e958 1678 .lname = "File size",
214e1eca
JA
1679 .type = FIO_OPT_STR_VAL,
1680 .off1 = td_var_offset(file_size_low),
1681 .off2 = td_var_offset(file_size_high),
c3edbdba 1682 .minval = 1,
214e1eca 1683 .help = "Size of individual files",
20eb06bd 1684 .interval = 1024 * 1024,
e8b0e958
JA
1685 .category = FIO_OPT_C_FILE,
1686 .group = FIO_OPT_G_INVALID,
214e1eca 1687 },
bedc9dc2
JA
1688 {
1689 .name = "file_append",
1690 .lname = "File append",
1691 .type = FIO_OPT_BOOL,
1692 .off1 = td_var_offset(file_append),
1693 .help = "IO will start at the end of the file(s)",
1694 .def = "0",
1695 .category = FIO_OPT_C_FILE,
1696 .group = FIO_OPT_G_INVALID,
1697 },
67a1000f
JA
1698 {
1699 .name = "offset",
e8b0e958 1700 .lname = "IO offset",
67a1000f
JA
1701 .alias = "fileoffset",
1702 .type = FIO_OPT_STR_VAL,
1703 .off1 = td_var_offset(start_offset),
1704 .help = "Start IO from this offset",
1705 .def = "0",
20eb06bd 1706 .interval = 1024 * 1024,
e8b0e958
JA
1707 .category = FIO_OPT_C_IO,
1708 .group = FIO_OPT_G_INVALID,
67a1000f 1709 },
2d7cd868
JA
1710 {
1711 .name = "offset_increment",
e8b0e958 1712 .lname = "IO offset increment",
2d7cd868
JA
1713 .type = FIO_OPT_STR_VAL,
1714 .off1 = td_var_offset(offset_increment),
1715 .help = "What is the increment from one offset to the next",
1716 .parent = "offset",
d71c154c 1717 .hide = 1,
2d7cd868 1718 .def = "0",
20eb06bd 1719 .interval = 1024 * 1024,
e8b0e958
JA
1720 .category = FIO_OPT_C_IO,
1721 .group = FIO_OPT_G_INVALID,
2d7cd868 1722 },
ddf24e42
JA
1723 {
1724 .name = "number_ios",
1725 .lname = "Number of IOs to perform",
1726 .type = FIO_OPT_STR_VAL,
1727 .off1 = td_var_offset(number_ios),
1728 .help = "Force job completion of this number of IOs",
1729 .def = "0",
1730 .category = FIO_OPT_C_IO,
1731 .group = FIO_OPT_G_INVALID,
1732 },
214e1eca
JA
1733 {
1734 .name = "bs",
e8b0e958 1735 .lname = "Block size",
d3aad8f2 1736 .alias = "blocksize",
e01b22b8 1737 .type = FIO_OPT_INT,
214e1eca
JA
1738 .off1 = td_var_offset(bs[DDIR_READ]),
1739 .off2 = td_var_offset(bs[DDIR_WRITE]),
6eaf09d6 1740 .off3 = td_var_offset(bs[DDIR_TRIM]),
c3edbdba 1741 .minval = 1,
214e1eca
JA
1742 .help = "Block size unit",
1743 .def = "4k",
67a1000f 1744 .parent = "rw",
d71c154c 1745 .hide = 1,
20eb06bd 1746 .interval = 512,
e8b0e958
JA
1747 .category = FIO_OPT_C_IO,
1748 .group = FIO_OPT_G_INVALID,
214e1eca 1749 },
2b7a01d0
JA
1750 {
1751 .name = "ba",
e8b0e958 1752 .lname = "Block size align",
2b7a01d0 1753 .alias = "blockalign",
e01b22b8 1754 .type = FIO_OPT_INT,
2b7a01d0
JA
1755 .off1 = td_var_offset(ba[DDIR_READ]),
1756 .off2 = td_var_offset(ba[DDIR_WRITE]),
6eaf09d6 1757 .off3 = td_var_offset(ba[DDIR_TRIM]),
2b7a01d0
JA
1758 .minval = 1,
1759 .help = "IO block offset alignment",
1760 .parent = "rw",
d71c154c 1761 .hide = 1,
20eb06bd 1762 .interval = 512,
e8b0e958
JA
1763 .category = FIO_OPT_C_IO,
1764 .group = FIO_OPT_G_INVALID,
2b7a01d0 1765 },
214e1eca
JA
1766 {
1767 .name = "bsrange",
e8b0e958 1768 .lname = "Block size range",
d3aad8f2 1769 .alias = "blocksize_range",
214e1eca
JA
1770 .type = FIO_OPT_RANGE,
1771 .off1 = td_var_offset(min_bs[DDIR_READ]),
1772 .off2 = td_var_offset(max_bs[DDIR_READ]),
1773 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1774 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
6eaf09d6
SL
1775 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1776 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
c3edbdba 1777 .minval = 1,
214e1eca 1778 .help = "Set block size range (in more detail than bs)",
67a1000f 1779 .parent = "rw",
d71c154c 1780 .hide = 1,
20eb06bd 1781 .interval = 4096,
e8b0e958
JA
1782 .category = FIO_OPT_C_IO,
1783 .group = FIO_OPT_G_INVALID,
214e1eca 1784 },
564ca972
JA
1785 {
1786 .name = "bssplit",
e8b0e958 1787 .lname = "Block size split",
564ca972
JA
1788 .type = FIO_OPT_STR,
1789 .cb = str_bssplit_cb,
1790 .help = "Set a specific mix of block sizes",
1791 .parent = "rw",
d71c154c 1792 .hide = 1,
e8b0e958
JA
1793 .category = FIO_OPT_C_IO,
1794 .group = FIO_OPT_G_INVALID,
564ca972 1795 },
214e1eca
JA
1796 {
1797 .name = "bs_unaligned",
e8b0e958 1798 .lname = "Block size unaligned",
d3aad8f2 1799 .alias = "blocksize_unaligned",
214e1eca
JA
1800 .type = FIO_OPT_STR_SET,
1801 .off1 = td_var_offset(bs_unaligned),
1802 .help = "Don't sector align IO buffer sizes",
67a1000f 1803 .parent = "rw",
d71c154c 1804 .hide = 1,
e8b0e958
JA
1805 .category = FIO_OPT_C_IO,
1806 .group = FIO_OPT_G_INVALID,
214e1eca 1807 },
6aca9b3d
JA
1808 {
1809 .name = "bs_is_seq_rand",
1810 .lname = "Block size division is seq/random (not read/write)",
1811 .type = FIO_OPT_BOOL,
1812 .off1 = td_var_offset(bs_is_seq_rand),
1813 .help = "Consider any blocksize setting to be sequential,ramdom",
1814 .def = "0",
1815 .parent = "blocksize",
1816 .category = FIO_OPT_C_IO,
1817 .group = FIO_OPT_G_INVALID,
1818 },
214e1eca
JA
1819 {
1820 .name = "randrepeat",
e8b0e958 1821 .lname = "Random repeatable",
214e1eca
JA
1822 .type = FIO_OPT_BOOL,
1823 .off1 = td_var_offset(rand_repeatable),
1824 .help = "Use repeatable random IO pattern",
1825 .def = "1",
67a1000f 1826 .parent = "rw",
d71c154c 1827 .hide = 1,
e8b0e958 1828 .category = FIO_OPT_C_IO,
3ceb458f 1829 .group = FIO_OPT_G_RANDOM,
214e1eca 1830 },
04778baf
JA
1831 {
1832 .name = "randseed",
1833 .lname = "The random generator seed",
363cffa7 1834 .type = FIO_OPT_STR_VAL,
04778baf
JA
1835 .off1 = td_var_offset(rand_seed),
1836 .help = "Set the random generator seed value",
1837 .parent = "rw",
1838 .category = FIO_OPT_C_IO,
1839 .group = FIO_OPT_G_RANDOM,
1840 },
2615cc4b
JA
1841 {
1842 .name = "use_os_rand",
e8b0e958 1843 .lname = "Use OS random",
2615cc4b
JA
1844 .type = FIO_OPT_BOOL,
1845 .off1 = td_var_offset(use_os_rand),
1846 .help = "Set to use OS random generator",
1847 .def = "0",
1848 .parent = "rw",
d71c154c 1849 .hide = 1,
e8b0e958 1850 .category = FIO_OPT_C_IO,
3ceb458f 1851 .group = FIO_OPT_G_RANDOM,
2615cc4b 1852 },
214e1eca
JA
1853 {
1854 .name = "norandommap",
e8b0e958 1855 .lname = "No randommap",
214e1eca
JA
1856 .type = FIO_OPT_STR_SET,
1857 .off1 = td_var_offset(norandommap),
1858 .help = "Accept potential duplicate random blocks",
67a1000f 1859 .parent = "rw",
d71c154c 1860 .hide = 1,
b2452a43 1861 .hide_on_set = 1,
e8b0e958 1862 .category = FIO_OPT_C_IO,
3ceb458f 1863 .group = FIO_OPT_G_RANDOM,
214e1eca 1864 },
2b386d25
JA
1865 {
1866 .name = "softrandommap",
e8b0e958 1867 .lname = "Soft randommap",
2b386d25
JA
1868 .type = FIO_OPT_BOOL,
1869 .off1 = td_var_offset(softrandommap),
f66ab3c8 1870 .help = "Set norandommap if randommap allocation fails",
2b386d25 1871 .parent = "norandommap",
d71c154c 1872 .hide = 1,
2b386d25 1873 .def = "0",
e8b0e958 1874 .category = FIO_OPT_C_IO,
3ceb458f 1875 .group = FIO_OPT_G_RANDOM,
2b386d25 1876 },
8055e41d
JA
1877 {
1878 .name = "random_generator",
1879 .type = FIO_OPT_STR,
1880 .off1 = td_var_offset(random_generator),
1881 .help = "Type of random number generator to use",
1882 .def = "tausworthe",
1883 .posval = {
1884 { .ival = "tausworthe",
1885 .oval = FIO_RAND_GEN_TAUSWORTHE,
1886 .help = "Strong Tausworthe generator",
1887 },
1888 { .ival = "lfsr",
1889 .oval = FIO_RAND_GEN_LFSR,
1890 .help = "Variable length LFSR",
1891 },
1892 },
48107598
JA
1893 .category = FIO_OPT_C_IO,
1894 .group = FIO_OPT_G_RANDOM,
8055e41d 1895 },
e25839d4
JA
1896 {
1897 .name = "random_distribution",
1898 .type = FIO_OPT_STR,
1899 .off1 = td_var_offset(random_distribution),
1900 .cb = str_random_distribution_cb,
1901 .help = "Random offset distribution generator",
1902 .def = "random",
1903 .posval = {
1904 { .ival = "random",
1905 .oval = FIO_RAND_DIST_RANDOM,
1906 .help = "Completely random",
1907 },
1908 { .ival = "zipf",
1909 .oval = FIO_RAND_DIST_ZIPF,
1910 .help = "Zipf distribution",
1911 },
925fee33
JA
1912 { .ival = "pareto",
1913 .oval = FIO_RAND_DIST_PARETO,
1914 .help = "Pareto distribution",
1915 },
e25839d4 1916 },
48107598
JA
1917 .category = FIO_OPT_C_IO,
1918 .group = FIO_OPT_G_RANDOM,
e25839d4 1919 },
211c9b89
JA
1920 {
1921 .name = "percentage_random",
1922 .lname = "Percentage Random",
1923 .type = FIO_OPT_INT,
d9472271
JA
1924 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1925 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1926 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
211c9b89
JA
1927 .maxval = 100,
1928 .help = "Percentage of seq/random mix that should be random",
d9472271 1929 .def = "100,100,100",
211c9b89
JA
1930 .interval = 5,
1931 .inverse = "percentage_sequential",
1932 .category = FIO_OPT_C_IO,
1933 .group = FIO_OPT_G_RANDOM,
1934 },
1935 {
1936 .name = "percentage_sequential",
1937 .lname = "Percentage Sequential",
d9472271 1938 .type = FIO_OPT_DEPRECATED,
211c9b89
JA
1939 .category = FIO_OPT_C_IO,
1940 .group = FIO_OPT_G_RANDOM,
1941 },
56e2a5fc
CE
1942 {
1943 .name = "allrandrepeat",
1944 .type = FIO_OPT_BOOL,
1945 .off1 = td_var_offset(allrand_repeatable),
1946 .help = "Use repeatable random numbers for everything",
1947 .def = "0",
a869d9c6
JA
1948 .category = FIO_OPT_C_IO,
1949 .group = FIO_OPT_G_RANDOM,
56e2a5fc 1950 },
214e1eca
JA
1951 {
1952 .name = "nrfiles",
e8b0e958 1953 .lname = "Number of files",
d7c8be03 1954 .alias = "nr_files",
214e1eca
JA
1955 .type = FIO_OPT_INT,
1956 .off1 = td_var_offset(nr_files),
1957 .help = "Split job workload between this number of files",
1958 .def = "1",
20eb06bd 1959 .interval = 1,
e8b0e958
JA
1960 .category = FIO_OPT_C_FILE,
1961 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1962 },
1963 {
1964 .name = "openfiles",
e8b0e958 1965 .lname = "Number of open files",
214e1eca
JA
1966 .type = FIO_OPT_INT,
1967 .off1 = td_var_offset(open_files),
1968 .help = "Number of files to keep open at the same time",
e8b0e958
JA
1969 .category = FIO_OPT_C_FILE,
1970 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1971 },
1972 {
1973 .name = "file_service_type",
e8b0e958 1974 .lname = "File service type",
214e1eca
JA
1975 .type = FIO_OPT_STR,
1976 .cb = str_fst_cb,
1977 .off1 = td_var_offset(file_service_type),
1978 .help = "How to select which file to service next",
1979 .def = "roundrobin",
e8b0e958
JA
1980 .category = FIO_OPT_C_FILE,
1981 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1982 .posval = {
1983 { .ival = "random",
1984 .oval = FIO_FSERVICE_RANDOM,
1985 .help = "Choose a file at random",
1986 },
1987 { .ival = "roundrobin",
1988 .oval = FIO_FSERVICE_RR,
1989 .help = "Round robin select files",
1990 },
a086c257
JA
1991 { .ival = "sequential",
1992 .oval = FIO_FSERVICE_SEQ,
1993 .help = "Finish one file before moving to the next",
1994 },
214e1eca 1995 },
67a1000f 1996 .parent = "nrfiles",
d71c154c 1997 .hide = 1,
67a1000f 1998 },
97ac992c 1999#ifdef CONFIG_POSIX_FALLOCATE
7bc8c2cf
JA
2000 {
2001 .name = "fallocate",
e8b0e958 2002 .lname = "Fallocate",
a596f047
EG
2003 .type = FIO_OPT_STR,
2004 .off1 = td_var_offset(fallocate_mode),
2005 .help = "Whether pre-allocation is performed when laying out files",
2006 .def = "posix",
e8b0e958
JA
2007 .category = FIO_OPT_C_FILE,
2008 .group = FIO_OPT_G_INVALID,
a596f047
EG
2009 .posval = {
2010 { .ival = "none",
2011 .oval = FIO_FALLOCATE_NONE,
2012 .help = "Do not pre-allocate space",
2013 },
2014 { .ival = "posix",
2015 .oval = FIO_FALLOCATE_POSIX,
2016 .help = "Use posix_fallocate()",
2017 },
97ac992c 2018#ifdef CONFIG_LINUX_FALLOCATE
a596f047
EG
2019 { .ival = "keep",
2020 .oval = FIO_FALLOCATE_KEEP_SIZE,
2021 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2022 },
7bc8c2cf 2023#endif
a596f047
EG
2024 /* Compatibility with former boolean values */
2025 { .ival = "0",
2026 .oval = FIO_FALLOCATE_NONE,
2027 .help = "Alias for 'none'",
2028 },
2029 { .ival = "1",
2030 .oval = FIO_FALLOCATE_POSIX,
2031 .help = "Alias for 'posix'",
2032 },
2033 },
2034 },
97ac992c 2035#endif /* CONFIG_POSIX_FALLOCATE */
67a1000f
JA
2036 {
2037 .name = "fadvise_hint",
e8b0e958 2038 .lname = "Fadvise hint",
67a1000f
JA
2039 .type = FIO_OPT_BOOL,
2040 .off1 = td_var_offset(fadvise_hint),
2041 .help = "Use fadvise() to advise the kernel on IO pattern",
2042 .def = "1",
e8b0e958
JA
2043 .category = FIO_OPT_C_FILE,
2044 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2045 },
2046 {
2047 .name = "fsync",
e8b0e958 2048 .lname = "Fsync",
214e1eca
JA
2049 .type = FIO_OPT_INT,
2050 .off1 = td_var_offset(fsync_blocks),
2051 .help = "Issue fsync for writes every given number of blocks",
2052 .def = "0",
20eb06bd 2053 .interval = 1,
e8b0e958
JA
2054 .category = FIO_OPT_C_FILE,
2055 .group = FIO_OPT_G_INVALID,
214e1eca 2056 },
5f9099ea
JA
2057 {
2058 .name = "fdatasync",
e8b0e958 2059 .lname = "Fdatasync",
5f9099ea
JA
2060 .type = FIO_OPT_INT,
2061 .off1 = td_var_offset(fdatasync_blocks),
2062 .help = "Issue fdatasync for writes every given number of blocks",
2063 .def = "0",
20eb06bd 2064 .interval = 1,
e8b0e958
JA
2065 .category = FIO_OPT_C_FILE,
2066 .group = FIO_OPT_G_INVALID,
5f9099ea 2067 },
1ef2b6be
JA
2068 {
2069 .name = "write_barrier",
e8b0e958 2070 .lname = "Write barrier",
1ef2b6be
JA
2071 .type = FIO_OPT_INT,
2072 .off1 = td_var_offset(barrier_blocks),
2073 .help = "Make every Nth write a barrier write",
2074 .def = "0",
20eb06bd 2075 .interval = 1,
e8b0e958
JA
2076 .category = FIO_OPT_C_IO,
2077 .group = FIO_OPT_G_INVALID,
1ef2b6be 2078 },
67bf9823 2079#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
2080 {
2081 .name = "sync_file_range",
e8b0e958 2082 .lname = "Sync file range",
44f29692
JA
2083 .posval = {
2084 { .ival = "wait_before",
2085 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2086 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
ebadc0ce 2087 .orval = 1,
44f29692
JA
2088 },
2089 { .ival = "write",
2090 .oval = SYNC_FILE_RANGE_WRITE,
2091 .help = "SYNC_FILE_RANGE_WRITE",
ebadc0ce 2092 .orval = 1,
44f29692
JA
2093 },
2094 {
2095 .ival = "wait_after",
2096 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2097 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
ebadc0ce 2098 .orval = 1,
44f29692
JA
2099 },
2100 },
3843deb3 2101 .type = FIO_OPT_STR_MULTI,
44f29692
JA
2102 .cb = str_sfr_cb,
2103 .off1 = td_var_offset(sync_file_range),
2104 .help = "Use sync_file_range()",
e8b0e958
JA
2105 .category = FIO_OPT_C_FILE,
2106 .group = FIO_OPT_G_INVALID,
44f29692
JA
2107 },
2108#endif
214e1eca
JA
2109 {
2110 .name = "direct",
e8b0e958 2111 .lname = "Direct I/O",
214e1eca
JA
2112 .type = FIO_OPT_BOOL,
2113 .off1 = td_var_offset(odirect),
2114 .help = "Use O_DIRECT IO (negates buffered)",
2115 .def = "0",
a01a1bc5 2116 .inverse = "buffered",
e8b0e958 2117 .category = FIO_OPT_C_IO,
3ceb458f 2118 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2119 },
d01612f3
CM
2120 {
2121 .name = "atomic",
2122 .lname = "Atomic I/O",
2123 .type = FIO_OPT_BOOL,
2124 .off1 = td_var_offset(oatomic),
2125 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2126 .def = "0",
2127 .category = FIO_OPT_C_IO,
2128 .group = FIO_OPT_G_IO_TYPE,
2129 },
214e1eca
JA
2130 {
2131 .name = "buffered",
e8b0e958 2132 .lname = "Buffered I/O",
214e1eca
JA
2133 .type = FIO_OPT_BOOL,
2134 .off1 = td_var_offset(odirect),
2135 .neg = 1,
2136 .help = "Use buffered IO (negates direct)",
2137 .def = "1",
a01a1bc5 2138 .inverse = "direct",
e8b0e958 2139 .category = FIO_OPT_C_IO,
3ceb458f 2140 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2141 },
2142 {
2143 .name = "overwrite",
e8b0e958 2144 .lname = "Overwrite",
214e1eca
JA
2145 .type = FIO_OPT_BOOL,
2146 .off1 = td_var_offset(overwrite),
2147 .help = "When writing, set whether to overwrite current data",
2148 .def = "0",
e8b0e958
JA
2149 .category = FIO_OPT_C_FILE,
2150 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2151 },
2152 {
2153 .name = "loops",
e8b0e958 2154 .lname = "Loops",
214e1eca
JA
2155 .type = FIO_OPT_INT,
2156 .off1 = td_var_offset(loops),
2157 .help = "Number of times to run the job",
2158 .def = "1",
20eb06bd 2159 .interval = 1,
e8b0e958 2160 .category = FIO_OPT_C_GENERAL,
a1f6afec 2161 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2162 },
2163 {
2164 .name = "numjobs",
e8b0e958 2165 .lname = "Number of jobs",
214e1eca
JA
2166 .type = FIO_OPT_INT,
2167 .off1 = td_var_offset(numjobs),
2168 .help = "Duplicate this job this many times",
2169 .def = "1",
20eb06bd 2170 .interval = 1,
e8b0e958 2171 .category = FIO_OPT_C_GENERAL,
a1f6afec 2172 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2173 },
2174 {
2175 .name = "startdelay",
e8b0e958 2176 .lname = "Start delay",
a5737c93 2177 .type = FIO_OPT_STR_VAL_TIME,
214e1eca 2178 .off1 = td_var_offset(start_delay),
23ed19b0 2179 .off2 = td_var_offset(start_delay_high),
214e1eca
JA
2180 .help = "Only start job when this period has passed",
2181 .def = "0",
0de5b26f 2182 .is_seconds = 1,
e8b0e958 2183 .category = FIO_OPT_C_GENERAL,
a1f6afec 2184 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2185 },
2186 {
2187 .name = "runtime",
e8b0e958 2188 .lname = "Runtime",
214e1eca
JA
2189 .alias = "timeout",
2190 .type = FIO_OPT_STR_VAL_TIME,
2191 .off1 = td_var_offset(timeout),
2192 .help = "Stop workload when this amount of time has passed",
2193 .def = "0",
0de5b26f 2194 .is_seconds = 1,
e8b0e958 2195 .category = FIO_OPT_C_GENERAL,
a1f6afec 2196 .group = FIO_OPT_G_RUNTIME,
214e1eca 2197 },
cf4464ca
JA
2198 {
2199 .name = "time_based",
e8b0e958 2200 .lname = "Time based",
cf4464ca
JA
2201 .type = FIO_OPT_STR_SET,
2202 .off1 = td_var_offset(time_based),
2203 .help = "Keep running until runtime/timeout is met",
e8b0e958 2204 .category = FIO_OPT_C_GENERAL,
a1f6afec 2205 .group = FIO_OPT_G_RUNTIME,
cf4464ca 2206 },
62167762
JC
2207 {
2208 .name = "verify_only",
2209 .lname = "Verify only",
2210 .type = FIO_OPT_STR_SET,
2211 .off1 = td_var_offset(verify_only),
2212 .help = "Verifies previously written data is still valid",
2213 .category = FIO_OPT_C_GENERAL,
2214 .group = FIO_OPT_G_RUNTIME,
2215 },
721938ae
JA
2216 {
2217 .name = "ramp_time",
e8b0e958 2218 .lname = "Ramp time",
721938ae
JA
2219 .type = FIO_OPT_STR_VAL_TIME,
2220 .off1 = td_var_offset(ramp_time),
2221 .help = "Ramp up time before measuring performance",
0de5b26f 2222 .is_seconds = 1,
e8b0e958 2223 .category = FIO_OPT_C_GENERAL,
a1f6afec 2224 .group = FIO_OPT_G_RUNTIME,
721938ae 2225 },
c223da83
JA
2226 {
2227 .name = "clocksource",
e8b0e958 2228 .lname = "Clock source",
c223da83
JA
2229 .type = FIO_OPT_STR,
2230 .cb = fio_clock_source_cb,
2231 .off1 = td_var_offset(clocksource),
2232 .help = "What type of timing source to use",
e8b0e958 2233 .category = FIO_OPT_C_GENERAL,
10860056 2234 .group = FIO_OPT_G_CLOCK,
c223da83 2235 .posval = {
67bf9823 2236#ifdef CONFIG_GETTIMEOFDAY
c223da83
JA
2237 { .ival = "gettimeofday",
2238 .oval = CS_GTOD,
2239 .help = "Use gettimeofday(2) for timing",
2240 },
67bf9823
JA
2241#endif
2242#ifdef CONFIG_CLOCK_GETTIME
c223da83
JA
2243 { .ival = "clock_gettime",
2244 .oval = CS_CGETTIME,
2245 .help = "Use clock_gettime(2) for timing",
2246 },
67bf9823 2247#endif
c223da83
JA
2248#ifdef ARCH_HAVE_CPU_CLOCK
2249 { .ival = "cpu",
2250 .oval = CS_CPUCLOCK,
2251 .help = "Use CPU private clock",
2252 },
2253#endif
2254 },
2255 },
214e1eca
JA
2256 {
2257 .name = "mem",
d3aad8f2 2258 .alias = "iomem",
e8b0e958 2259 .lname = "I/O Memory",
214e1eca
JA
2260 .type = FIO_OPT_STR,
2261 .cb = str_mem_cb,
2262 .off1 = td_var_offset(mem_type),
2263 .help = "Backing type for IO buffers",
2264 .def = "malloc",
e8b0e958
JA
2265 .category = FIO_OPT_C_IO,
2266 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2267 .posval = {
2268 { .ival = "malloc",
2269 .oval = MEM_MALLOC,
2270 .help = "Use malloc(3) for IO buffers",
2271 },
c8931876 2272#ifndef CONFIG_NO_SHM
37c8cdfe
JA
2273 { .ival = "shm",
2274 .oval = MEM_SHM,
2275 .help = "Use shared memory segments for IO buffers",
2276 },
214e1eca
JA
2277#ifdef FIO_HAVE_HUGETLB
2278 { .ival = "shmhuge",
2279 .oval = MEM_SHMHUGE,
2280 .help = "Like shm, but use huge pages",
2281 },
c8931876 2282#endif
b370e46a 2283#endif
37c8cdfe
JA
2284 { .ival = "mmap",
2285 .oval = MEM_MMAP,
2286 .help = "Use mmap(2) (file or anon) for IO buffers",
2287 },
214e1eca
JA
2288#ifdef FIO_HAVE_HUGETLB
2289 { .ival = "mmaphuge",
2290 .oval = MEM_MMAPHUGE,
2291 .help = "Like mmap, but use huge pages",
2292 },
2293#endif
2294 },
2295 },
d529ee19
JA
2296 {
2297 .name = "iomem_align",
2298 .alias = "mem_align",
e8b0e958 2299 .lname = "I/O memory alignment",
d529ee19
JA
2300 .type = FIO_OPT_INT,
2301 .off1 = td_var_offset(mem_align),
2302 .minval = 0,
2303 .help = "IO memory buffer offset alignment",
2304 .def = "0",
2305 .parent = "iomem",
d71c154c 2306 .hide = 1,
e8b0e958
JA
2307 .category = FIO_OPT_C_IO,
2308 .group = FIO_OPT_G_INVALID,
d529ee19 2309 },
214e1eca
JA
2310 {
2311 .name = "verify",
e8b0e958 2312 .lname = "Verify",
214e1eca
JA
2313 .type = FIO_OPT_STR,
2314 .off1 = td_var_offset(verify),
2315 .help = "Verify data written",
2316 .def = "0",
e8b0e958 2317 .category = FIO_OPT_C_IO,
3ceb458f 2318 .group = FIO_OPT_G_VERIFY,
214e1eca
JA
2319 .posval = {
2320 { .ival = "0",
2321 .oval = VERIFY_NONE,
2322 .help = "Don't do IO verification",
2323 },
fcca4b58
JA
2324 { .ival = "md5",
2325 .oval = VERIFY_MD5,
2326 .help = "Use md5 checksums for verification",
2327 },
d77a7af3
JA
2328 { .ival = "crc64",
2329 .oval = VERIFY_CRC64,
2330 .help = "Use crc64 checksums for verification",
2331 },
214e1eca
JA
2332 { .ival = "crc32",
2333 .oval = VERIFY_CRC32,
2334 .help = "Use crc32 checksums for verification",
2335 },
af497e6a 2336 { .ival = "crc32c-intel",
e3aaafc4
JA
2337 .oval = VERIFY_CRC32C,
2338 .help = "Use crc32c checksums for verification (hw assisted, if available)",
af497e6a 2339 },
bac39e0e
JA
2340 { .ival = "crc32c",
2341 .oval = VERIFY_CRC32C,
e3aaafc4 2342 .help = "Use crc32c checksums for verification (hw assisted, if available)",
bac39e0e 2343 },
969f7ed3
JA
2344 { .ival = "crc16",
2345 .oval = VERIFY_CRC16,
2346 .help = "Use crc16 checksums for verification",
2347 },
1e154bdb
JA
2348 { .ival = "crc7",
2349 .oval = VERIFY_CRC7,
2350 .help = "Use crc7 checksums for verification",
2351 },
7c353ceb
JA
2352 { .ival = "sha1",
2353 .oval = VERIFY_SHA1,
2354 .help = "Use sha1 checksums for verification",
2355 },
cd14cc10
JA
2356 { .ival = "sha256",
2357 .oval = VERIFY_SHA256,
2358 .help = "Use sha256 checksums for verification",
2359 },
2360 { .ival = "sha512",
2361 .oval = VERIFY_SHA512,
2362 .help = "Use sha512 checksums for verification",
2363 },
844ea602
JA
2364 { .ival = "xxhash",
2365 .oval = VERIFY_XXHASH,
2366 .help = "Use xxhash checksums for verification",
2367 },
7437ee87
SL
2368 { .ival = "meta",
2369 .oval = VERIFY_META,
2370 .help = "Use io information",
2371 },
36690c9b
JA
2372 {
2373 .ival = "null",
2374 .oval = VERIFY_NULL,
2375 .help = "Pretend to verify",
2376 },
214e1eca
JA
2377 },
2378 },
005c565a
JA
2379 {
2380 .name = "do_verify",
e8b0e958 2381 .lname = "Perform verify step",
68e1f29a 2382 .type = FIO_OPT_BOOL,
005c565a
JA
2383 .off1 = td_var_offset(do_verify),
2384 .help = "Run verification stage after write",
2385 .def = "1",
2386 .parent = "verify",
d71c154c 2387 .hide = 1,
e8b0e958
JA
2388 .category = FIO_OPT_C_IO,
2389 .group = FIO_OPT_G_VERIFY,
005c565a 2390 },
160b966d
JA
2391 {
2392 .name = "verifysort",
e8b0e958 2393 .lname = "Verify sort",
160b966d
JA
2394 .type = FIO_OPT_BOOL,
2395 .off1 = td_var_offset(verifysort),
2396 .help = "Sort written verify blocks for read back",
2397 .def = "1",
c83f2df1 2398 .parent = "verify",
d71c154c 2399 .hide = 1,
e8b0e958
JA
2400 .category = FIO_OPT_C_IO,
2401 .group = FIO_OPT_G_VERIFY,
160b966d 2402 },
1ae83d45
JA
2403 {
2404 .name = "verifysort_nr",
2405 .type = FIO_OPT_INT,
2406 .off1 = td_var_offset(verifysort_nr),
2407 .help = "Pre-load and sort verify blocks for a read workload",
2408 .minval = 0,
2409 .maxval = 131072,
2410 .def = "1024",
2411 .parent = "verify",
836fcc0f
JA
2412 .category = FIO_OPT_C_IO,
2413 .group = FIO_OPT_G_VERIFY,
1ae83d45 2414 },
3f9f4e26 2415 {
a59e170d 2416 .name = "verify_interval",
e8b0e958 2417 .lname = "Verify interval",
e01b22b8 2418 .type = FIO_OPT_INT,
a59e170d 2419 .off1 = td_var_offset(verify_interval),
819a9680 2420 .minval = 2 * sizeof(struct verify_header),
a59e170d 2421 .help = "Store verify buffer header every N bytes",
afdf9352 2422 .parent = "verify",
d71c154c 2423 .hide = 1,
20eb06bd 2424 .interval = 2 * sizeof(struct verify_header),
e8b0e958
JA
2425 .category = FIO_OPT_C_IO,
2426 .group = FIO_OPT_G_VERIFY,
3f9f4e26 2427 },
546a9142 2428 {
a59e170d 2429 .name = "verify_offset",
e8b0e958 2430 .lname = "Verify offset",
e01b22b8 2431 .type = FIO_OPT_INT,
a59e170d 2432 .help = "Offset verify header location by N bytes",
203160d5
JA
2433 .off1 = td_var_offset(verify_offset),
2434 .minval = sizeof(struct verify_header),
afdf9352 2435 .parent = "verify",
d71c154c 2436 .hide = 1,
e8b0e958
JA
2437 .category = FIO_OPT_C_IO,
2438 .group = FIO_OPT_G_VERIFY,
546a9142 2439 },
e28218f3
SL
2440 {
2441 .name = "verify_pattern",
e8b0e958 2442 .lname = "Verify pattern",
0e92f873 2443 .type = FIO_OPT_STR,
e28218f3
SL
2444 .cb = str_verify_pattern_cb,
2445 .help = "Fill pattern for IO buffers",
2446 .parent = "verify",
d71c154c 2447 .hide = 1,
e8b0e958
JA
2448 .category = FIO_OPT_C_IO,
2449 .group = FIO_OPT_G_VERIFY,
e28218f3 2450 },
a12a3b4d
JA
2451 {
2452 .name = "verify_fatal",
e8b0e958 2453 .lname = "Verify fatal",
68e1f29a 2454 .type = FIO_OPT_BOOL,
a12a3b4d
JA
2455 .off1 = td_var_offset(verify_fatal),
2456 .def = "0",
2457 .help = "Exit on a single verify failure, don't continue",
2458 .parent = "verify",
d71c154c 2459 .hide = 1,
e8b0e958
JA
2460 .category = FIO_OPT_C_IO,
2461 .group = FIO_OPT_G_VERIFY,
a12a3b4d 2462 },
b463e936
JA
2463 {
2464 .name = "verify_dump",
e8b0e958 2465 .lname = "Verify dump",
b463e936
JA
2466 .type = FIO_OPT_BOOL,
2467 .off1 = td_var_offset(verify_dump),
ef71e317 2468 .def = "0",
b463e936
JA
2469 .help = "Dump contents of good and bad blocks on failure",
2470 .parent = "verify",
d71c154c 2471 .hide = 1,
e8b0e958
JA
2472 .category = FIO_OPT_C_IO,
2473 .group = FIO_OPT_G_VERIFY,
b463e936 2474 },
e8462bd8
JA
2475 {
2476 .name = "verify_async",
e8b0e958 2477 .lname = "Verify asynchronously",
e8462bd8
JA
2478 .type = FIO_OPT_INT,
2479 .off1 = td_var_offset(verify_async),
2480 .def = "0",
2481 .help = "Number of async verifier threads to use",
2482 .parent = "verify",
d71c154c 2483 .hide = 1,
e8b0e958
JA
2484 .category = FIO_OPT_C_IO,
2485 .group = FIO_OPT_G_VERIFY,
e8462bd8 2486 },
9e144189
JA
2487 {
2488 .name = "verify_backlog",
e8b0e958 2489 .lname = "Verify backlog",
9e144189
JA
2490 .type = FIO_OPT_STR_VAL,
2491 .off1 = td_var_offset(verify_backlog),
2492 .help = "Verify after this number of blocks are written",
2493 .parent = "verify",
d71c154c 2494 .hide = 1,
e8b0e958
JA
2495 .category = FIO_OPT_C_IO,
2496 .group = FIO_OPT_G_VERIFY,
9e144189
JA
2497 },
2498 {
2499 .name = "verify_backlog_batch",
e8b0e958 2500 .lname = "Verify backlog batch",
9e144189
JA
2501 .type = FIO_OPT_INT,
2502 .off1 = td_var_offset(verify_batch),
2503 .help = "Verify this number of IO blocks",
0d29de83 2504 .parent = "verify",
d71c154c 2505 .hide = 1,
e8b0e958
JA
2506 .category = FIO_OPT_C_IO,
2507 .group = FIO_OPT_G_VERIFY,
9e144189 2508 },
e8462bd8
JA
2509#ifdef FIO_HAVE_CPU_AFFINITY
2510 {
2511 .name = "verify_async_cpus",
e8b0e958 2512 .lname = "Async verify CPUs",
e8462bd8
JA
2513 .type = FIO_OPT_STR,
2514 .cb = str_verify_cpus_allowed_cb,
2515 .help = "Set CPUs allowed for async verify threads",
2516 .parent = "verify_async",
d71c154c 2517 .hide = 1,
e8b0e958
JA
2518 .category = FIO_OPT_C_IO,
2519 .group = FIO_OPT_G_VERIFY,
e8462bd8 2520 },
0d29de83 2521#endif
51aa2da8
JA
2522 {
2523 .name = "experimental_verify",
2524 .off1 = td_var_offset(experimental_verify),
2525 .type = FIO_OPT_BOOL,
b31eaac9 2526 .help = "Enable experimental verification",
836fcc0f
JA
2527 .category = FIO_OPT_C_IO,
2528 .group = FIO_OPT_G_VERIFY,
51aa2da8 2529 },
0d29de83
JA
2530#ifdef FIO_HAVE_TRIM
2531 {
2532 .name = "trim_percentage",
e8b0e958 2533 .lname = "Trim percentage",
0d29de83 2534 .type = FIO_OPT_INT,
203160d5 2535 .off1 = td_var_offset(trim_percentage),
20eb06bd 2536 .minval = 0,
0d29de83
JA
2537 .maxval = 100,
2538 .help = "Number of verify blocks to discard/trim",
2539 .parent = "verify",
2540 .def = "0",
20eb06bd 2541 .interval = 1,
d71c154c 2542 .hide = 1,
e8b0e958
JA
2543 .category = FIO_OPT_C_IO,
2544 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2545 },
2546 {
2547 .name = "trim_verify_zero",
e8b0e958 2548 .lname = "Verify trim zero",
20eb06bd 2549 .type = FIO_OPT_BOOL,
0d29de83
JA
2550 .help = "Verify that trim/discarded blocks are returned as zeroes",
2551 .off1 = td_var_offset(trim_zero),
2552 .parent = "trim_percentage",
d71c154c 2553 .hide = 1,
0d29de83 2554 .def = "1",
e8b0e958
JA
2555 .category = FIO_OPT_C_IO,
2556 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2557 },
2558 {
2559 .name = "trim_backlog",
e8b0e958 2560 .lname = "Trim backlog",
0d29de83
JA
2561 .type = FIO_OPT_STR_VAL,
2562 .off1 = td_var_offset(trim_backlog),
2563 .help = "Trim after this number of blocks are written",
2564 .parent = "trim_percentage",
d71c154c 2565 .hide = 1,
20eb06bd 2566 .interval = 1,
e8b0e958
JA
2567 .category = FIO_OPT_C_IO,
2568 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2569 },
2570 {
2571 .name = "trim_backlog_batch",
e8b0e958 2572 .lname = "Trim backlog batch",
0d29de83
JA
2573 .type = FIO_OPT_INT,
2574 .off1 = td_var_offset(trim_batch),
2575 .help = "Trim this number of IO blocks",
2576 .parent = "trim_percentage",
d71c154c 2577 .hide = 1,
20eb06bd 2578 .interval = 1,
e8b0e958
JA
2579 .category = FIO_OPT_C_IO,
2580 .group = FIO_OPT_G_TRIM,
0d29de83 2581 },
e8462bd8 2582#endif
214e1eca
JA
2583 {
2584 .name = "write_iolog",
e8b0e958 2585 .lname = "Write I/O log",
214e1eca
JA
2586 .type = FIO_OPT_STR_STORE,
2587 .off1 = td_var_offset(write_iolog_file),
2588 .help = "Store IO pattern to file",
e8b0e958
JA
2589 .category = FIO_OPT_C_IO,
2590 .group = FIO_OPT_G_IOLOG,
214e1eca
JA
2591 },
2592 {
2593 .name = "read_iolog",
e8b0e958 2594 .lname = "Read I/O log",
214e1eca
JA
2595 .type = FIO_OPT_STR_STORE,
2596 .off1 = td_var_offset(read_iolog_file),
2597 .help = "Playback IO pattern from file",
e8b0e958
JA
2598 .category = FIO_OPT_C_IO,
2599 .group = FIO_OPT_G_IOLOG,
214e1eca 2600 },
64bbb865
DN
2601 {
2602 .name = "replay_no_stall",
e8b0e958 2603 .lname = "Don't stall on replay",
20eb06bd 2604 .type = FIO_OPT_BOOL,
64bbb865
DN
2605 .off1 = td_var_offset(no_stall),
2606 .def = "0",
87e7a972 2607 .parent = "read_iolog",
d71c154c 2608 .hide = 1,
64bbb865 2609 .help = "Playback IO pattern file as fast as possible without stalls",
e8b0e958
JA
2610 .category = FIO_OPT_C_IO,
2611 .group = FIO_OPT_G_IOLOG,
64bbb865 2612 },
d1c46c04
DN
2613 {
2614 .name = "replay_redirect",
e8b0e958 2615 .lname = "Redirect device for replay",
d1c46c04
DN
2616 .type = FIO_OPT_STR_STORE,
2617 .off1 = td_var_offset(replay_redirect),
2618 .parent = "read_iolog",
d71c154c 2619 .hide = 1,
d1c46c04 2620 .help = "Replay all I/O onto this device, regardless of trace device",
e8b0e958
JA
2621 .category = FIO_OPT_C_IO,
2622 .group = FIO_OPT_G_IOLOG,
d1c46c04 2623 },
214e1eca
JA
2624 {
2625 .name = "exec_prerun",
e8b0e958 2626 .lname = "Pre-execute runnable",
214e1eca
JA
2627 .type = FIO_OPT_STR_STORE,
2628 .off1 = td_var_offset(exec_prerun),
2629 .help = "Execute this file prior to running job",
e8b0e958
JA
2630 .category = FIO_OPT_C_GENERAL,
2631 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2632 },
2633 {
2634 .name = "exec_postrun",
e8b0e958 2635 .lname = "Post-execute runnable",
214e1eca
JA
2636 .type = FIO_OPT_STR_STORE,
2637 .off1 = td_var_offset(exec_postrun),
2638 .help = "Execute this file after running job",
e8b0e958
JA
2639 .category = FIO_OPT_C_GENERAL,
2640 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2641 },
2642#ifdef FIO_HAVE_IOSCHED_SWITCH
2643 {
2644 .name = "ioscheduler",
e8b0e958 2645 .lname = "I/O scheduler",
214e1eca
JA
2646 .type = FIO_OPT_STR_STORE,
2647 .off1 = td_var_offset(ioscheduler),
2648 .help = "Use this IO scheduler on the backing device",
e8b0e958
JA
2649 .category = FIO_OPT_C_FILE,
2650 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2651 },
2652#endif
2653 {
2654 .name = "zonesize",
e8b0e958 2655 .lname = "Zone size",
214e1eca
JA
2656 .type = FIO_OPT_STR_VAL,
2657 .off1 = td_var_offset(zone_size),
ed335855
SN
2658 .help = "Amount of data to read per zone",
2659 .def = "0",
20eb06bd 2660 .interval = 1024 * 1024,
e8b0e958
JA
2661 .category = FIO_OPT_C_IO,
2662 .group = FIO_OPT_G_ZONE,
ed335855
SN
2663 },
2664 {
2665 .name = "zonerange",
e8b0e958 2666 .lname = "Zone range",
ed335855
SN
2667 .type = FIO_OPT_STR_VAL,
2668 .off1 = td_var_offset(zone_range),
214e1eca
JA
2669 .help = "Give size of an IO zone",
2670 .def = "0",
20eb06bd 2671 .interval = 1024 * 1024,
e8b0e958
JA
2672 .category = FIO_OPT_C_IO,
2673 .group = FIO_OPT_G_ZONE,
214e1eca
JA
2674 },
2675 {
2676 .name = "zoneskip",
e8b0e958 2677 .lname = "Zone skip",
214e1eca
JA
2678 .type = FIO_OPT_STR_VAL,
2679 .off1 = td_var_offset(zone_skip),
2680 .help = "Space between IO zones",
2681 .def = "0",
20eb06bd 2682 .interval = 1024 * 1024,
e8b0e958
JA
2683 .category = FIO_OPT_C_IO,
2684 .group = FIO_OPT_G_ZONE,
214e1eca
JA
2685 },
2686 {
2687 .name = "lockmem",
e8b0e958 2688 .lname = "Lock memory",
214e1eca 2689 .type = FIO_OPT_STR_VAL,
1b79a070 2690 .off1 = td_var_offset(lockmem),
81c6b6cd 2691 .help = "Lock down this amount of memory (per worker)",
214e1eca 2692 .def = "0",
20eb06bd 2693 .interval = 1024 * 1024,
e8b0e958
JA
2694 .category = FIO_OPT_C_GENERAL,
2695 .group = FIO_OPT_G_INVALID,
214e1eca 2696 },
214e1eca
JA
2697 {
2698 .name = "rwmixread",
e8b0e958 2699 .lname = "Read/write mix read",
214e1eca 2700 .type = FIO_OPT_INT,
cb499fc4 2701 .cb = str_rwmix_read_cb,
214e1eca
JA
2702 .maxval = 100,
2703 .help = "Percentage of mixed workload that is reads",
2704 .def = "50",
20eb06bd 2705 .interval = 5,
90265353 2706 .inverse = "rwmixwrite",
e8b0e958
JA
2707 .category = FIO_OPT_C_IO,
2708 .group = FIO_OPT_G_RWMIX,
214e1eca
JA
2709 },
2710 {
2711 .name = "rwmixwrite",
e8b0e958 2712 .lname = "Read/write mix write",
214e1eca 2713 .type = FIO_OPT_INT,
cb499fc4 2714 .cb = str_rwmix_write_cb,
214e1eca
JA
2715 .maxval = 100,
2716 .help = "Percentage of mixed workload that is writes",
2717 .def = "50",
20eb06bd 2718 .interval = 5,
90265353 2719 .inverse = "rwmixread",
e8b0e958
JA
2720 .category = FIO_OPT_C_IO,
2721 .group = FIO_OPT_G_RWMIX,
214e1eca 2722 },
afdf9352
JA
2723 {
2724 .name = "rwmixcycle",
e8b0e958 2725 .lname = "Read/write mix cycle",
15ca150e 2726 .type = FIO_OPT_DEPRECATED,
e8b0e958
JA
2727 .category = FIO_OPT_C_IO,
2728 .group = FIO_OPT_G_RWMIX,
afdf9352 2729 },
214e1eca
JA
2730 {
2731 .name = "nice",
e8b0e958 2732 .lname = "Nice",
214e1eca
JA
2733 .type = FIO_OPT_INT,
2734 .off1 = td_var_offset(nice),
2735 .help = "Set job CPU nice value",
2736 .minval = -19,
2737 .maxval = 20,
2738 .def = "0",
20eb06bd 2739 .interval = 1,
e8b0e958 2740 .category = FIO_OPT_C_GENERAL,
10860056 2741 .group = FIO_OPT_G_CRED,
214e1eca
JA
2742 },
2743#ifdef FIO_HAVE_IOPRIO
2744 {
2745 .name = "prio",
e8b0e958 2746 .lname = "I/O nice priority",
214e1eca 2747 .type = FIO_OPT_INT,
28727df7 2748 .off1 = td_var_offset(ioprio),
214e1eca
JA
2749 .help = "Set job IO priority value",
2750 .minval = 0,
2751 .maxval = 7,
20eb06bd 2752 .interval = 1,
e8b0e958 2753 .category = FIO_OPT_C_GENERAL,
10860056 2754 .group = FIO_OPT_G_CRED,
214e1eca
JA
2755 },
2756 {
2757 .name = "prioclass",
e8b0e958 2758 .lname = "I/O nice priority class",
214e1eca 2759 .type = FIO_OPT_INT,
28727df7 2760 .off1 = td_var_offset(ioprio_class),
214e1eca
JA
2761 .help = "Set job IO priority class",
2762 .minval = 0,
2763 .maxval = 3,
20eb06bd 2764 .interval = 1,
e8b0e958 2765 .category = FIO_OPT_C_GENERAL,
10860056 2766 .group = FIO_OPT_G_CRED,
214e1eca
JA
2767 },
2768#endif
2769 {
2770 .name = "thinktime",
e8b0e958 2771 .lname = "Thinktime",
214e1eca
JA
2772 .type = FIO_OPT_INT,
2773 .off1 = td_var_offset(thinktime),
2774 .help = "Idle time between IO buffers (usec)",
2775 .def = "0",
e8b0e958 2776 .category = FIO_OPT_C_IO,
3ceb458f 2777 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2778 },
2779 {
2780 .name = "thinktime_spin",
e8b0e958 2781 .lname = "Thinktime spin",
214e1eca
JA
2782 .type = FIO_OPT_INT,
2783 .off1 = td_var_offset(thinktime_spin),
2784 .help = "Start think time by spinning this amount (usec)",
2785 .def = "0",
afdf9352 2786 .parent = "thinktime",
d71c154c 2787 .hide = 1,
e8b0e958 2788 .category = FIO_OPT_C_IO,
3ceb458f 2789 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2790 },
2791 {
2792 .name = "thinktime_blocks",
e8b0e958 2793 .lname = "Thinktime blocks",
214e1eca
JA
2794 .type = FIO_OPT_INT,
2795 .off1 = td_var_offset(thinktime_blocks),
2796 .help = "IO buffer period between 'thinktime'",
2797 .def = "1",
afdf9352 2798 .parent = "thinktime",
d71c154c 2799 .hide = 1,
e8b0e958 2800 .category = FIO_OPT_C_IO,
3ceb458f 2801 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2802 },
2803 {
2804 .name = "rate",
e8b0e958 2805 .lname = "I/O rate",
e01b22b8 2806 .type = FIO_OPT_INT,
6eaf09d6
SL
2807 .off1 = td_var_offset(rate[DDIR_READ]),
2808 .off2 = td_var_offset(rate[DDIR_WRITE]),
2809 .off3 = td_var_offset(rate[DDIR_TRIM]),
214e1eca 2810 .help = "Set bandwidth rate",
e8b0e958
JA
2811 .category = FIO_OPT_C_IO,
2812 .group = FIO_OPT_G_RATE,
214e1eca
JA
2813 },
2814 {
2815 .name = "ratemin",
e8b0e958 2816 .lname = "I/O min rate",
e01b22b8 2817 .type = FIO_OPT_INT,
6eaf09d6
SL
2818 .off1 = td_var_offset(ratemin[DDIR_READ]),
2819 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2820 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
4e991c23 2821 .help = "Job must meet this rate or it will be shutdown",
afdf9352 2822 .parent = "rate",
d71c154c 2823 .hide = 1,
e8b0e958
JA
2824 .category = FIO_OPT_C_IO,
2825 .group = FIO_OPT_G_RATE,
4e991c23
JA
2826 },
2827 {
2828 .name = "rate_iops",
e8b0e958 2829 .lname = "I/O rate IOPS",
e01b22b8 2830 .type = FIO_OPT_INT,
6eaf09d6
SL
2831 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2832 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2833 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
4e991c23 2834 .help = "Limit IO used to this number of IO operations/sec",
d71c154c 2835 .hide = 1,
e8b0e958
JA
2836 .category = FIO_OPT_C_IO,
2837 .group = FIO_OPT_G_RATE,
4e991c23
JA
2838 },
2839 {
2840 .name = "rate_iops_min",
e8b0e958 2841 .lname = "I/O min rate IOPS",
e01b22b8 2842 .type = FIO_OPT_INT,
6eaf09d6
SL
2843 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2844 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2845 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
03e20d68 2846 .help = "Job must meet this rate or it will be shut down",
afdf9352 2847 .parent = "rate_iops",
d71c154c 2848 .hide = 1,
e8b0e958
JA
2849 .category = FIO_OPT_C_IO,
2850 .group = FIO_OPT_G_RATE,
214e1eca
JA
2851 },
2852 {
2853 .name = "ratecycle",
e8b0e958 2854 .lname = "I/O rate cycle",
214e1eca
JA
2855 .type = FIO_OPT_INT,
2856 .off1 = td_var_offset(ratecycle),
2857 .help = "Window average for rate limits (msec)",
2858 .def = "1000",
afdf9352 2859 .parent = "rate",
d71c154c 2860 .hide = 1,
e8b0e958
JA
2861 .category = FIO_OPT_C_IO,
2862 .group = FIO_OPT_G_RATE,
214e1eca 2863 },
15501535
JA
2864 {
2865 .name = "max_latency",
2866 .type = FIO_OPT_INT,
2867 .off1 = td_var_offset(max_latency),
2868 .help = "Maximum tolerated IO latency (usec)",
1e5324e7 2869 .category = FIO_OPT_C_IO,
3e260a46
JA
2870 .group = FIO_OPT_G_LATPROF,
2871 },
2872 {
2873 .name = "latency_target",
2874 .lname = "Latency Target (usec)",
2875 .type = FIO_OPT_STR_VAL_TIME,
2876 .off1 = td_var_offset(latency_target),
2877 .help = "Ramp to max queue depth supporting this latency",
2878 .category = FIO_OPT_C_IO,
2879 .group = FIO_OPT_G_LATPROF,
2880 },
2881 {
2882 .name = "latency_window",
2883 .lname = "Latency Window (usec)",
2884 .type = FIO_OPT_STR_VAL_TIME,
2885 .off1 = td_var_offset(latency_window),
2886 .help = "Time to sustain latency_target",
2887 .category = FIO_OPT_C_IO,
2888 .group = FIO_OPT_G_LATPROF,
2889 },
2890 {
2891 .name = "latency_percentile",
2892 .lname = "Latency Percentile",
2893 .type = FIO_OPT_FLOAT_LIST,
2894 .off1 = td_var_offset(latency_percentile),
2895 .help = "Percentile of IOs must be below latency_target",
2896 .def = "100",
2897 .maxlen = 1,
2898 .minfp = 0.0,
2899 .maxfp = 100.0,
2900 .category = FIO_OPT_C_IO,
2901 .group = FIO_OPT_G_LATPROF,
15501535 2902 },
214e1eca
JA
2903 {
2904 .name = "invalidate",
e8b0e958 2905 .lname = "Cache invalidate",
214e1eca
JA
2906 .type = FIO_OPT_BOOL,
2907 .off1 = td_var_offset(invalidate_cache),
2908 .help = "Invalidate buffer/page cache prior to running job",
2909 .def = "1",
e8b0e958 2910 .category = FIO_OPT_C_IO,
3ceb458f 2911 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2912 },
2913 {
2914 .name = "sync",
e8b0e958 2915 .lname = "Synchronous I/O",
214e1eca
JA
2916 .type = FIO_OPT_BOOL,
2917 .off1 = td_var_offset(sync_io),
2918 .help = "Use O_SYNC for buffered writes",
2919 .def = "0",
67a1000f 2920 .parent = "buffered",
d71c154c 2921 .hide = 1,
e8b0e958 2922 .category = FIO_OPT_C_IO,
3ceb458f 2923 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2924 },
214e1eca
JA
2925 {
2926 .name = "create_serialize",
e8b0e958 2927 .lname = "Create serialize",
214e1eca
JA
2928 .type = FIO_OPT_BOOL,
2929 .off1 = td_var_offset(create_serialize),
2930 .help = "Serialize creating of job files",
2931 .def = "1",
e8b0e958
JA
2932 .category = FIO_OPT_C_FILE,
2933 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2934 },
2935 {
2936 .name = "create_fsync",
e8b0e958 2937 .lname = "Create fsync",
214e1eca
JA
2938 .type = FIO_OPT_BOOL,
2939 .off1 = td_var_offset(create_fsync),
03e20d68 2940 .help = "fsync file after creation",
214e1eca 2941 .def = "1",
e8b0e958
JA
2942 .category = FIO_OPT_C_FILE,
2943 .group = FIO_OPT_G_INVALID,
214e1eca 2944 },
814452bd
JA
2945 {
2946 .name = "create_on_open",
e8b0e958 2947 .lname = "Create on open",
814452bd
JA
2948 .type = FIO_OPT_BOOL,
2949 .off1 = td_var_offset(create_on_open),
2950 .help = "Create files when they are opened for IO",
2951 .def = "0",
e8b0e958
JA
2952 .category = FIO_OPT_C_FILE,
2953 .group = FIO_OPT_G_INVALID,
814452bd 2954 },
25460cf6
JA
2955 {
2956 .name = "create_only",
2957 .type = FIO_OPT_BOOL,
2958 .off1 = td_var_offset(create_only),
2959 .help = "Only perform file creation phase",
d17fda71 2960 .category = FIO_OPT_C_FILE,
25460cf6
JA
2961 .def = "0",
2962 },
0b9d69ec 2963 {
afad68f7 2964 .name = "pre_read",
e8b0e958 2965 .lname = "Pre-read files",
afad68f7
ZY
2966 .type = FIO_OPT_BOOL,
2967 .off1 = td_var_offset(pre_read),
03e20d68 2968 .help = "Pre-read files before starting official testing",
afad68f7 2969 .def = "0",
e8b0e958
JA
2970 .category = FIO_OPT_C_FILE,
2971 .group = FIO_OPT_G_INVALID,
afad68f7 2972 },
214e1eca
JA
2973#ifdef FIO_HAVE_CPU_AFFINITY
2974 {
2975 .name = "cpumask",
e8b0e958 2976 .lname = "CPU mask",
214e1eca
JA
2977 .type = FIO_OPT_INT,
2978 .cb = str_cpumask_cb,
2979 .help = "CPU affinity mask",
e8b0e958 2980 .category = FIO_OPT_C_GENERAL,
10860056 2981 .group = FIO_OPT_G_CRED,
214e1eca 2982 },
d2e268b0
JA
2983 {
2984 .name = "cpus_allowed",
e8b0e958 2985 .lname = "CPUs allowed",
d2e268b0
JA
2986 .type = FIO_OPT_STR,
2987 .cb = str_cpus_allowed_cb,
2988 .help = "Set CPUs allowed",
e8b0e958 2989 .category = FIO_OPT_C_GENERAL,
10860056 2990 .group = FIO_OPT_G_CRED,
d2e268b0 2991 },
c2acfbac
JA
2992 {
2993 .name = "cpus_allowed_policy",
2994 .lname = "CPUs allowed distribution policy",
2995 .type = FIO_OPT_STR,
2996 .off1 = td_var_offset(cpus_allowed_policy),
2997 .help = "Distribution policy for cpus_allowed",
2998 .parent = "cpus_allowed",
2999 .prio = 1,
3000 .posval = {
3001 { .ival = "shared",
3002 .oval = FIO_CPUS_SHARED,
3003 .help = "Mask shared between threads",
3004 },
3005 { .ival = "split",
3006 .oval = FIO_CPUS_SPLIT,
3007 .help = "Mask split between threads",
3008 },
3009 },
3010 .category = FIO_OPT_C_GENERAL,
3011 .group = FIO_OPT_G_CRED,
3012 },
d0b937ed 3013#endif
67bf9823 3014#ifdef CONFIG_LIBNUMA
d0b937ed
YR
3015 {
3016 .name = "numa_cpu_nodes",
3017 .type = FIO_OPT_STR,
3018 .cb = str_numa_cpunodes_cb,
3019 .help = "NUMA CPU nodes bind",
6be54b2d
JA
3020 .category = FIO_OPT_C_GENERAL,
3021 .group = FIO_OPT_G_INVALID,
d0b937ed
YR
3022 },
3023 {
3024 .name = "numa_mem_policy",
3025 .type = FIO_OPT_STR,
3026 .cb = str_numa_mpol_cb,
3027 .help = "NUMA memory policy setup",
6be54b2d
JA
3028 .category = FIO_OPT_C_GENERAL,
3029 .group = FIO_OPT_G_INVALID,
d0b937ed 3030 },
214e1eca
JA
3031#endif
3032 {
3033 .name = "end_fsync",
e8b0e958 3034 .lname = "End fsync",
214e1eca
JA
3035 .type = FIO_OPT_BOOL,
3036 .off1 = td_var_offset(end_fsync),
3037 .help = "Include fsync at the end of job",
3038 .def = "0",
e8b0e958
JA
3039 .category = FIO_OPT_C_FILE,
3040 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3041 },
3042 {
3043 .name = "fsync_on_close",
e8b0e958 3044 .lname = "Fsync on close",
214e1eca
JA
3045 .type = FIO_OPT_BOOL,
3046 .off1 = td_var_offset(fsync_on_close),
3047 .help = "fsync files on close",
3048 .def = "0",
e8b0e958
JA
3049 .category = FIO_OPT_C_FILE,
3050 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3051 },
3052 {
3053 .name = "unlink",
e8b0e958 3054 .lname = "Unlink file",
214e1eca
JA
3055 .type = FIO_OPT_BOOL,
3056 .off1 = td_var_offset(unlink),
3057 .help = "Unlink created files after job has completed",
3058 .def = "0",
e8b0e958
JA
3059 .category = FIO_OPT_C_FILE,
3060 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3061 },
3062 {
3063 .name = "exitall",
e8b0e958 3064 .lname = "Exit-all on terminate",
214e1eca
JA
3065 .type = FIO_OPT_STR_SET,
3066 .cb = str_exitall_cb,
3067 .help = "Terminate all jobs when one exits",
e8b0e958 3068 .category = FIO_OPT_C_GENERAL,
a1f6afec 3069 .group = FIO_OPT_G_PROCESS,
214e1eca
JA
3070 },
3071 {
3072 .name = "stonewall",
e8b0e958 3073 .lname = "Wait for previous",
d392365e 3074 .alias = "wait_for_previous",
214e1eca
JA
3075 .type = FIO_OPT_STR_SET,
3076 .off1 = td_var_offset(stonewall),
3077 .help = "Insert a hard barrier between this job and previous",
e8b0e958 3078 .category = FIO_OPT_C_GENERAL,
a1f6afec 3079 .group = FIO_OPT_G_PROCESS,
214e1eca 3080 },
b3d62a75
JA
3081 {
3082 .name = "new_group",
e8b0e958 3083 .lname = "New group",
b3d62a75
JA
3084 .type = FIO_OPT_STR_SET,
3085 .off1 = td_var_offset(new_group),
3086 .help = "Mark the start of a new group (for reporting)",
e8b0e958 3087 .category = FIO_OPT_C_GENERAL,
a1f6afec 3088 .group = FIO_OPT_G_PROCESS,
b3d62a75 3089 },
214e1eca
JA
3090 {
3091 .name = "thread",
e8b0e958 3092 .lname = "Thread",
214e1eca
JA
3093 .type = FIO_OPT_STR_SET,
3094 .off1 = td_var_offset(use_thread),
20eb06bd 3095 .help = "Use threads instead of processes",
c8931876
JA
3096#ifdef CONFIG_NO_SHM
3097 .def = "1",
3098 .no_warn_def = 1,
3099#endif
e8b0e958 3100 .category = FIO_OPT_C_GENERAL,
a1f6afec 3101 .group = FIO_OPT_G_PROCESS,
214e1eca
JA
3102 },
3103 {
3104 .name = "write_bw_log",
e8b0e958 3105 .lname = "Write bandwidth log",
203160d5
JA
3106 .type = FIO_OPT_STR_STORE,
3107 .off1 = td_var_offset(bw_log_file),
214e1eca 3108 .help = "Write log of bandwidth during run",
e8b0e958
JA
3109 .category = FIO_OPT_C_LOG,
3110 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3111 },
3112 {
3113 .name = "write_lat_log",
e8b0e958 3114 .lname = "Write latency log",
203160d5
JA
3115 .type = FIO_OPT_STR_STORE,
3116 .off1 = td_var_offset(lat_log_file),
214e1eca 3117 .help = "Write log of latency during run",
e8b0e958
JA
3118 .category = FIO_OPT_C_LOG,
3119 .group = FIO_OPT_G_INVALID,
214e1eca 3120 },
c8eeb9df
JA
3121 {
3122 .name = "write_iops_log",
e8b0e958 3123 .lname = "Write IOPS log",
577c83bd 3124 .type = FIO_OPT_STR_STORE,
203160d5 3125 .off1 = td_var_offset(iops_log_file),
c8eeb9df 3126 .help = "Write log of IOPS during run",
e8b0e958
JA
3127 .category = FIO_OPT_C_LOG,
3128 .group = FIO_OPT_G_INVALID,
c8eeb9df 3129 },
b8bc8cba
JA
3130 {
3131 .name = "log_avg_msec",
e8b0e958 3132 .lname = "Log averaging (msec)",
b8bc8cba
JA
3133 .type = FIO_OPT_INT,
3134 .off1 = td_var_offset(log_avg_msec),
3135 .help = "Average bw/iops/lat logs over this period of time",
3136 .def = "0",
e8b0e958
JA
3137 .category = FIO_OPT_C_LOG,
3138 .group = FIO_OPT_G_INVALID,
b8bc8cba 3139 },
ae588852
JA
3140 {
3141 .name = "log_offset",
3142 .lname = "Log offset of IO",
3143 .type = FIO_OPT_BOOL,
3144 .off1 = td_var_offset(log_offset),
3145 .help = "Include offset of IO for each log entry",
3146 .def = "0",
3147 .category = FIO_OPT_C_LOG,
3148 .group = FIO_OPT_G_INVALID,
3149 },
aee2ab67
JA
3150#ifdef CONFIG_ZLIB
3151 {
3152 .name = "log_compression",
3153 .lname = "Log compression",
3154 .type = FIO_OPT_INT,
3155 .off1 = td_var_offset(log_gz),
3156 .help = "Log in compressed chunks of this size",
3157 .minval = 32 * 1024 * 1024ULL,
3158 .maxval = 512 * 1024 * 1024ULL,
3159 .category = FIO_OPT_C_LOG,
3160 .group = FIO_OPT_G_INVALID,
3161 },
b26317c9
JA
3162 {
3163 .name = "log_store_compressed",
3164 .lname = "Log store compressed",
3165 .type = FIO_OPT_BOOL,
3166 .off1 = td_var_offset(log_gz_store),
3167 .help = "Store logs in a compressed format",
3168 .category = FIO_OPT_C_LOG,
3169 .group = FIO_OPT_G_INVALID,
3170 },
aee2ab67 3171#endif
c504ee55
JA
3172 {
3173 .name = "bwavgtime",
3174 .lname = "Bandwidth average time",
3175 .type = FIO_OPT_INT,
3176 .off1 = td_var_offset(bw_avg_time),
3177 .help = "Time window over which to calculate bandwidth"
3178 " (msec)",
3179 .def = "500",
3180 .parent = "write_bw_log",
3181 .hide = 1,
3182 .interval = 100,
3183 .category = FIO_OPT_C_LOG,
3184 .group = FIO_OPT_G_INVALID,
3185 },
3186 {
3187 .name = "iopsavgtime",
3188 .lname = "IOPS average time",
3189 .type = FIO_OPT_INT,
3190 .off1 = td_var_offset(iops_avg_time),
3191 .help = "Time window over which to calculate IOPS (msec)",
3192 .def = "500",
3193 .parent = "write_iops_log",
3194 .hide = 1,
3195 .interval = 100,
3196 .category = FIO_OPT_C_LOG,
3197 .group = FIO_OPT_G_INVALID,
3198 },
214e1eca
JA
3199 {
3200 .name = "group_reporting",
e8b0e958 3201 .lname = "Group reporting",
d2507043 3202 .type = FIO_OPT_STR_SET,
214e1eca
JA
3203 .off1 = td_var_offset(group_reporting),
3204 .help = "Do reporting on a per-group basis",
10860056 3205 .category = FIO_OPT_C_STAT,
e8b0e958 3206 .group = FIO_OPT_G_INVALID,
214e1eca 3207 },
e9459e5a
JA
3208 {
3209 .name = "zero_buffers",
e8b0e958 3210 .lname = "Zero I/O buffers",
e9459e5a
JA
3211 .type = FIO_OPT_STR_SET,
3212 .off1 = td_var_offset(zero_buffers),
3213 .help = "Init IO buffers to all zeroes",
e8b0e958 3214 .category = FIO_OPT_C_IO,
3ceb458f 3215 .group = FIO_OPT_G_IO_BUF,
e9459e5a 3216 },
5973cafb
JA
3217 {
3218 .name = "refill_buffers",
e8b0e958 3219 .lname = "Refill I/O buffers",
5973cafb
JA
3220 .type = FIO_OPT_STR_SET,
3221 .off1 = td_var_offset(refill_buffers),
3222 .help = "Refill IO buffers on every IO submit",
e8b0e958 3223 .category = FIO_OPT_C_IO,
3ceb458f 3224 .group = FIO_OPT_G_IO_BUF,
5973cafb 3225 },
fd68418e
JA
3226 {
3227 .name = "scramble_buffers",
e8b0e958 3228 .lname = "Scramble I/O buffers",
fd68418e
JA
3229 .type = FIO_OPT_BOOL,
3230 .off1 = td_var_offset(scramble_buffers),
3231 .help = "Slightly scramble buffers on every IO submit",
3232 .def = "1",
e8b0e958 3233 .category = FIO_OPT_C_IO,
3ceb458f 3234 .group = FIO_OPT_G_IO_BUF,
fd68418e 3235 },
ce35b1ec
JA
3236 {
3237 .name = "buffer_pattern",
3238 .lname = "Buffer pattern",
3239 .type = FIO_OPT_STR,
3240 .cb = str_buffer_pattern_cb,
3241 .help = "Fill pattern for IO buffers",
3242 .category = FIO_OPT_C_IO,
3243 .group = FIO_OPT_G_IO_BUF,
3244 },
9c42684e
JA
3245 {
3246 .name = "buffer_compress_percentage",
e8b0e958 3247 .lname = "Buffer compression percentage",
9c42684e 3248 .type = FIO_OPT_INT,
bedc9dc2 3249 .cb = str_buffer_compress_cb,
9c42684e 3250 .maxval = 100,
e7f5de90 3251 .minval = 0,
9c42684e 3252 .help = "How compressible the buffer is (approximately)",
20eb06bd 3253 .interval = 5,
e8b0e958 3254 .category = FIO_OPT_C_IO,
3ceb458f 3255 .group = FIO_OPT_G_IO_BUF,
9c42684e 3256 },
f97a43a1
JA
3257 {
3258 .name = "buffer_compress_chunk",
e8b0e958 3259 .lname = "Buffer compression chunk size",
f97a43a1
JA
3260 .type = FIO_OPT_INT,
3261 .off1 = td_var_offset(compress_chunk),
207b18e4 3262 .parent = "buffer_compress_percentage",
d71c154c 3263 .hide = 1,
f97a43a1 3264 .help = "Size of compressible region in buffer",
20eb06bd 3265 .interval = 256,
e8b0e958 3266 .category = FIO_OPT_C_IO,
3ceb458f 3267 .group = FIO_OPT_G_IO_BUF,
f97a43a1 3268 },
5c94b008
JA
3269 {
3270 .name = "dedupe_percentage",
3271 .lname = "Dedupe percentage",
3272 .type = FIO_OPT_INT,
3273 .cb = str_dedupe_cb,
3274 .maxval = 100,
3275 .minval = 0,
3276 .help = "Percentage of buffers that are dedupable",
3277 .interval = 1,
3278 .category = FIO_OPT_C_IO,
3279 .group = FIO_OPT_G_IO_BUF,
3280 },
83349190
YH
3281 {
3282 .name = "clat_percentiles",
e8b0e958 3283 .lname = "Completion latency percentiles",
83349190
YH
3284 .type = FIO_OPT_BOOL,
3285 .off1 = td_var_offset(clat_percentiles),
3286 .help = "Enable the reporting of completion latency percentiles",
467b35ed 3287 .def = "1",
e8b0e958
JA
3288 .category = FIO_OPT_C_STAT,
3289 .group = FIO_OPT_G_INVALID,
83349190
YH
3290 },
3291 {
3292 .name = "percentile_list",
e8b0e958 3293 .lname = "Completion latency percentile list",
83349190
YH
3294 .type = FIO_OPT_FLOAT_LIST,
3295 .off1 = td_var_offset(percentile_list),
435d195a 3296 .off2 = td_var_offset(percentile_precision),
83349190 3297 .help = "Specify a custom list of percentiles to report",
fd112d34 3298 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
83349190
YH
3299 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3300 .minfp = 0.0,
3301 .maxfp = 100.0,
e8b0e958
JA
3302 .category = FIO_OPT_C_STAT,
3303 .group = FIO_OPT_G_INVALID,
83349190
YH
3304 },
3305
0a839f30
JA
3306#ifdef FIO_HAVE_DISK_UTIL
3307 {
3308 .name = "disk_util",
e8b0e958 3309 .lname = "Disk utilization",
0a839f30
JA
3310 .type = FIO_OPT_BOOL,
3311 .off1 = td_var_offset(do_disk_util),
f66ab3c8 3312 .help = "Log disk utilization statistics",
0a839f30 3313 .def = "1",
e8b0e958
JA
3314 .category = FIO_OPT_C_STAT,
3315 .group = FIO_OPT_G_INVALID,
0a839f30
JA
3316 },
3317#endif
993bf48b
JA
3318 {
3319 .name = "gtod_reduce",
e8b0e958 3320 .lname = "Reduce gettimeofday() calls",
993bf48b
JA
3321 .type = FIO_OPT_BOOL,
3322 .help = "Greatly reduce number of gettimeofday() calls",
3323 .cb = str_gtod_reduce_cb,
3324 .def = "0",
a4ed77fe 3325 .hide_on_set = 1,
e8b0e958
JA
3326 .category = FIO_OPT_C_STAT,
3327 .group = FIO_OPT_G_INVALID,
993bf48b 3328 },
02af0988
JA
3329 {
3330 .name = "disable_lat",
e8b0e958 3331 .lname = "Disable all latency stats",
02af0988
JA
3332 .type = FIO_OPT_BOOL,
3333 .off1 = td_var_offset(disable_lat),
3334 .help = "Disable latency numbers",
3335 .parent = "gtod_reduce",
d71c154c 3336 .hide = 1,
02af0988 3337 .def = "0",
e8b0e958
JA
3338 .category = FIO_OPT_C_STAT,
3339 .group = FIO_OPT_G_INVALID,
02af0988 3340 },
9520ebb9
JA
3341 {
3342 .name = "disable_clat",
e8b0e958 3343 .lname = "Disable completion latency stats",
9520ebb9
JA
3344 .type = FIO_OPT_BOOL,
3345 .off1 = td_var_offset(disable_clat),
3346 .help = "Disable completion latency numbers",
993bf48b 3347 .parent = "gtod_reduce",
d71c154c 3348 .hide = 1,
9520ebb9 3349 .def = "0",
e8b0e958
JA
3350 .category = FIO_OPT_C_STAT,
3351 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
3352 },
3353 {
3354 .name = "disable_slat",
e8b0e958 3355 .lname = "Disable submission latency stats",
9520ebb9
JA
3356 .type = FIO_OPT_BOOL,
3357 .off1 = td_var_offset(disable_slat),
03e20d68 3358 .help = "Disable submission latency numbers",
993bf48b 3359 .parent = "gtod_reduce",
d71c154c 3360 .hide = 1,
9520ebb9 3361 .def = "0",
e8b0e958
JA
3362 .category = FIO_OPT_C_STAT,
3363 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
3364 },
3365 {
3366 .name = "disable_bw_measurement",
e8b0e958 3367 .lname = "Disable bandwidth stats",
9520ebb9
JA
3368 .type = FIO_OPT_BOOL,
3369 .off1 = td_var_offset(disable_bw),
3370 .help = "Disable bandwidth logging",
993bf48b 3371 .parent = "gtod_reduce",
d71c154c 3372 .hide = 1,
9520ebb9 3373 .def = "0",
e8b0e958
JA
3374 .category = FIO_OPT_C_STAT,
3375 .group = FIO_OPT_G_INVALID,
9520ebb9 3376 },
be4ecfdf
JA
3377 {
3378 .name = "gtod_cpu",
e8b0e958 3379 .lname = "Dedicated gettimeofday() CPU",
be4ecfdf
JA
3380 .type = FIO_OPT_INT,
3381 .cb = str_gtod_cpu_cb,
03e20d68 3382 .help = "Set up dedicated gettimeofday() thread on this CPU",
29d43ff9 3383 .verify = gtod_cpu_verify,
e8b0e958 3384 .category = FIO_OPT_C_GENERAL,
10860056 3385 .group = FIO_OPT_G_CLOCK,
be4ecfdf 3386 },
771e58be
JA
3387 {
3388 .name = "unified_rw_reporting",
3389 .type = FIO_OPT_BOOL,
3390 .off1 = td_var_offset(unified_rw_rep),
3391 .help = "Unify reporting across data direction",
3392 .def = "0",
90b7a96d
JA
3393 .category = FIO_OPT_C_GENERAL,
3394 .group = FIO_OPT_G_INVALID,
771e58be 3395 },
f2bba182
RR
3396 {
3397 .name = "continue_on_error",
e8b0e958 3398 .lname = "Continue on error",
06842027 3399 .type = FIO_OPT_STR,
f2bba182 3400 .off1 = td_var_offset(continue_on_error),
03e20d68 3401 .help = "Continue on non-fatal errors during IO",
06842027 3402 .def = "none",
e8b0e958 3403 .category = FIO_OPT_C_GENERAL,
bc3f552f 3404 .group = FIO_OPT_G_ERR,
06842027
SL
3405 .posval = {
3406 { .ival = "none",
3407 .oval = ERROR_TYPE_NONE,
3408 .help = "Exit when an error is encountered",
3409 },
3410 { .ival = "read",
3411 .oval = ERROR_TYPE_READ,
3412 .help = "Continue on read errors only",
3413 },
3414 { .ival = "write",
3415 .oval = ERROR_TYPE_WRITE,
3416 .help = "Continue on write errors only",
3417 },
3418 { .ival = "io",
3419 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3420 .help = "Continue on any IO errors",
3421 },
3422 { .ival = "verify",
3423 .oval = ERROR_TYPE_VERIFY,
3424 .help = "Continue on verify errors only",
3425 },
3426 { .ival = "all",
3427 .oval = ERROR_TYPE_ANY,
3428 .help = "Continue on all io and verify errors",
3429 },
3430 { .ival = "0",
3431 .oval = ERROR_TYPE_NONE,
3432 .help = "Alias for 'none'",
3433 },
3434 { .ival = "1",
3435 .oval = ERROR_TYPE_ANY,
3436 .help = "Alias for 'all'",
3437 },
3438 },
f2bba182 3439 },
8b28bd41
DM
3440 {
3441 .name = "ignore_error",
3442 .type = FIO_OPT_STR,
3443 .cb = str_ignore_error_cb,
3444 .help = "Set a specific list of errors to ignore",
3445 .parent = "rw",
a94eb99a 3446 .category = FIO_OPT_C_GENERAL,
bc3f552f 3447 .group = FIO_OPT_G_ERR,
8b28bd41
DM
3448 },
3449 {
3450 .name = "error_dump",
3451 .type = FIO_OPT_BOOL,
3452 .off1 = td_var_offset(error_dump),
3453 .def = "0",
3454 .help = "Dump info on each error",
a94eb99a 3455 .category = FIO_OPT_C_GENERAL,
bc3f552f 3456 .group = FIO_OPT_G_ERR,
8b28bd41 3457 },
9ac8a797
JA
3458 {
3459 .name = "profile",
e8b0e958 3460 .lname = "Profile",
79d16311 3461 .type = FIO_OPT_STR_STORE,
9ac8a797 3462 .off1 = td_var_offset(profile),
9ac8a797 3463 .help = "Select a specific builtin performance test",
13fca827 3464 .category = FIO_OPT_C_PROFILE,
e8b0e958 3465 .group = FIO_OPT_G_INVALID,
9ac8a797 3466 },
a696fa2a
JA
3467 {
3468 .name = "cgroup",
e8b0e958 3469 .lname = "Cgroup",
a696fa2a
JA
3470 .type = FIO_OPT_STR_STORE,
3471 .off1 = td_var_offset(cgroup),
3472 .help = "Add job to cgroup of this name",
e8b0e958 3473 .category = FIO_OPT_C_GENERAL,
a1f6afec
JA
3474 .group = FIO_OPT_G_CGROUP,
3475 },
3476 {
3477 .name = "cgroup_nodelete",
3478 .lname = "Cgroup no-delete",
3479 .type = FIO_OPT_BOOL,
3480 .off1 = td_var_offset(cgroup_nodelete),
3481 .help = "Do not delete cgroups after job completion",
3482 .def = "0",
3483 .parent = "cgroup",
3484 .category = FIO_OPT_C_GENERAL,
3485 .group = FIO_OPT_G_CGROUP,
a696fa2a
JA
3486 },
3487 {
3488 .name = "cgroup_weight",
e8b0e958 3489 .lname = "Cgroup weight",
a696fa2a
JA
3490 .type = FIO_OPT_INT,
3491 .off1 = td_var_offset(cgroup_weight),
3492 .help = "Use given weight for cgroup",
3493 .minval = 100,
3494 .maxval = 1000,
a1f6afec 3495 .parent = "cgroup",
e8b0e958 3496 .category = FIO_OPT_C_GENERAL,
a1f6afec 3497 .group = FIO_OPT_G_CGROUP,
7de87099 3498 },
e0b0d892
JA
3499 {
3500 .name = "uid",
e8b0e958 3501 .lname = "User ID",
e0b0d892
JA
3502 .type = FIO_OPT_INT,
3503 .off1 = td_var_offset(uid),
3504 .help = "Run job with this user ID",
e8b0e958 3505 .category = FIO_OPT_C_GENERAL,
10860056 3506 .group = FIO_OPT_G_CRED,
e0b0d892
JA
3507 },
3508 {
3509 .name = "gid",
e8b0e958 3510 .lname = "Group ID",
e0b0d892
JA
3511 .type = FIO_OPT_INT,
3512 .off1 = td_var_offset(gid),
3513 .help = "Run job with this group ID",
e8b0e958 3514 .category = FIO_OPT_C_GENERAL,
10860056 3515 .group = FIO_OPT_G_CRED,
e0b0d892 3516 },
a1f6afec
JA
3517 {
3518 .name = "kb_base",
3519 .lname = "KB Base",
3520 .type = FIO_OPT_INT,
3521 .off1 = td_var_offset(kb_base),
a1f6afec
JA
3522 .prio = 1,
3523 .def = "1024",
ba9c7219
JA
3524 .posval = {
3525 { .ival = "1024",
3526 .oval = 1024,
3527 .help = "Use 1024 as the K base",
3528 },
3529 { .ival = "1000",
3530 .oval = 1000,
3531 .help = "Use 1000 as the K base",
3532 },
3533 },
a1f6afec
JA
3534 .help = "How many bytes per KB for reporting (1000 or 1024)",
3535 .category = FIO_OPT_C_GENERAL,
3536 .group = FIO_OPT_G_INVALID,
3537 },
cf3a0518
JA
3538 {
3539 .name = "unit_base",
ba9c7219 3540 .lname = "Base unit for reporting (Bits or Bytes)",
cf3a0518
JA
3541 .type = FIO_OPT_INT,
3542 .off1 = td_var_offset(unit_base),
cf3a0518 3543 .prio = 1,
71a08258
JA
3544 .posval = {
3545 { .ival = "0",
3546 .oval = 0,
3547 .help = "Auto-detect",
3548 },
3549 { .ival = "8",
3550 .oval = 8,
3551 .help = "Normal (byte based)",
3552 },
3553 { .ival = "1",
3554 .oval = 1,
3555 .help = "Bit based",
3556 },
3557 },
cf3a0518
JA
3558 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3559 .category = FIO_OPT_C_GENERAL,
3560 .group = FIO_OPT_G_INVALID,
3561 },