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