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