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