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