options: fix bs_cmp()
[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
67bf9823 1243#ifdef CONFIG_LIBAIO
214e1eca
JA
1244 { .ival = "libaio",
1245 .help = "Linux native asynchronous IO",
1246 },
1247#endif
67bf9823 1248#ifdef CONFIG_POSIXAIO
214e1eca
JA
1249 { .ival = "posixaio",
1250 .help = "POSIX asynchronous IO",
1251 },
417f0068 1252#endif
997843cb 1253#ifdef CONFIG_SOLARISAIO
417f0068
JA
1254 { .ival = "solarisaio",
1255 .help = "Solaris native asynchronous IO",
1256 },
214e1eca 1257#endif
4700b234 1258#ifdef CONFIG_WINDOWSAIO
03e20d68 1259 { .ival = "windowsaio",
3be80071 1260 .help = "Windows native asynchronous IO"
de890a1e 1261 },
fc5c0345
DG
1262#endif
1263#ifdef CONFIG_RBD
1264 { .ival = "rbd",
1265 .help = "Rados Block Device asynchronous IO"
1266 },
3be80071 1267#endif
214e1eca 1268 { .ival = "mmap",
03e20d68 1269 .help = "Memory mapped IO"
214e1eca 1270 },
67bf9823 1271#ifdef CONFIG_LINUX_SPLICE
214e1eca
JA
1272 { .ival = "splice",
1273 .help = "splice/vmsplice based IO",
1274 },
9cce02e8
JA
1275 { .ival = "netsplice",
1276 .help = "splice/vmsplice to/from the network",
1277 },
214e1eca
JA
1278#endif
1279#ifdef FIO_HAVE_SGIO
1280 { .ival = "sg",
1281 .help = "SCSI generic v3 IO",
1282 },
1283#endif
1284 { .ival = "null",
1285 .help = "Testing engine (no data transfer)",
1286 },
1287 { .ival = "net",
1288 .help = "Network IO",
1289 },
214e1eca 1290 { .ival = "cpuio",
03e20d68 1291 .help = "CPU cycle burner engine",
214e1eca 1292 },
67bf9823 1293#ifdef CONFIG_GUASI
b8c82a46
JA
1294 { .ival = "guasi",
1295 .help = "GUASI IO engine",
1296 },
79a43187
JA
1297#endif
1298#ifdef FIO_HAVE_BINJECT
1299 { .ival = "binject",
1300 .help = "binject direct inject block engine",
1301 },
21b8aee8 1302#endif
67bf9823 1303#ifdef CONFIG_RDMA
21b8aee8 1304 { .ival = "rdma",
1305 .help = "RDMA IO engine",
1306 },
8200b8c7 1307#endif
67bf9823 1308#ifdef CONFIG_FUSION_AW
8200b8c7
JA
1309 { .ival = "fusion-aw-sync",
1310 .help = "Fusion-io atomic write engine",
1311 },
1ecc95ca 1312#endif
997843cb 1313#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1ecc95ca
JA
1314 { .ival = "e4defrag",
1315 .help = "ext4 defrag engine",
1316 },
1317#endif
997843cb 1318#ifdef CONFIG_LINUX_FALLOCATE
1ecc95ca
JA
1319 { .ival = "falloc",
1320 .help = "fallocate() file based engine",
1321 },
b8c82a46 1322#endif
a7c386f4 1323#ifdef CONFIG_GFAPI
1324 { .ival = "gfapi",
cc47f094 1325 .help = "Glusterfs libgfapi(sync) based engine"
1326 },
1327 { .ival = "gfapi_async",
1328 .help = "Glusterfs libgfapi(async) based engine"
a7c386f4 1329 },
1330#endif
1b10477b 1331#ifdef CONFIG_LIBHDFS
b74e419e 1332 { .ival = "libhdfs",
1b10477b
MM
1333 .help = "Hadoop Distributed Filesystem (HDFS) engine"
1334 },
1335#endif
214e1eca
JA
1336 { .ival = "external",
1337 .help = "Load external engine (append name)",
1338 },
1339 },
1340 },
1341 {
1342 .name = "iodepth",
e8b0e958 1343 .lname = "IO Depth",
214e1eca
JA
1344 .type = FIO_OPT_INT,
1345 .off1 = td_var_offset(iodepth),
03e20d68 1346 .help = "Number of IO buffers to keep in flight",
757aff4f 1347 .minval = 1,
20eb06bd 1348 .interval = 1,
214e1eca 1349 .def = "1",
e8b0e958 1350 .category = FIO_OPT_C_IO,
0626037e 1351 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1352 },
1353 {
1354 .name = "iodepth_batch",
e8b0e958 1355 .lname = "IO Depth batch",
4950421a 1356 .alias = "iodepth_batch_submit",
214e1eca
JA
1357 .type = FIO_OPT_INT,
1358 .off1 = td_var_offset(iodepth_batch),
d65db441 1359 .help = "Number of IO buffers to submit in one go",
afdf9352 1360 .parent = "iodepth",
d71c154c 1361 .hide = 1,
a2e6f8ac 1362 .minval = 1,
20eb06bd 1363 .interval = 1,
a2e6f8ac 1364 .def = "1",
e8b0e958 1365 .category = FIO_OPT_C_IO,
0626037e 1366 .group = FIO_OPT_G_IO_BASIC,
4950421a
JA
1367 },
1368 {
82407585
RP
1369 .name = "iodepth_batch_complete_min",
1370 .lname = "Min IO depth batch complete",
1371 .alias = "iodepth_batch_complete",
4950421a 1372 .type = FIO_OPT_INT,
82407585
RP
1373 .off1 = td_var_offset(iodepth_batch_complete_min),
1374 .help = "Min number of IO buffers to retrieve in one go",
4950421a 1375 .parent = "iodepth",
d71c154c 1376 .hide = 1,
4950421a 1377 .minval = 0,
20eb06bd 1378 .interval = 1,
4950421a 1379 .def = "1",
e8b0e958 1380 .category = FIO_OPT_C_IO,
0626037e 1381 .group = FIO_OPT_G_IO_BASIC,
214e1eca 1382 },
82407585
RP
1383 {
1384 .name = "iodepth_batch_complete_max",
1385 .lname = "Max IO depth batch complete",
1386 .type = FIO_OPT_INT,
1387 .off1 = td_var_offset(iodepth_batch_complete_max),
1388 .help = "Max number of IO buffers to retrieve in one go",
1389 .parent = "iodepth",
1390 .hide = 1,
1391 .minval = 0,
1392 .interval = 1,
1393 .category = FIO_OPT_C_IO,
1394 .group = FIO_OPT_G_IO_BASIC,
1395 },
214e1eca
JA
1396 {
1397 .name = "iodepth_low",
e8b0e958 1398 .lname = "IO Depth batch low",
214e1eca
JA
1399 .type = FIO_OPT_INT,
1400 .off1 = td_var_offset(iodepth_low),
1401 .help = "Low water mark for queuing depth",
afdf9352 1402 .parent = "iodepth",
d71c154c 1403 .hide = 1,
20eb06bd 1404 .interval = 1,
e8b0e958 1405 .category = FIO_OPT_C_IO,
0626037e 1406 .group = FIO_OPT_G_IO_BASIC,
214e1eca 1407 },
a9da8ab2
JA
1408 {
1409 .name = "io_submit_mode",
1410 .lname = "IO submit mode",
1411 .type = FIO_OPT_STR,
1412 .off1 = td_var_offset(io_submit_mode),
1413 .help = "How IO submissions and completions are done",
1414 .def = "inline",
1415 .category = FIO_OPT_C_IO,
1416 .group = FIO_OPT_G_IO_BASIC,
1417 .posval = {
1418 { .ival = "inline",
1419 .oval = IO_MODE_INLINE,
1420 .help = "Submit and complete IO inline",
1421 },
1422 { .ival = "offload",
1423 .oval = IO_MODE_OFFLOAD,
1424 .help = "Offload submit and complete to threads",
1425 },
1426 },
1427 },
214e1eca
JA
1428 {
1429 .name = "size",
e8b0e958 1430 .lname = "Size",
214e1eca 1431 .type = FIO_OPT_STR_VAL,
7bb59102 1432 .cb = str_size_cb,
a8523a6a 1433 .off1 = td_var_offset(size),
214e1eca 1434 .help = "Total size of device or files",
20eb06bd 1435 .interval = 1024 * 1024,
e8b0e958
JA
1436 .category = FIO_OPT_C_IO,
1437 .group = FIO_OPT_G_INVALID,
214e1eca 1438 },
77731b29 1439 {
a4d3b4db
JA
1440 .name = "io_size",
1441 .alias = "io_limit",
1442 .lname = "IO Size",
77731b29
JA
1443 .type = FIO_OPT_STR_VAL,
1444 .off1 = td_var_offset(io_limit),
1445 .interval = 1024 * 1024,
1446 .category = FIO_OPT_C_IO,
1447 .group = FIO_OPT_G_INVALID,
1448 },
aa31f1f1
SL
1449 {
1450 .name = "fill_device",
e8b0e958 1451 .lname = "Fill device",
74586c1e 1452 .alias = "fill_fs",
aa31f1f1
SL
1453 .type = FIO_OPT_BOOL,
1454 .off1 = td_var_offset(fill_device),
1455 .help = "Write until an ENOSPC error occurs",
1456 .def = "0",
e8b0e958
JA
1457 .category = FIO_OPT_C_FILE,
1458 .group = FIO_OPT_G_INVALID,
aa31f1f1 1459 },
214e1eca
JA
1460 {
1461 .name = "filesize",
e8b0e958 1462 .lname = "File size",
214e1eca
JA
1463 .type = FIO_OPT_STR_VAL,
1464 .off1 = td_var_offset(file_size_low),
1465 .off2 = td_var_offset(file_size_high),
c3edbdba 1466 .minval = 1,
214e1eca 1467 .help = "Size of individual files",
20eb06bd 1468 .interval = 1024 * 1024,
e8b0e958
JA
1469 .category = FIO_OPT_C_FILE,
1470 .group = FIO_OPT_G_INVALID,
214e1eca 1471 },
bedc9dc2
JA
1472 {
1473 .name = "file_append",
1474 .lname = "File append",
1475 .type = FIO_OPT_BOOL,
1476 .off1 = td_var_offset(file_append),
1477 .help = "IO will start at the end of the file(s)",
1478 .def = "0",
1479 .category = FIO_OPT_C_FILE,
1480 .group = FIO_OPT_G_INVALID,
1481 },
67a1000f
JA
1482 {
1483 .name = "offset",
e8b0e958 1484 .lname = "IO offset",
67a1000f
JA
1485 .alias = "fileoffset",
1486 .type = FIO_OPT_STR_VAL,
1487 .off1 = td_var_offset(start_offset),
1488 .help = "Start IO from this offset",
1489 .def = "0",
20eb06bd 1490 .interval = 1024 * 1024,
e8b0e958
JA
1491 .category = FIO_OPT_C_IO,
1492 .group = FIO_OPT_G_INVALID,
67a1000f 1493 },
2d7cd868
JA
1494 {
1495 .name = "offset_increment",
e8b0e958 1496 .lname = "IO offset increment",
2d7cd868
JA
1497 .type = FIO_OPT_STR_VAL,
1498 .off1 = td_var_offset(offset_increment),
1499 .help = "What is the increment from one offset to the next",
1500 .parent = "offset",
d71c154c 1501 .hide = 1,
2d7cd868 1502 .def = "0",
20eb06bd 1503 .interval = 1024 * 1024,
e8b0e958
JA
1504 .category = FIO_OPT_C_IO,
1505 .group = FIO_OPT_G_INVALID,
2d7cd868 1506 },
ddf24e42
JA
1507 {
1508 .name = "number_ios",
1509 .lname = "Number of IOs to perform",
1510 .type = FIO_OPT_STR_VAL,
1511 .off1 = td_var_offset(number_ios),
be3fec7d 1512 .help = "Force job completion after this number of IOs",
ddf24e42
JA
1513 .def = "0",
1514 .category = FIO_OPT_C_IO,
1515 .group = FIO_OPT_G_INVALID,
1516 },
214e1eca
JA
1517 {
1518 .name = "bs",
e8b0e958 1519 .lname = "Block size",
d3aad8f2 1520 .alias = "blocksize",
e01b22b8 1521 .type = FIO_OPT_INT,
214e1eca
JA
1522 .off1 = td_var_offset(bs[DDIR_READ]),
1523 .off2 = td_var_offset(bs[DDIR_WRITE]),
6eaf09d6 1524 .off3 = td_var_offset(bs[DDIR_TRIM]),
c3edbdba 1525 .minval = 1,
214e1eca
JA
1526 .help = "Block size unit",
1527 .def = "4k",
67a1000f 1528 .parent = "rw",
d71c154c 1529 .hide = 1,
20eb06bd 1530 .interval = 512,
e8b0e958
JA
1531 .category = FIO_OPT_C_IO,
1532 .group = FIO_OPT_G_INVALID,
214e1eca 1533 },
2b7a01d0
JA
1534 {
1535 .name = "ba",
e8b0e958 1536 .lname = "Block size align",
2b7a01d0 1537 .alias = "blockalign",
e01b22b8 1538 .type = FIO_OPT_INT,
2b7a01d0
JA
1539 .off1 = td_var_offset(ba[DDIR_READ]),
1540 .off2 = td_var_offset(ba[DDIR_WRITE]),
6eaf09d6 1541 .off3 = td_var_offset(ba[DDIR_TRIM]),
2b7a01d0
JA
1542 .minval = 1,
1543 .help = "IO block offset alignment",
1544 .parent = "rw",
d71c154c 1545 .hide = 1,
20eb06bd 1546 .interval = 512,
e8b0e958
JA
1547 .category = FIO_OPT_C_IO,
1548 .group = FIO_OPT_G_INVALID,
2b7a01d0 1549 },
214e1eca
JA
1550 {
1551 .name = "bsrange",
e8b0e958 1552 .lname = "Block size range",
d3aad8f2 1553 .alias = "blocksize_range",
214e1eca
JA
1554 .type = FIO_OPT_RANGE,
1555 .off1 = td_var_offset(min_bs[DDIR_READ]),
1556 .off2 = td_var_offset(max_bs[DDIR_READ]),
1557 .off3 = td_var_offset(min_bs[DDIR_WRITE]),
1558 .off4 = td_var_offset(max_bs[DDIR_WRITE]),
6eaf09d6
SL
1559 .off5 = td_var_offset(min_bs[DDIR_TRIM]),
1560 .off6 = td_var_offset(max_bs[DDIR_TRIM]),
c3edbdba 1561 .minval = 1,
214e1eca 1562 .help = "Set block size range (in more detail than bs)",
67a1000f 1563 .parent = "rw",
d71c154c 1564 .hide = 1,
20eb06bd 1565 .interval = 4096,
e8b0e958
JA
1566 .category = FIO_OPT_C_IO,
1567 .group = FIO_OPT_G_INVALID,
214e1eca 1568 },
564ca972
JA
1569 {
1570 .name = "bssplit",
e8b0e958 1571 .lname = "Block size split",
564ca972
JA
1572 .type = FIO_OPT_STR,
1573 .cb = str_bssplit_cb,
a8523a6a 1574 .off1 = td_var_offset(bssplit),
564ca972
JA
1575 .help = "Set a specific mix of block sizes",
1576 .parent = "rw",
d71c154c 1577 .hide = 1,
e8b0e958
JA
1578 .category = FIO_OPT_C_IO,
1579 .group = FIO_OPT_G_INVALID,
564ca972 1580 },
214e1eca
JA
1581 {
1582 .name = "bs_unaligned",
e8b0e958 1583 .lname = "Block size unaligned",
d3aad8f2 1584 .alias = "blocksize_unaligned",
214e1eca
JA
1585 .type = FIO_OPT_STR_SET,
1586 .off1 = td_var_offset(bs_unaligned),
1587 .help = "Don't sector align IO buffer sizes",
67a1000f 1588 .parent = "rw",
d71c154c 1589 .hide = 1,
e8b0e958
JA
1590 .category = FIO_OPT_C_IO,
1591 .group = FIO_OPT_G_INVALID,
214e1eca 1592 },
6aca9b3d
JA
1593 {
1594 .name = "bs_is_seq_rand",
1595 .lname = "Block size division is seq/random (not read/write)",
1596 .type = FIO_OPT_BOOL,
1597 .off1 = td_var_offset(bs_is_seq_rand),
86d59660 1598 .help = "Consider any blocksize setting to be sequential,random",
6aca9b3d
JA
1599 .def = "0",
1600 .parent = "blocksize",
1601 .category = FIO_OPT_C_IO,
1602 .group = FIO_OPT_G_INVALID,
1603 },
214e1eca
JA
1604 {
1605 .name = "randrepeat",
e8b0e958 1606 .lname = "Random repeatable",
214e1eca
JA
1607 .type = FIO_OPT_BOOL,
1608 .off1 = td_var_offset(rand_repeatable),
1609 .help = "Use repeatable random IO pattern",
1610 .def = "1",
67a1000f 1611 .parent = "rw",
d71c154c 1612 .hide = 1,
e8b0e958 1613 .category = FIO_OPT_C_IO,
3ceb458f 1614 .group = FIO_OPT_G_RANDOM,
214e1eca 1615 },
04778baf
JA
1616 {
1617 .name = "randseed",
1618 .lname = "The random generator seed",
363cffa7 1619 .type = FIO_OPT_STR_VAL,
04778baf
JA
1620 .off1 = td_var_offset(rand_seed),
1621 .help = "Set the random generator seed value",
40fe5e7b 1622 .def = "0x89",
04778baf
JA
1623 .parent = "rw",
1624 .category = FIO_OPT_C_IO,
1625 .group = FIO_OPT_G_RANDOM,
1626 },
2615cc4b
JA
1627 {
1628 .name = "use_os_rand",
e8b0e958 1629 .lname = "Use OS random",
54a21917
JA
1630 .type = FIO_OPT_DEPRECATED,
1631 .off1 = td_var_offset(dep_use_os_rand),
e8b0e958 1632 .category = FIO_OPT_C_IO,
3ceb458f 1633 .group = FIO_OPT_G_RANDOM,
2615cc4b 1634 },
214e1eca
JA
1635 {
1636 .name = "norandommap",
e8b0e958 1637 .lname = "No randommap",
214e1eca
JA
1638 .type = FIO_OPT_STR_SET,
1639 .off1 = td_var_offset(norandommap),
1640 .help = "Accept potential duplicate random blocks",
67a1000f 1641 .parent = "rw",
d71c154c 1642 .hide = 1,
b2452a43 1643 .hide_on_set = 1,
e8b0e958 1644 .category = FIO_OPT_C_IO,
3ceb458f 1645 .group = FIO_OPT_G_RANDOM,
214e1eca 1646 },
2b386d25
JA
1647 {
1648 .name = "softrandommap",
e8b0e958 1649 .lname = "Soft randommap",
2b386d25
JA
1650 .type = FIO_OPT_BOOL,
1651 .off1 = td_var_offset(softrandommap),
f66ab3c8 1652 .help = "Set norandommap if randommap allocation fails",
2b386d25 1653 .parent = "norandommap",
d71c154c 1654 .hide = 1,
2b386d25 1655 .def = "0",
e8b0e958 1656 .category = FIO_OPT_C_IO,
3ceb458f 1657 .group = FIO_OPT_G_RANDOM,
2b386d25 1658 },
8055e41d
JA
1659 {
1660 .name = "random_generator",
1661 .type = FIO_OPT_STR,
1662 .off1 = td_var_offset(random_generator),
1663 .help = "Type of random number generator to use",
1664 .def = "tausworthe",
1665 .posval = {
1666 { .ival = "tausworthe",
1667 .oval = FIO_RAND_GEN_TAUSWORTHE,
1668 .help = "Strong Tausworthe generator",
1669 },
1670 { .ival = "lfsr",
1671 .oval = FIO_RAND_GEN_LFSR,
1672 .help = "Variable length LFSR",
1673 },
c3546b53
JA
1674 {
1675 .ival = "tausworthe64",
1676 .oval = FIO_RAND_GEN_TAUSWORTHE64,
1677 .help = "64-bit Tausworthe variant",
1678 },
8055e41d 1679 },
48107598
JA
1680 .category = FIO_OPT_C_IO,
1681 .group = FIO_OPT_G_RANDOM,
8055e41d 1682 },
e25839d4
JA
1683 {
1684 .name = "random_distribution",
1685 .type = FIO_OPT_STR,
1686 .off1 = td_var_offset(random_distribution),
1687 .cb = str_random_distribution_cb,
1688 .help = "Random offset distribution generator",
1689 .def = "random",
1690 .posval = {
1691 { .ival = "random",
1692 .oval = FIO_RAND_DIST_RANDOM,
1693 .help = "Completely random",
1694 },
1695 { .ival = "zipf",
1696 .oval = FIO_RAND_DIST_ZIPF,
1697 .help = "Zipf distribution",
1698 },
925fee33
JA
1699 { .ival = "pareto",
1700 .oval = FIO_RAND_DIST_PARETO,
1701 .help = "Pareto distribution",
1702 },
56d9fa4b
JA
1703 { .ival = "normal",
1704 .oval = FIO_RAND_DIST_GAUSS,
1705 .help = "Normal (gaussian) distribution",
1706 },
e25839d4 1707 },
48107598
JA
1708 .category = FIO_OPT_C_IO,
1709 .group = FIO_OPT_G_RANDOM,
e25839d4 1710 },
211c9b89
JA
1711 {
1712 .name = "percentage_random",
1713 .lname = "Percentage Random",
1714 .type = FIO_OPT_INT,
d9472271
JA
1715 .off1 = td_var_offset(perc_rand[DDIR_READ]),
1716 .off2 = td_var_offset(perc_rand[DDIR_WRITE]),
1717 .off3 = td_var_offset(perc_rand[DDIR_TRIM]),
211c9b89
JA
1718 .maxval = 100,
1719 .help = "Percentage of seq/random mix that should be random",
d9472271 1720 .def = "100,100,100",
211c9b89
JA
1721 .interval = 5,
1722 .inverse = "percentage_sequential",
1723 .category = FIO_OPT_C_IO,
1724 .group = FIO_OPT_G_RANDOM,
1725 },
1726 {
1727 .name = "percentage_sequential",
1728 .lname = "Percentage Sequential",
d9472271 1729 .type = FIO_OPT_DEPRECATED,
211c9b89
JA
1730 .category = FIO_OPT_C_IO,
1731 .group = FIO_OPT_G_RANDOM,
1732 },
56e2a5fc
CE
1733 {
1734 .name = "allrandrepeat",
1735 .type = FIO_OPT_BOOL,
1736 .off1 = td_var_offset(allrand_repeatable),
1737 .help = "Use repeatable random numbers for everything",
1738 .def = "0",
a869d9c6
JA
1739 .category = FIO_OPT_C_IO,
1740 .group = FIO_OPT_G_RANDOM,
56e2a5fc 1741 },
214e1eca
JA
1742 {
1743 .name = "nrfiles",
e8b0e958 1744 .lname = "Number of files",
d7c8be03 1745 .alias = "nr_files",
214e1eca
JA
1746 .type = FIO_OPT_INT,
1747 .off1 = td_var_offset(nr_files),
1748 .help = "Split job workload between this number of files",
1749 .def = "1",
20eb06bd 1750 .interval = 1,
e8b0e958
JA
1751 .category = FIO_OPT_C_FILE,
1752 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1753 },
1754 {
1755 .name = "openfiles",
e8b0e958 1756 .lname = "Number of open files",
214e1eca
JA
1757 .type = FIO_OPT_INT,
1758 .off1 = td_var_offset(open_files),
1759 .help = "Number of files to keep open at the same time",
e8b0e958
JA
1760 .category = FIO_OPT_C_FILE,
1761 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1762 },
1763 {
1764 .name = "file_service_type",
e8b0e958 1765 .lname = "File service type",
214e1eca
JA
1766 .type = FIO_OPT_STR,
1767 .cb = str_fst_cb,
1768 .off1 = td_var_offset(file_service_type),
1769 .help = "How to select which file to service next",
1770 .def = "roundrobin",
e8b0e958
JA
1771 .category = FIO_OPT_C_FILE,
1772 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1773 .posval = {
1774 { .ival = "random",
1775 .oval = FIO_FSERVICE_RANDOM,
1776 .help = "Choose a file at random",
1777 },
1778 { .ival = "roundrobin",
1779 .oval = FIO_FSERVICE_RR,
1780 .help = "Round robin select files",
1781 },
a086c257
JA
1782 { .ival = "sequential",
1783 .oval = FIO_FSERVICE_SEQ,
1784 .help = "Finish one file before moving to the next",
1785 },
214e1eca 1786 },
67a1000f 1787 .parent = "nrfiles",
d71c154c 1788 .hide = 1,
67a1000f 1789 },
97ac992c 1790#ifdef CONFIG_POSIX_FALLOCATE
7bc8c2cf
JA
1791 {
1792 .name = "fallocate",
e8b0e958 1793 .lname = "Fallocate",
a596f047
EG
1794 .type = FIO_OPT_STR,
1795 .off1 = td_var_offset(fallocate_mode),
1796 .help = "Whether pre-allocation is performed when laying out files",
1797 .def = "posix",
e8b0e958
JA
1798 .category = FIO_OPT_C_FILE,
1799 .group = FIO_OPT_G_INVALID,
a596f047
EG
1800 .posval = {
1801 { .ival = "none",
1802 .oval = FIO_FALLOCATE_NONE,
1803 .help = "Do not pre-allocate space",
1804 },
1805 { .ival = "posix",
1806 .oval = FIO_FALLOCATE_POSIX,
1807 .help = "Use posix_fallocate()",
1808 },
97ac992c 1809#ifdef CONFIG_LINUX_FALLOCATE
a596f047
EG
1810 { .ival = "keep",
1811 .oval = FIO_FALLOCATE_KEEP_SIZE,
1812 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
1813 },
7bc8c2cf 1814#endif
a596f047
EG
1815 /* Compatibility with former boolean values */
1816 { .ival = "0",
1817 .oval = FIO_FALLOCATE_NONE,
1818 .help = "Alias for 'none'",
1819 },
1820 { .ival = "1",
1821 .oval = FIO_FALLOCATE_POSIX,
1822 .help = "Alias for 'posix'",
1823 },
1824 },
1825 },
97ac992c 1826#endif /* CONFIG_POSIX_FALLOCATE */
67a1000f
JA
1827 {
1828 .name = "fadvise_hint",
e8b0e958 1829 .lname = "Fadvise hint",
67a1000f
JA
1830 .type = FIO_OPT_BOOL,
1831 .off1 = td_var_offset(fadvise_hint),
1832 .help = "Use fadvise() to advise the kernel on IO pattern",
1833 .def = "1",
e8b0e958
JA
1834 .category = FIO_OPT_C_FILE,
1835 .group = FIO_OPT_G_INVALID,
214e1eca 1836 },
37659335
JA
1837#ifdef FIO_HAVE_STREAMID
1838 {
1839 .name = "fadvise_stream",
1840 .lname = "Fadvise stream",
1841 .type = FIO_OPT_INT,
1842 .off1 = td_var_offset(fadvise_stream),
1843 .help = "Use fadvise() to set stream ID",
1844 .category = FIO_OPT_C_FILE,
1845 .group = FIO_OPT_G_INVALID,
1846 },
1847#endif
214e1eca
JA
1848 {
1849 .name = "fsync",
e8b0e958 1850 .lname = "Fsync",
214e1eca
JA
1851 .type = FIO_OPT_INT,
1852 .off1 = td_var_offset(fsync_blocks),
1853 .help = "Issue fsync for writes every given number of blocks",
1854 .def = "0",
20eb06bd 1855 .interval = 1,
e8b0e958
JA
1856 .category = FIO_OPT_C_FILE,
1857 .group = FIO_OPT_G_INVALID,
214e1eca 1858 },
5f9099ea
JA
1859 {
1860 .name = "fdatasync",
e8b0e958 1861 .lname = "Fdatasync",
5f9099ea
JA
1862 .type = FIO_OPT_INT,
1863 .off1 = td_var_offset(fdatasync_blocks),
1864 .help = "Issue fdatasync for writes every given number of blocks",
1865 .def = "0",
20eb06bd 1866 .interval = 1,
e8b0e958
JA
1867 .category = FIO_OPT_C_FILE,
1868 .group = FIO_OPT_G_INVALID,
5f9099ea 1869 },
1ef2b6be
JA
1870 {
1871 .name = "write_barrier",
e8b0e958 1872 .lname = "Write barrier",
1ef2b6be
JA
1873 .type = FIO_OPT_INT,
1874 .off1 = td_var_offset(barrier_blocks),
1875 .help = "Make every Nth write a barrier write",
1876 .def = "0",
20eb06bd 1877 .interval = 1,
e8b0e958
JA
1878 .category = FIO_OPT_C_IO,
1879 .group = FIO_OPT_G_INVALID,
1ef2b6be 1880 },
67bf9823 1881#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
1882 {
1883 .name = "sync_file_range",
e8b0e958 1884 .lname = "Sync file range",
44f29692
JA
1885 .posval = {
1886 { .ival = "wait_before",
1887 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
1888 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
ebadc0ce 1889 .orval = 1,
44f29692
JA
1890 },
1891 { .ival = "write",
1892 .oval = SYNC_FILE_RANGE_WRITE,
1893 .help = "SYNC_FILE_RANGE_WRITE",
ebadc0ce 1894 .orval = 1,
44f29692
JA
1895 },
1896 {
1897 .ival = "wait_after",
1898 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
1899 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
ebadc0ce 1900 .orval = 1,
44f29692
JA
1901 },
1902 },
3843deb3 1903 .type = FIO_OPT_STR_MULTI,
44f29692
JA
1904 .cb = str_sfr_cb,
1905 .off1 = td_var_offset(sync_file_range),
1906 .help = "Use sync_file_range()",
e8b0e958
JA
1907 .category = FIO_OPT_C_FILE,
1908 .group = FIO_OPT_G_INVALID,
44f29692
JA
1909 },
1910#endif
214e1eca
JA
1911 {
1912 .name = "direct",
e8b0e958 1913 .lname = "Direct I/O",
214e1eca
JA
1914 .type = FIO_OPT_BOOL,
1915 .off1 = td_var_offset(odirect),
1916 .help = "Use O_DIRECT IO (negates buffered)",
1917 .def = "0",
a01a1bc5 1918 .inverse = "buffered",
e8b0e958 1919 .category = FIO_OPT_C_IO,
3ceb458f 1920 .group = FIO_OPT_G_IO_TYPE,
214e1eca 1921 },
d01612f3
CM
1922 {
1923 .name = "atomic",
1924 .lname = "Atomic I/O",
1925 .type = FIO_OPT_BOOL,
1926 .off1 = td_var_offset(oatomic),
1927 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
1928 .def = "0",
1929 .category = FIO_OPT_C_IO,
1930 .group = FIO_OPT_G_IO_TYPE,
1931 },
214e1eca
JA
1932 {
1933 .name = "buffered",
e8b0e958 1934 .lname = "Buffered I/O",
214e1eca
JA
1935 .type = FIO_OPT_BOOL,
1936 .off1 = td_var_offset(odirect),
1937 .neg = 1,
1938 .help = "Use buffered IO (negates direct)",
1939 .def = "1",
a01a1bc5 1940 .inverse = "direct",
e8b0e958 1941 .category = FIO_OPT_C_IO,
3ceb458f 1942 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
1943 },
1944 {
1945 .name = "overwrite",
e8b0e958 1946 .lname = "Overwrite",
214e1eca
JA
1947 .type = FIO_OPT_BOOL,
1948 .off1 = td_var_offset(overwrite),
1949 .help = "When writing, set whether to overwrite current data",
1950 .def = "0",
e8b0e958
JA
1951 .category = FIO_OPT_C_FILE,
1952 .group = FIO_OPT_G_INVALID,
214e1eca
JA
1953 },
1954 {
1955 .name = "loops",
e8b0e958 1956 .lname = "Loops",
214e1eca
JA
1957 .type = FIO_OPT_INT,
1958 .off1 = td_var_offset(loops),
1959 .help = "Number of times to run the job",
1960 .def = "1",
20eb06bd 1961 .interval = 1,
e8b0e958 1962 .category = FIO_OPT_C_GENERAL,
a1f6afec 1963 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
1964 },
1965 {
1966 .name = "numjobs",
e8b0e958 1967 .lname = "Number of jobs",
214e1eca
JA
1968 .type = FIO_OPT_INT,
1969 .off1 = td_var_offset(numjobs),
1970 .help = "Duplicate this job this many times",
1971 .def = "1",
20eb06bd 1972 .interval = 1,
e8b0e958 1973 .category = FIO_OPT_C_GENERAL,
a1f6afec 1974 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
1975 },
1976 {
1977 .name = "startdelay",
e8b0e958 1978 .lname = "Start delay",
a5737c93 1979 .type = FIO_OPT_STR_VAL_TIME,
214e1eca 1980 .off1 = td_var_offset(start_delay),
23ed19b0 1981 .off2 = td_var_offset(start_delay_high),
214e1eca
JA
1982 .help = "Only start job when this period has passed",
1983 .def = "0",
0de5b26f 1984 .is_seconds = 1,
88038bc7 1985 .is_time = 1,
e8b0e958 1986 .category = FIO_OPT_C_GENERAL,
a1f6afec 1987 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
1988 },
1989 {
1990 .name = "runtime",
e8b0e958 1991 .lname = "Runtime",
214e1eca
JA
1992 .alias = "timeout",
1993 .type = FIO_OPT_STR_VAL_TIME,
1994 .off1 = td_var_offset(timeout),
1995 .help = "Stop workload when this amount of time has passed",
1996 .def = "0",
0de5b26f 1997 .is_seconds = 1,
88038bc7 1998 .is_time = 1,
e8b0e958 1999 .category = FIO_OPT_C_GENERAL,
a1f6afec 2000 .group = FIO_OPT_G_RUNTIME,
214e1eca 2001 },
cf4464ca
JA
2002 {
2003 .name = "time_based",
e8b0e958 2004 .lname = "Time based",
cf4464ca
JA
2005 .type = FIO_OPT_STR_SET,
2006 .off1 = td_var_offset(time_based),
2007 .help = "Keep running until runtime/timeout is met",
e8b0e958 2008 .category = FIO_OPT_C_GENERAL,
a1f6afec 2009 .group = FIO_OPT_G_RUNTIME,
cf4464ca 2010 },
62167762
JC
2011 {
2012 .name = "verify_only",
2013 .lname = "Verify only",
2014 .type = FIO_OPT_STR_SET,
2015 .off1 = td_var_offset(verify_only),
2016 .help = "Verifies previously written data is still valid",
2017 .category = FIO_OPT_C_GENERAL,
2018 .group = FIO_OPT_G_RUNTIME,
2019 },
721938ae
JA
2020 {
2021 .name = "ramp_time",
e8b0e958 2022 .lname = "Ramp time",
721938ae
JA
2023 .type = FIO_OPT_STR_VAL_TIME,
2024 .off1 = td_var_offset(ramp_time),
2025 .help = "Ramp up time before measuring performance",
0de5b26f 2026 .is_seconds = 1,
88038bc7 2027 .is_time = 1,
e8b0e958 2028 .category = FIO_OPT_C_GENERAL,
a1f6afec 2029 .group = FIO_OPT_G_RUNTIME,
721938ae 2030 },
c223da83
JA
2031 {
2032 .name = "clocksource",
e8b0e958 2033 .lname = "Clock source",
c223da83
JA
2034 .type = FIO_OPT_STR,
2035 .cb = fio_clock_source_cb,
2036 .off1 = td_var_offset(clocksource),
2037 .help = "What type of timing source to use",
e8b0e958 2038 .category = FIO_OPT_C_GENERAL,
10860056 2039 .group = FIO_OPT_G_CLOCK,
c223da83 2040 .posval = {
67bf9823 2041#ifdef CONFIG_GETTIMEOFDAY
c223da83
JA
2042 { .ival = "gettimeofday",
2043 .oval = CS_GTOD,
2044 .help = "Use gettimeofday(2) for timing",
2045 },
67bf9823
JA
2046#endif
2047#ifdef CONFIG_CLOCK_GETTIME
c223da83
JA
2048 { .ival = "clock_gettime",
2049 .oval = CS_CGETTIME,
2050 .help = "Use clock_gettime(2) for timing",
2051 },
67bf9823 2052#endif
c223da83
JA
2053#ifdef ARCH_HAVE_CPU_CLOCK
2054 { .ival = "cpu",
2055 .oval = CS_CPUCLOCK,
2056 .help = "Use CPU private clock",
2057 },
2058#endif
2059 },
2060 },
214e1eca
JA
2061 {
2062 .name = "mem",
d3aad8f2 2063 .alias = "iomem",
e8b0e958 2064 .lname = "I/O Memory",
214e1eca
JA
2065 .type = FIO_OPT_STR,
2066 .cb = str_mem_cb,
2067 .off1 = td_var_offset(mem_type),
2068 .help = "Backing type for IO buffers",
2069 .def = "malloc",
e8b0e958
JA
2070 .category = FIO_OPT_C_IO,
2071 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2072 .posval = {
2073 { .ival = "malloc",
2074 .oval = MEM_MALLOC,
2075 .help = "Use malloc(3) for IO buffers",
2076 },
c8931876 2077#ifndef CONFIG_NO_SHM
37c8cdfe
JA
2078 { .ival = "shm",
2079 .oval = MEM_SHM,
2080 .help = "Use shared memory segments for IO buffers",
2081 },
214e1eca
JA
2082#ifdef FIO_HAVE_HUGETLB
2083 { .ival = "shmhuge",
2084 .oval = MEM_SHMHUGE,
2085 .help = "Like shm, but use huge pages",
2086 },
c8931876 2087#endif
b370e46a 2088#endif
37c8cdfe
JA
2089 { .ival = "mmap",
2090 .oval = MEM_MMAP,
2091 .help = "Use mmap(2) (file or anon) for IO buffers",
2092 },
217b0f1d
LG
2093 { .ival = "mmapshared",
2094 .oval = MEM_MMAPSHARED,
2095 .help = "Like mmap, but use the shared flag",
2096 },
214e1eca
JA
2097#ifdef FIO_HAVE_HUGETLB
2098 { .ival = "mmaphuge",
2099 .oval = MEM_MMAPHUGE,
2100 .help = "Like mmap, but use huge pages",
2101 },
2102#endif
2103 },
2104 },
d529ee19
JA
2105 {
2106 .name = "iomem_align",
2107 .alias = "mem_align",
e8b0e958 2108 .lname = "I/O memory alignment",
d529ee19
JA
2109 .type = FIO_OPT_INT,
2110 .off1 = td_var_offset(mem_align),
2111 .minval = 0,
2112 .help = "IO memory buffer offset alignment",
2113 .def = "0",
2114 .parent = "iomem",
d71c154c 2115 .hide = 1,
e8b0e958
JA
2116 .category = FIO_OPT_C_IO,
2117 .group = FIO_OPT_G_INVALID,
d529ee19 2118 },
214e1eca
JA
2119 {
2120 .name = "verify",
e8b0e958 2121 .lname = "Verify",
214e1eca
JA
2122 .type = FIO_OPT_STR,
2123 .off1 = td_var_offset(verify),
2124 .help = "Verify data written",
2125 .def = "0",
e8b0e958 2126 .category = FIO_OPT_C_IO,
3ceb458f 2127 .group = FIO_OPT_G_VERIFY,
214e1eca
JA
2128 .posval = {
2129 { .ival = "0",
2130 .oval = VERIFY_NONE,
2131 .help = "Don't do IO verification",
2132 },
fcca4b58
JA
2133 { .ival = "md5",
2134 .oval = VERIFY_MD5,
2135 .help = "Use md5 checksums for verification",
2136 },
d77a7af3
JA
2137 { .ival = "crc64",
2138 .oval = VERIFY_CRC64,
2139 .help = "Use crc64 checksums for verification",
2140 },
214e1eca
JA
2141 { .ival = "crc32",
2142 .oval = VERIFY_CRC32,
2143 .help = "Use crc32 checksums for verification",
2144 },
af497e6a 2145 { .ival = "crc32c-intel",
e3aaafc4
JA
2146 .oval = VERIFY_CRC32C,
2147 .help = "Use crc32c checksums for verification (hw assisted, if available)",
af497e6a 2148 },
bac39e0e
JA
2149 { .ival = "crc32c",
2150 .oval = VERIFY_CRC32C,
e3aaafc4 2151 .help = "Use crc32c checksums for verification (hw assisted, if available)",
bac39e0e 2152 },
969f7ed3
JA
2153 { .ival = "crc16",
2154 .oval = VERIFY_CRC16,
2155 .help = "Use crc16 checksums for verification",
2156 },
1e154bdb
JA
2157 { .ival = "crc7",
2158 .oval = VERIFY_CRC7,
2159 .help = "Use crc7 checksums for verification",
2160 },
7c353ceb
JA
2161 { .ival = "sha1",
2162 .oval = VERIFY_SHA1,
2163 .help = "Use sha1 checksums for verification",
2164 },
cd14cc10
JA
2165 { .ival = "sha256",
2166 .oval = VERIFY_SHA256,
2167 .help = "Use sha256 checksums for verification",
2168 },
2169 { .ival = "sha512",
2170 .oval = VERIFY_SHA512,
2171 .help = "Use sha512 checksums for verification",
2172 },
844ea602
JA
2173 { .ival = "xxhash",
2174 .oval = VERIFY_XXHASH,
2175 .help = "Use xxhash checksums for verification",
2176 },
b638d82f
RP
2177 /* Meta information was included into verify_header,
2178 * 'meta' verification is implied by default. */
7437ee87 2179 { .ival = "meta",
b638d82f
RP
2180 .oval = VERIFY_HDR_ONLY,
2181 .help = "Use io information for verification. "
2182 "Now is implied by default, thus option is obsolete, "
2183 "don't use it",
7437ee87 2184 },
59245381
JA
2185 { .ival = "pattern",
2186 .oval = VERIFY_PATTERN_NO_HDR,
2187 .help = "Verify strict pattern",
2188 },
36690c9b
JA
2189 {
2190 .ival = "null",
2191 .oval = VERIFY_NULL,
2192 .help = "Pretend to verify",
2193 },
214e1eca
JA
2194 },
2195 },
005c565a
JA
2196 {
2197 .name = "do_verify",
e8b0e958 2198 .lname = "Perform verify step",
68e1f29a 2199 .type = FIO_OPT_BOOL,
005c565a
JA
2200 .off1 = td_var_offset(do_verify),
2201 .help = "Run verification stage after write",
2202 .def = "1",
2203 .parent = "verify",
d71c154c 2204 .hide = 1,
e8b0e958
JA
2205 .category = FIO_OPT_C_IO,
2206 .group = FIO_OPT_G_VERIFY,
005c565a 2207 },
160b966d
JA
2208 {
2209 .name = "verifysort",
e8b0e958 2210 .lname = "Verify sort",
160b966d
JA
2211 .type = FIO_OPT_BOOL,
2212 .off1 = td_var_offset(verifysort),
2213 .help = "Sort written verify blocks for read back",
2214 .def = "1",
c83f2df1 2215 .parent = "verify",
d71c154c 2216 .hide = 1,
e8b0e958
JA
2217 .category = FIO_OPT_C_IO,
2218 .group = FIO_OPT_G_VERIFY,
160b966d 2219 },
1ae83d45
JA
2220 {
2221 .name = "verifysort_nr",
2222 .type = FIO_OPT_INT,
2223 .off1 = td_var_offset(verifysort_nr),
2224 .help = "Pre-load and sort verify blocks for a read workload",
2225 .minval = 0,
2226 .maxval = 131072,
2227 .def = "1024",
2228 .parent = "verify",
836fcc0f
JA
2229 .category = FIO_OPT_C_IO,
2230 .group = FIO_OPT_G_VERIFY,
1ae83d45 2231 },
3f9f4e26 2232 {
a59e170d 2233 .name = "verify_interval",
e8b0e958 2234 .lname = "Verify interval",
e01b22b8 2235 .type = FIO_OPT_INT,
a59e170d 2236 .off1 = td_var_offset(verify_interval),
819a9680 2237 .minval = 2 * sizeof(struct verify_header),
a59e170d 2238 .help = "Store verify buffer header every N bytes",
afdf9352 2239 .parent = "verify",
d71c154c 2240 .hide = 1,
20eb06bd 2241 .interval = 2 * sizeof(struct verify_header),
e8b0e958
JA
2242 .category = FIO_OPT_C_IO,
2243 .group = FIO_OPT_G_VERIFY,
3f9f4e26 2244 },
546a9142 2245 {
a59e170d 2246 .name = "verify_offset",
e8b0e958 2247 .lname = "Verify offset",
e01b22b8 2248 .type = FIO_OPT_INT,
a59e170d 2249 .help = "Offset verify header location by N bytes",
203160d5
JA
2250 .off1 = td_var_offset(verify_offset),
2251 .minval = sizeof(struct verify_header),
afdf9352 2252 .parent = "verify",
d71c154c 2253 .hide = 1,
e8b0e958
JA
2254 .category = FIO_OPT_C_IO,
2255 .group = FIO_OPT_G_VERIFY,
546a9142 2256 },
e28218f3
SL
2257 {
2258 .name = "verify_pattern",
e8b0e958 2259 .lname = "Verify pattern",
0e92f873 2260 .type = FIO_OPT_STR,
e28218f3 2261 .cb = str_verify_pattern_cb,
a8523a6a 2262 .off1 = td_var_offset(verify_pattern),
e28218f3
SL
2263 .help = "Fill pattern for IO buffers",
2264 .parent = "verify",
d71c154c 2265 .hide = 1,
e8b0e958
JA
2266 .category = FIO_OPT_C_IO,
2267 .group = FIO_OPT_G_VERIFY,
e28218f3 2268 },
a12a3b4d
JA
2269 {
2270 .name = "verify_fatal",
e8b0e958 2271 .lname = "Verify fatal",
68e1f29a 2272 .type = FIO_OPT_BOOL,
a12a3b4d
JA
2273 .off1 = td_var_offset(verify_fatal),
2274 .def = "0",
2275 .help = "Exit on a single verify failure, don't continue",
2276 .parent = "verify",
d71c154c 2277 .hide = 1,
e8b0e958
JA
2278 .category = FIO_OPT_C_IO,
2279 .group = FIO_OPT_G_VERIFY,
a12a3b4d 2280 },
b463e936
JA
2281 {
2282 .name = "verify_dump",
e8b0e958 2283 .lname = "Verify dump",
b463e936
JA
2284 .type = FIO_OPT_BOOL,
2285 .off1 = td_var_offset(verify_dump),
ef71e317 2286 .def = "0",
b463e936
JA
2287 .help = "Dump contents of good and bad blocks on failure",
2288 .parent = "verify",
d71c154c 2289 .hide = 1,
e8b0e958
JA
2290 .category = FIO_OPT_C_IO,
2291 .group = FIO_OPT_G_VERIFY,
b463e936 2292 },
e8462bd8
JA
2293 {
2294 .name = "verify_async",
e8b0e958 2295 .lname = "Verify asynchronously",
e8462bd8
JA
2296 .type = FIO_OPT_INT,
2297 .off1 = td_var_offset(verify_async),
2298 .def = "0",
2299 .help = "Number of async verifier threads to use",
2300 .parent = "verify",
d71c154c 2301 .hide = 1,
e8b0e958
JA
2302 .category = FIO_OPT_C_IO,
2303 .group = FIO_OPT_G_VERIFY,
e8462bd8 2304 },
9e144189
JA
2305 {
2306 .name = "verify_backlog",
e8b0e958 2307 .lname = "Verify backlog",
9e144189
JA
2308 .type = FIO_OPT_STR_VAL,
2309 .off1 = td_var_offset(verify_backlog),
2310 .help = "Verify after this number of blocks are written",
2311 .parent = "verify",
d71c154c 2312 .hide = 1,
e8b0e958
JA
2313 .category = FIO_OPT_C_IO,
2314 .group = FIO_OPT_G_VERIFY,
9e144189
JA
2315 },
2316 {
2317 .name = "verify_backlog_batch",
e8b0e958 2318 .lname = "Verify backlog batch",
9e144189
JA
2319 .type = FIO_OPT_INT,
2320 .off1 = td_var_offset(verify_batch),
2321 .help = "Verify this number of IO blocks",
0d29de83 2322 .parent = "verify",
d71c154c 2323 .hide = 1,
e8b0e958
JA
2324 .category = FIO_OPT_C_IO,
2325 .group = FIO_OPT_G_VERIFY,
9e144189 2326 },
e8462bd8
JA
2327#ifdef FIO_HAVE_CPU_AFFINITY
2328 {
2329 .name = "verify_async_cpus",
e8b0e958 2330 .lname = "Async verify CPUs",
e8462bd8
JA
2331 .type = FIO_OPT_STR,
2332 .cb = str_verify_cpus_allowed_cb,
a8523a6a 2333 .off1 = td_var_offset(verify_cpumask),
e8462bd8
JA
2334 .help = "Set CPUs allowed for async verify threads",
2335 .parent = "verify_async",
d71c154c 2336 .hide = 1,
e8b0e958
JA
2337 .category = FIO_OPT_C_IO,
2338 .group = FIO_OPT_G_VERIFY,
e8462bd8 2339 },
0d29de83 2340#endif
51aa2da8
JA
2341 {
2342 .name = "experimental_verify",
2343 .off1 = td_var_offset(experimental_verify),
2344 .type = FIO_OPT_BOOL,
b31eaac9 2345 .help = "Enable experimental verification",
ca09be4b
JA
2346 .parent = "verify",
2347 .category = FIO_OPT_C_IO,
2348 .group = FIO_OPT_G_VERIFY,
2349 },
2350 {
2351 .name = "verify_state_load",
2352 .lname = "Load verify state",
2353 .off1 = td_var_offset(verify_state),
2354 .type = FIO_OPT_BOOL,
2355 .help = "Load verify termination state",
2356 .parent = "verify",
2357 .category = FIO_OPT_C_IO,
2358 .group = FIO_OPT_G_VERIFY,
2359 },
2360 {
2361 .name = "verify_state_save",
2362 .lname = "Save verify state",
2363 .off1 = td_var_offset(verify_state_save),
2364 .type = FIO_OPT_BOOL,
2365 .def = "1",
2366 .help = "Save verify state on termination",
2367 .parent = "verify",
836fcc0f
JA
2368 .category = FIO_OPT_C_IO,
2369 .group = FIO_OPT_G_VERIFY,
51aa2da8 2370 },
0d29de83
JA
2371#ifdef FIO_HAVE_TRIM
2372 {
2373 .name = "trim_percentage",
e8b0e958 2374 .lname = "Trim percentage",
0d29de83 2375 .type = FIO_OPT_INT,
203160d5 2376 .off1 = td_var_offset(trim_percentage),
20eb06bd 2377 .minval = 0,
0d29de83
JA
2378 .maxval = 100,
2379 .help = "Number of verify blocks to discard/trim",
2380 .parent = "verify",
2381 .def = "0",
20eb06bd 2382 .interval = 1,
d71c154c 2383 .hide = 1,
e8b0e958
JA
2384 .category = FIO_OPT_C_IO,
2385 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2386 },
2387 {
2388 .name = "trim_verify_zero",
e8b0e958 2389 .lname = "Verify trim zero",
20eb06bd 2390 .type = FIO_OPT_BOOL,
0d29de83
JA
2391 .help = "Verify that trim/discarded blocks are returned as zeroes",
2392 .off1 = td_var_offset(trim_zero),
2393 .parent = "trim_percentage",
d71c154c 2394 .hide = 1,
0d29de83 2395 .def = "1",
e8b0e958
JA
2396 .category = FIO_OPT_C_IO,
2397 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2398 },
2399 {
2400 .name = "trim_backlog",
e8b0e958 2401 .lname = "Trim backlog",
0d29de83
JA
2402 .type = FIO_OPT_STR_VAL,
2403 .off1 = td_var_offset(trim_backlog),
2404 .help = "Trim after this number of blocks are written",
2405 .parent = "trim_percentage",
d71c154c 2406 .hide = 1,
20eb06bd 2407 .interval = 1,
e8b0e958
JA
2408 .category = FIO_OPT_C_IO,
2409 .group = FIO_OPT_G_TRIM,
0d29de83
JA
2410 },
2411 {
2412 .name = "trim_backlog_batch",
e8b0e958 2413 .lname = "Trim backlog batch",
0d29de83
JA
2414 .type = FIO_OPT_INT,
2415 .off1 = td_var_offset(trim_batch),
2416 .help = "Trim this number of IO blocks",
2417 .parent = "trim_percentage",
d71c154c 2418 .hide = 1,
20eb06bd 2419 .interval = 1,
e8b0e958
JA
2420 .category = FIO_OPT_C_IO,
2421 .group = FIO_OPT_G_TRIM,
0d29de83 2422 },
e8462bd8 2423#endif
214e1eca
JA
2424 {
2425 .name = "write_iolog",
e8b0e958 2426 .lname = "Write I/O log",
214e1eca
JA
2427 .type = FIO_OPT_STR_STORE,
2428 .off1 = td_var_offset(write_iolog_file),
2429 .help = "Store IO pattern to file",
e8b0e958
JA
2430 .category = FIO_OPT_C_IO,
2431 .group = FIO_OPT_G_IOLOG,
214e1eca
JA
2432 },
2433 {
2434 .name = "read_iolog",
e8b0e958 2435 .lname = "Read I/O log",
214e1eca
JA
2436 .type = FIO_OPT_STR_STORE,
2437 .off1 = td_var_offset(read_iolog_file),
2438 .help = "Playback IO pattern from file",
e8b0e958
JA
2439 .category = FIO_OPT_C_IO,
2440 .group = FIO_OPT_G_IOLOG,
214e1eca 2441 },
64bbb865
DN
2442 {
2443 .name = "replay_no_stall",
e8b0e958 2444 .lname = "Don't stall on replay",
20eb06bd 2445 .type = FIO_OPT_BOOL,
64bbb865
DN
2446 .off1 = td_var_offset(no_stall),
2447 .def = "0",
87e7a972 2448 .parent = "read_iolog",
d71c154c 2449 .hide = 1,
64bbb865 2450 .help = "Playback IO pattern file as fast as possible without stalls",
e8b0e958
JA
2451 .category = FIO_OPT_C_IO,
2452 .group = FIO_OPT_G_IOLOG,
64bbb865 2453 },
d1c46c04
DN
2454 {
2455 .name = "replay_redirect",
e8b0e958 2456 .lname = "Redirect device for replay",
d1c46c04
DN
2457 .type = FIO_OPT_STR_STORE,
2458 .off1 = td_var_offset(replay_redirect),
2459 .parent = "read_iolog",
d71c154c 2460 .hide = 1,
d1c46c04 2461 .help = "Replay all I/O onto this device, regardless of trace device",
e8b0e958
JA
2462 .category = FIO_OPT_C_IO,
2463 .group = FIO_OPT_G_IOLOG,
d1c46c04 2464 },
0c63576e
JA
2465 {
2466 .name = "replay_scale",
2467 .lname = "Replace offset scale factor",
2468 .type = FIO_OPT_INT,
2469 .off1 = td_var_offset(replay_scale),
2470 .parent = "read_iolog",
2471 .def = "1",
2472 .help = "Align offsets to this blocksize",
2473 .category = FIO_OPT_C_IO,
2474 .group = FIO_OPT_G_IOLOG,
2475 },
2476 {
2477 .name = "replay_align",
2478 .lname = "Replace alignment",
2479 .type = FIO_OPT_INT,
2480 .off1 = td_var_offset(replay_align),
2481 .parent = "read_iolog",
2482 .help = "Scale offset down by this factor",
2483 .category = FIO_OPT_C_IO,
2484 .group = FIO_OPT_G_IOLOG,
2485 .pow2 = 1,
2486 },
214e1eca
JA
2487 {
2488 .name = "exec_prerun",
e8b0e958 2489 .lname = "Pre-execute runnable",
214e1eca
JA
2490 .type = FIO_OPT_STR_STORE,
2491 .off1 = td_var_offset(exec_prerun),
2492 .help = "Execute this file prior to running job",
e8b0e958
JA
2493 .category = FIO_OPT_C_GENERAL,
2494 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2495 },
2496 {
2497 .name = "exec_postrun",
e8b0e958 2498 .lname = "Post-execute runnable",
214e1eca
JA
2499 .type = FIO_OPT_STR_STORE,
2500 .off1 = td_var_offset(exec_postrun),
2501 .help = "Execute this file after running job",
e8b0e958
JA
2502 .category = FIO_OPT_C_GENERAL,
2503 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2504 },
2505#ifdef FIO_HAVE_IOSCHED_SWITCH
2506 {
2507 .name = "ioscheduler",
e8b0e958 2508 .lname = "I/O scheduler",
214e1eca
JA
2509 .type = FIO_OPT_STR_STORE,
2510 .off1 = td_var_offset(ioscheduler),
2511 .help = "Use this IO scheduler on the backing device",
e8b0e958
JA
2512 .category = FIO_OPT_C_FILE,
2513 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2514 },
2515#endif
2516 {
2517 .name = "zonesize",
e8b0e958 2518 .lname = "Zone size",
214e1eca
JA
2519 .type = FIO_OPT_STR_VAL,
2520 .off1 = td_var_offset(zone_size),
ed335855
SN
2521 .help = "Amount of data to read per zone",
2522 .def = "0",
20eb06bd 2523 .interval = 1024 * 1024,
e8b0e958
JA
2524 .category = FIO_OPT_C_IO,
2525 .group = FIO_OPT_G_ZONE,
ed335855
SN
2526 },
2527 {
2528 .name = "zonerange",
e8b0e958 2529 .lname = "Zone range",
ed335855
SN
2530 .type = FIO_OPT_STR_VAL,
2531 .off1 = td_var_offset(zone_range),
214e1eca
JA
2532 .help = "Give size of an IO zone",
2533 .def = "0",
20eb06bd 2534 .interval = 1024 * 1024,
e8b0e958
JA
2535 .category = FIO_OPT_C_IO,
2536 .group = FIO_OPT_G_ZONE,
214e1eca
JA
2537 },
2538 {
2539 .name = "zoneskip",
e8b0e958 2540 .lname = "Zone skip",
214e1eca
JA
2541 .type = FIO_OPT_STR_VAL,
2542 .off1 = td_var_offset(zone_skip),
2543 .help = "Space between IO zones",
2544 .def = "0",
20eb06bd 2545 .interval = 1024 * 1024,
e8b0e958
JA
2546 .category = FIO_OPT_C_IO,
2547 .group = FIO_OPT_G_ZONE,
214e1eca
JA
2548 },
2549 {
2550 .name = "lockmem",
e8b0e958 2551 .lname = "Lock memory",
214e1eca 2552 .type = FIO_OPT_STR_VAL,
1b79a070 2553 .off1 = td_var_offset(lockmem),
81c6b6cd 2554 .help = "Lock down this amount of memory (per worker)",
214e1eca 2555 .def = "0",
20eb06bd 2556 .interval = 1024 * 1024,
e8b0e958
JA
2557 .category = FIO_OPT_C_GENERAL,
2558 .group = FIO_OPT_G_INVALID,
214e1eca 2559 },
214e1eca
JA
2560 {
2561 .name = "rwmixread",
e8b0e958 2562 .lname = "Read/write mix read",
214e1eca 2563 .type = FIO_OPT_INT,
cb499fc4 2564 .cb = str_rwmix_read_cb,
a8523a6a 2565 .off1 = td_var_offset(rwmix[DDIR_READ]),
214e1eca
JA
2566 .maxval = 100,
2567 .help = "Percentage of mixed workload that is reads",
2568 .def = "50",
20eb06bd 2569 .interval = 5,
90265353 2570 .inverse = "rwmixwrite",
e8b0e958
JA
2571 .category = FIO_OPT_C_IO,
2572 .group = FIO_OPT_G_RWMIX,
214e1eca
JA
2573 },
2574 {
2575 .name = "rwmixwrite",
e8b0e958 2576 .lname = "Read/write mix write",
214e1eca 2577 .type = FIO_OPT_INT,
cb499fc4 2578 .cb = str_rwmix_write_cb,
a8523a6a 2579 .off1 = td_var_offset(rwmix[DDIR_WRITE]),
214e1eca
JA
2580 .maxval = 100,
2581 .help = "Percentage of mixed workload that is writes",
2582 .def = "50",
20eb06bd 2583 .interval = 5,
90265353 2584 .inverse = "rwmixread",
e8b0e958
JA
2585 .category = FIO_OPT_C_IO,
2586 .group = FIO_OPT_G_RWMIX,
214e1eca 2587 },
afdf9352
JA
2588 {
2589 .name = "rwmixcycle",
e8b0e958 2590 .lname = "Read/write mix cycle",
15ca150e 2591 .type = FIO_OPT_DEPRECATED,
e8b0e958
JA
2592 .category = FIO_OPT_C_IO,
2593 .group = FIO_OPT_G_RWMIX,
afdf9352 2594 },
214e1eca
JA
2595 {
2596 .name = "nice",
e8b0e958 2597 .lname = "Nice",
214e1eca
JA
2598 .type = FIO_OPT_INT,
2599 .off1 = td_var_offset(nice),
2600 .help = "Set job CPU nice value",
2601 .minval = -19,
2602 .maxval = 20,
2603 .def = "0",
20eb06bd 2604 .interval = 1,
e8b0e958 2605 .category = FIO_OPT_C_GENERAL,
10860056 2606 .group = FIO_OPT_G_CRED,
214e1eca
JA
2607 },
2608#ifdef FIO_HAVE_IOPRIO
2609 {
2610 .name = "prio",
e8b0e958 2611 .lname = "I/O nice priority",
214e1eca 2612 .type = FIO_OPT_INT,
28727df7 2613 .off1 = td_var_offset(ioprio),
214e1eca
JA
2614 .help = "Set job IO priority value",
2615 .minval = 0,
2616 .maxval = 7,
20eb06bd 2617 .interval = 1,
e8b0e958 2618 .category = FIO_OPT_C_GENERAL,
10860056 2619 .group = FIO_OPT_G_CRED,
214e1eca
JA
2620 },
2621 {
2622 .name = "prioclass",
e8b0e958 2623 .lname = "I/O nice priority class",
214e1eca 2624 .type = FIO_OPT_INT,
28727df7 2625 .off1 = td_var_offset(ioprio_class),
214e1eca
JA
2626 .help = "Set job IO priority class",
2627 .minval = 0,
2628 .maxval = 3,
20eb06bd 2629 .interval = 1,
e8b0e958 2630 .category = FIO_OPT_C_GENERAL,
10860056 2631 .group = FIO_OPT_G_CRED,
214e1eca
JA
2632 },
2633#endif
2634 {
2635 .name = "thinktime",
e8b0e958 2636 .lname = "Thinktime",
214e1eca
JA
2637 .type = FIO_OPT_INT,
2638 .off1 = td_var_offset(thinktime),
2639 .help = "Idle time between IO buffers (usec)",
2640 .def = "0",
88038bc7 2641 .is_time = 1,
e8b0e958 2642 .category = FIO_OPT_C_IO,
3ceb458f 2643 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2644 },
2645 {
2646 .name = "thinktime_spin",
e8b0e958 2647 .lname = "Thinktime spin",
214e1eca
JA
2648 .type = FIO_OPT_INT,
2649 .off1 = td_var_offset(thinktime_spin),
2650 .help = "Start think time by spinning this amount (usec)",
2651 .def = "0",
88038bc7 2652 .is_time = 1,
afdf9352 2653 .parent = "thinktime",
d71c154c 2654 .hide = 1,
e8b0e958 2655 .category = FIO_OPT_C_IO,
3ceb458f 2656 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2657 },
2658 {
2659 .name = "thinktime_blocks",
e8b0e958 2660 .lname = "Thinktime blocks",
214e1eca
JA
2661 .type = FIO_OPT_INT,
2662 .off1 = td_var_offset(thinktime_blocks),
2663 .help = "IO buffer period between 'thinktime'",
2664 .def = "1",
afdf9352 2665 .parent = "thinktime",
d71c154c 2666 .hide = 1,
e8b0e958 2667 .category = FIO_OPT_C_IO,
3ceb458f 2668 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
2669 },
2670 {
2671 .name = "rate",
e8b0e958 2672 .lname = "I/O rate",
e01b22b8 2673 .type = FIO_OPT_INT,
6eaf09d6
SL
2674 .off1 = td_var_offset(rate[DDIR_READ]),
2675 .off2 = td_var_offset(rate[DDIR_WRITE]),
2676 .off3 = td_var_offset(rate[DDIR_TRIM]),
214e1eca 2677 .help = "Set bandwidth rate",
e8b0e958
JA
2678 .category = FIO_OPT_C_IO,
2679 .group = FIO_OPT_G_RATE,
214e1eca
JA
2680 },
2681 {
6d428bcd
JA
2682 .name = "rate_min",
2683 .alias = "ratemin",
e8b0e958 2684 .lname = "I/O min rate",
e01b22b8 2685 .type = FIO_OPT_INT,
6eaf09d6
SL
2686 .off1 = td_var_offset(ratemin[DDIR_READ]),
2687 .off2 = td_var_offset(ratemin[DDIR_WRITE]),
2688 .off3 = td_var_offset(ratemin[DDIR_TRIM]),
4e991c23 2689 .help = "Job must meet this rate or it will be shutdown",
afdf9352 2690 .parent = "rate",
d71c154c 2691 .hide = 1,
e8b0e958
JA
2692 .category = FIO_OPT_C_IO,
2693 .group = FIO_OPT_G_RATE,
4e991c23
JA
2694 },
2695 {
2696 .name = "rate_iops",
e8b0e958 2697 .lname = "I/O rate IOPS",
e01b22b8 2698 .type = FIO_OPT_INT,
6eaf09d6
SL
2699 .off1 = td_var_offset(rate_iops[DDIR_READ]),
2700 .off2 = td_var_offset(rate_iops[DDIR_WRITE]),
2701 .off3 = td_var_offset(rate_iops[DDIR_TRIM]),
4e991c23 2702 .help = "Limit IO used to this number of IO operations/sec",
d71c154c 2703 .hide = 1,
e8b0e958
JA
2704 .category = FIO_OPT_C_IO,
2705 .group = FIO_OPT_G_RATE,
4e991c23
JA
2706 },
2707 {
2708 .name = "rate_iops_min",
e8b0e958 2709 .lname = "I/O min rate IOPS",
e01b22b8 2710 .type = FIO_OPT_INT,
6eaf09d6
SL
2711 .off1 = td_var_offset(rate_iops_min[DDIR_READ]),
2712 .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]),
2713 .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]),
03e20d68 2714 .help = "Job must meet this rate or it will be shut down",
afdf9352 2715 .parent = "rate_iops",
d71c154c 2716 .hide = 1,
e8b0e958
JA
2717 .category = FIO_OPT_C_IO,
2718 .group = FIO_OPT_G_RATE,
214e1eca 2719 },
ff6bb260 2720 {
6de65959
JA
2721 .name = "rate_process",
2722 .lname = "Rate Process",
2723 .type = FIO_OPT_STR,
2724 .off1 = td_var_offset(rate_process),
2725 .help = "What process controls how rated IO is managed",
2726 .def = "linear",
ff6bb260
SL
2727 .category = FIO_OPT_C_IO,
2728 .group = FIO_OPT_G_RATE,
6de65959
JA
2729 .posval = {
2730 { .ival = "linear",
2731 .oval = RATE_PROCESS_LINEAR,
2732 .help = "Linear rate of IO",
2733 },
2734 {
2735 .ival = "poisson",
2736 .oval = RATE_PROCESS_POISSON,
2737 .help = "Rate follows Poisson process",
2738 },
2739 },
2740 .parent = "rate",
ff6bb260 2741 },
214e1eca 2742 {
6d428bcd
JA
2743 .name = "rate_cycle",
2744 .alias = "ratecycle",
e8b0e958 2745 .lname = "I/O rate cycle",
214e1eca
JA
2746 .type = FIO_OPT_INT,
2747 .off1 = td_var_offset(ratecycle),
2748 .help = "Window average for rate limits (msec)",
2749 .def = "1000",
afdf9352 2750 .parent = "rate",
d71c154c 2751 .hide = 1,
e8b0e958
JA
2752 .category = FIO_OPT_C_IO,
2753 .group = FIO_OPT_G_RATE,
214e1eca 2754 },
15501535
JA
2755 {
2756 .name = "max_latency",
2757 .type = FIO_OPT_INT,
2758 .off1 = td_var_offset(max_latency),
2759 .help = "Maximum tolerated IO latency (usec)",
88038bc7 2760 .is_time = 1,
1e5324e7 2761 .category = FIO_OPT_C_IO,
3e260a46
JA
2762 .group = FIO_OPT_G_LATPROF,
2763 },
2764 {
2765 .name = "latency_target",
2766 .lname = "Latency Target (usec)",
2767 .type = FIO_OPT_STR_VAL_TIME,
2768 .off1 = td_var_offset(latency_target),
2769 .help = "Ramp to max queue depth supporting this latency",
88038bc7 2770 .is_time = 1,
3e260a46
JA
2771 .category = FIO_OPT_C_IO,
2772 .group = FIO_OPT_G_LATPROF,
2773 },
2774 {
2775 .name = "latency_window",
2776 .lname = "Latency Window (usec)",
2777 .type = FIO_OPT_STR_VAL_TIME,
2778 .off1 = td_var_offset(latency_window),
2779 .help = "Time to sustain latency_target",
88038bc7 2780 .is_time = 1,
3e260a46
JA
2781 .category = FIO_OPT_C_IO,
2782 .group = FIO_OPT_G_LATPROF,
2783 },
2784 {
2785 .name = "latency_percentile",
2786 .lname = "Latency Percentile",
2787 .type = FIO_OPT_FLOAT_LIST,
2788 .off1 = td_var_offset(latency_percentile),
2789 .help = "Percentile of IOs must be below latency_target",
2790 .def = "100",
2791 .maxlen = 1,
2792 .minfp = 0.0,
2793 .maxfp = 100.0,
2794 .category = FIO_OPT_C_IO,
2795 .group = FIO_OPT_G_LATPROF,
15501535 2796 },
214e1eca
JA
2797 {
2798 .name = "invalidate",
e8b0e958 2799 .lname = "Cache invalidate",
214e1eca
JA
2800 .type = FIO_OPT_BOOL,
2801 .off1 = td_var_offset(invalidate_cache),
2802 .help = "Invalidate buffer/page cache prior to running job",
2803 .def = "1",
e8b0e958 2804 .category = FIO_OPT_C_IO,
3ceb458f 2805 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2806 },
2807 {
2808 .name = "sync",
e8b0e958 2809 .lname = "Synchronous I/O",
214e1eca
JA
2810 .type = FIO_OPT_BOOL,
2811 .off1 = td_var_offset(sync_io),
2812 .help = "Use O_SYNC for buffered writes",
2813 .def = "0",
67a1000f 2814 .parent = "buffered",
d71c154c 2815 .hide = 1,
e8b0e958 2816 .category = FIO_OPT_C_IO,
3ceb458f 2817 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2818 },
214e1eca
JA
2819 {
2820 .name = "create_serialize",
e8b0e958 2821 .lname = "Create serialize",
214e1eca
JA
2822 .type = FIO_OPT_BOOL,
2823 .off1 = td_var_offset(create_serialize),
2824 .help = "Serialize creating of job files",
2825 .def = "1",
e8b0e958
JA
2826 .category = FIO_OPT_C_FILE,
2827 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2828 },
2829 {
2830 .name = "create_fsync",
e8b0e958 2831 .lname = "Create fsync",
214e1eca
JA
2832 .type = FIO_OPT_BOOL,
2833 .off1 = td_var_offset(create_fsync),
03e20d68 2834 .help = "fsync file after creation",
214e1eca 2835 .def = "1",
e8b0e958
JA
2836 .category = FIO_OPT_C_FILE,
2837 .group = FIO_OPT_G_INVALID,
214e1eca 2838 },
814452bd
JA
2839 {
2840 .name = "create_on_open",
e8b0e958 2841 .lname = "Create on open",
814452bd
JA
2842 .type = FIO_OPT_BOOL,
2843 .off1 = td_var_offset(create_on_open),
2844 .help = "Create files when they are opened for IO",
2845 .def = "0",
e8b0e958
JA
2846 .category = FIO_OPT_C_FILE,
2847 .group = FIO_OPT_G_INVALID,
814452bd 2848 },
25460cf6
JA
2849 {
2850 .name = "create_only",
2851 .type = FIO_OPT_BOOL,
2852 .off1 = td_var_offset(create_only),
2853 .help = "Only perform file creation phase",
d17fda71 2854 .category = FIO_OPT_C_FILE,
25460cf6
JA
2855 .def = "0",
2856 },
2378826d
JA
2857 {
2858 .name = "allow_file_create",
e81ecca3 2859 .lname = "Allow file create",
2378826d
JA
2860 .type = FIO_OPT_BOOL,
2861 .off1 = td_var_offset(allow_create),
2862 .help = "Permit fio to create files, if they don't exist",
2863 .def = "1",
2864 .category = FIO_OPT_C_FILE,
2865 .group = FIO_OPT_G_FILENAME,
2866 },
e81ecca3
JA
2867 {
2868 .name = "allow_mounted_write",
2869 .lname = "Allow mounted write",
2870 .type = FIO_OPT_BOOL,
2871 .off1 = td_var_offset(allow_mounted_write),
2872 .help = "Allow writes to a mounted partition",
2873 .def = "0",
2874 .category = FIO_OPT_C_FILE,
2875 .group = FIO_OPT_G_FILENAME,
2876 },
0b9d69ec 2877 {
afad68f7 2878 .name = "pre_read",
e8b0e958 2879 .lname = "Pre-read files",
afad68f7
ZY
2880 .type = FIO_OPT_BOOL,
2881 .off1 = td_var_offset(pre_read),
03e20d68 2882 .help = "Pre-read files before starting official testing",
afad68f7 2883 .def = "0",
e8b0e958
JA
2884 .category = FIO_OPT_C_FILE,
2885 .group = FIO_OPT_G_INVALID,
afad68f7 2886 },
214e1eca
JA
2887#ifdef FIO_HAVE_CPU_AFFINITY
2888 {
2889 .name = "cpumask",
e8b0e958 2890 .lname = "CPU mask",
214e1eca
JA
2891 .type = FIO_OPT_INT,
2892 .cb = str_cpumask_cb,
a8523a6a 2893 .off1 = td_var_offset(cpumask),
214e1eca 2894 .help = "CPU affinity mask",
e8b0e958 2895 .category = FIO_OPT_C_GENERAL,
10860056 2896 .group = FIO_OPT_G_CRED,
214e1eca 2897 },
d2e268b0
JA
2898 {
2899 .name = "cpus_allowed",
e8b0e958 2900 .lname = "CPUs allowed",
d2e268b0
JA
2901 .type = FIO_OPT_STR,
2902 .cb = str_cpus_allowed_cb,
a8523a6a 2903 .off1 = td_var_offset(cpumask),
d2e268b0 2904 .help = "Set CPUs allowed",
e8b0e958 2905 .category = FIO_OPT_C_GENERAL,
10860056 2906 .group = FIO_OPT_G_CRED,
d2e268b0 2907 },
c2acfbac
JA
2908 {
2909 .name = "cpus_allowed_policy",
2910 .lname = "CPUs allowed distribution policy",
2911 .type = FIO_OPT_STR,
2912 .off1 = td_var_offset(cpus_allowed_policy),
2913 .help = "Distribution policy for cpus_allowed",
2914 .parent = "cpus_allowed",
2915 .prio = 1,
2916 .posval = {
2917 { .ival = "shared",
2918 .oval = FIO_CPUS_SHARED,
2919 .help = "Mask shared between threads",
2920 },
2921 { .ival = "split",
2922 .oval = FIO_CPUS_SPLIT,
2923 .help = "Mask split between threads",
2924 },
2925 },
2926 .category = FIO_OPT_C_GENERAL,
2927 .group = FIO_OPT_G_CRED,
2928 },
d0b937ed 2929#endif
67bf9823 2930#ifdef CONFIG_LIBNUMA
d0b937ed
YR
2931 {
2932 .name = "numa_cpu_nodes",
2933 .type = FIO_OPT_STR,
2934 .cb = str_numa_cpunodes_cb,
b2a9e649 2935 .off1 = td_var_offset(numa_cpunodes),
d0b937ed 2936 .help = "NUMA CPU nodes bind",
6be54b2d
JA
2937 .category = FIO_OPT_C_GENERAL,
2938 .group = FIO_OPT_G_INVALID,
d0b937ed
YR
2939 },
2940 {
2941 .name = "numa_mem_policy",
2942 .type = FIO_OPT_STR,
2943 .cb = str_numa_mpol_cb,
b2a9e649 2944 .off1 = td_var_offset(numa_memnodes),
d0b937ed 2945 .help = "NUMA memory policy setup",
6be54b2d
JA
2946 .category = FIO_OPT_C_GENERAL,
2947 .group = FIO_OPT_G_INVALID,
d0b937ed 2948 },
214e1eca
JA
2949#endif
2950 {
2951 .name = "end_fsync",
e8b0e958 2952 .lname = "End fsync",
214e1eca
JA
2953 .type = FIO_OPT_BOOL,
2954 .off1 = td_var_offset(end_fsync),
2955 .help = "Include fsync at the end of job",
2956 .def = "0",
e8b0e958
JA
2957 .category = FIO_OPT_C_FILE,
2958 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2959 },
2960 {
2961 .name = "fsync_on_close",
e8b0e958 2962 .lname = "Fsync on close",
214e1eca
JA
2963 .type = FIO_OPT_BOOL,
2964 .off1 = td_var_offset(fsync_on_close),
2965 .help = "fsync files on close",
2966 .def = "0",
e8b0e958
JA
2967 .category = FIO_OPT_C_FILE,
2968 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2969 },
2970 {
2971 .name = "unlink",
e8b0e958 2972 .lname = "Unlink file",
214e1eca
JA
2973 .type = FIO_OPT_BOOL,
2974 .off1 = td_var_offset(unlink),
2975 .help = "Unlink created files after job has completed",
2976 .def = "0",
e8b0e958
JA
2977 .category = FIO_OPT_C_FILE,
2978 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2979 },
2980 {
2981 .name = "exitall",
e8b0e958 2982 .lname = "Exit-all on terminate",
214e1eca
JA
2983 .type = FIO_OPT_STR_SET,
2984 .cb = str_exitall_cb,
2985 .help = "Terminate all jobs when one exits",
e8b0e958 2986 .category = FIO_OPT_C_GENERAL,
a1f6afec 2987 .group = FIO_OPT_G_PROCESS,
214e1eca 2988 },
f9cafb12
JA
2989 {
2990 .name = "exitall_on_error",
2991 .lname = "Exit-all on terminate in error",
2992 .type = FIO_OPT_BOOL,
2993 .off1 = td_var_offset(unlink),
2994 .help = "Terminate all jobs when one exits in error",
2995 .category = FIO_OPT_C_GENERAL,
2996 .group = FIO_OPT_G_PROCESS,
2997 },
214e1eca
JA
2998 {
2999 .name = "stonewall",
e8b0e958 3000 .lname = "Wait for previous",
d392365e 3001 .alias = "wait_for_previous",
214e1eca
JA
3002 .type = FIO_OPT_STR_SET,
3003 .off1 = td_var_offset(stonewall),
3004 .help = "Insert a hard barrier between this job and previous",
e8b0e958 3005 .category = FIO_OPT_C_GENERAL,
a1f6afec 3006 .group = FIO_OPT_G_PROCESS,
214e1eca 3007 },
b3d62a75
JA
3008 {
3009 .name = "new_group",
e8b0e958 3010 .lname = "New group",
b3d62a75
JA
3011 .type = FIO_OPT_STR_SET,
3012 .off1 = td_var_offset(new_group),
3013 .help = "Mark the start of a new group (for reporting)",
e8b0e958 3014 .category = FIO_OPT_C_GENERAL,
a1f6afec 3015 .group = FIO_OPT_G_PROCESS,
b3d62a75 3016 },
214e1eca
JA
3017 {
3018 .name = "thread",
e8b0e958 3019 .lname = "Thread",
214e1eca
JA
3020 .type = FIO_OPT_STR_SET,
3021 .off1 = td_var_offset(use_thread),
20eb06bd 3022 .help = "Use threads instead of processes",
c8931876
JA
3023#ifdef CONFIG_NO_SHM
3024 .def = "1",
3025 .no_warn_def = 1,
3026#endif
e8b0e958 3027 .category = FIO_OPT_C_GENERAL,
a1f6afec 3028 .group = FIO_OPT_G_PROCESS,
214e1eca 3029 },
3a5db920
JA
3030 {
3031 .name = "per_job_logs",
3032 .type = FIO_OPT_BOOL,
3033 .off1 = td_var_offset(per_job_logs),
3034 .help = "Include job number in generated log files or not",
3035 .def = "1",
3036 .category = FIO_OPT_C_LOG,
3037 .group = FIO_OPT_G_INVALID,
3038 },
214e1eca
JA
3039 {
3040 .name = "write_bw_log",
e8b0e958 3041 .lname = "Write bandwidth log",
203160d5
JA
3042 .type = FIO_OPT_STR_STORE,
3043 .off1 = td_var_offset(bw_log_file),
214e1eca 3044 .help = "Write log of bandwidth during run",
e8b0e958
JA
3045 .category = FIO_OPT_C_LOG,
3046 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3047 },
3048 {
3049 .name = "write_lat_log",
e8b0e958 3050 .lname = "Write latency log",
203160d5
JA
3051 .type = FIO_OPT_STR_STORE,
3052 .off1 = td_var_offset(lat_log_file),
214e1eca 3053 .help = "Write log of latency during run",
e8b0e958
JA
3054 .category = FIO_OPT_C_LOG,
3055 .group = FIO_OPT_G_INVALID,
214e1eca 3056 },
c8eeb9df
JA
3057 {
3058 .name = "write_iops_log",
e8b0e958 3059 .lname = "Write IOPS log",
577c83bd 3060 .type = FIO_OPT_STR_STORE,
203160d5 3061 .off1 = td_var_offset(iops_log_file),
c8eeb9df 3062 .help = "Write log of IOPS during run",
e8b0e958
JA
3063 .category = FIO_OPT_C_LOG,
3064 .group = FIO_OPT_G_INVALID,
c8eeb9df 3065 },
b8bc8cba
JA
3066 {
3067 .name = "log_avg_msec",
e8b0e958 3068 .lname = "Log averaging (msec)",
b8bc8cba
JA
3069 .type = FIO_OPT_INT,
3070 .off1 = td_var_offset(log_avg_msec),
3071 .help = "Average bw/iops/lat logs over this period of time",
3072 .def = "0",
e8b0e958
JA
3073 .category = FIO_OPT_C_LOG,
3074 .group = FIO_OPT_G_INVALID,
b8bc8cba 3075 },
ae588852
JA
3076 {
3077 .name = "log_offset",
3078 .lname = "Log offset of IO",
3079 .type = FIO_OPT_BOOL,
3080 .off1 = td_var_offset(log_offset),
3081 .help = "Include offset of IO for each log entry",
3082 .def = "0",
3083 .category = FIO_OPT_C_LOG,
3084 .group = FIO_OPT_G_INVALID,
3085 },
aee2ab67
JA
3086#ifdef CONFIG_ZLIB
3087 {
3088 .name = "log_compression",
3089 .lname = "Log compression",
3090 .type = FIO_OPT_INT,
3091 .off1 = td_var_offset(log_gz),
3092 .help = "Log in compressed chunks of this size",
9919b27b 3093 .minval = 1024ULL,
aee2ab67
JA
3094 .maxval = 512 * 1024 * 1024ULL,
3095 .category = FIO_OPT_C_LOG,
3096 .group = FIO_OPT_G_INVALID,
3097 },
c08f9fe2
JA
3098#ifdef FIO_HAVE_CPU_AFFINITY
3099 {
3100 .name = "log_compression_cpus",
3101 .lname = "Log Compression CPUs",
3102 .type = FIO_OPT_STR,
3103 .cb = str_log_cpus_allowed_cb,
3104 .off1 = td_var_offset(log_gz_cpumask),
3105 .parent = "log_compression",
3106 .help = "Limit log compression to these CPUs",
3107 .category = FIO_OPT_C_LOG,
3108 .group = FIO_OPT_G_INVALID,
3109 },
3110#endif
b26317c9
JA
3111 {
3112 .name = "log_store_compressed",
3113 .lname = "Log store compressed",
3114 .type = FIO_OPT_BOOL,
3115 .off1 = td_var_offset(log_gz_store),
3116 .help = "Store logs in a compressed format",
3117 .category = FIO_OPT_C_LOG,
3118 .group = FIO_OPT_G_INVALID,
3119 },
aee2ab67 3120#endif
66347cfa
DE
3121 {
3122 .name = "block_error_percentiles",
3123 .lname = "Block error percentiles",
3124 .type = FIO_OPT_BOOL,
3125 .off1 = td_var_offset(block_error_hist),
3126 .help = "Record trim block errors and make a histogram",
3127 .def = "0",
3128 .category = FIO_OPT_C_LOG,
3129 .group = FIO_OPT_G_INVALID,
3130 },
c504ee55
JA
3131 {
3132 .name = "bwavgtime",
3133 .lname = "Bandwidth average time",
3134 .type = FIO_OPT_INT,
3135 .off1 = td_var_offset(bw_avg_time),
3136 .help = "Time window over which to calculate bandwidth"
3137 " (msec)",
3138 .def = "500",
3139 .parent = "write_bw_log",
3140 .hide = 1,
3141 .interval = 100,
3142 .category = FIO_OPT_C_LOG,
3143 .group = FIO_OPT_G_INVALID,
3144 },
3145 {
3146 .name = "iopsavgtime",
3147 .lname = "IOPS average time",
3148 .type = FIO_OPT_INT,
3149 .off1 = td_var_offset(iops_avg_time),
3150 .help = "Time window over which to calculate IOPS (msec)",
3151 .def = "500",
3152 .parent = "write_iops_log",
3153 .hide = 1,
3154 .interval = 100,
3155 .category = FIO_OPT_C_LOG,
3156 .group = FIO_OPT_G_INVALID,
3157 },
214e1eca
JA
3158 {
3159 .name = "group_reporting",
e8b0e958 3160 .lname = "Group reporting",
d2507043 3161 .type = FIO_OPT_STR_SET,
214e1eca
JA
3162 .off1 = td_var_offset(group_reporting),
3163 .help = "Do reporting on a per-group basis",
10860056 3164 .category = FIO_OPT_C_STAT,
e8b0e958 3165 .group = FIO_OPT_G_INVALID,
214e1eca 3166 },
e9459e5a
JA
3167 {
3168 .name = "zero_buffers",
e8b0e958 3169 .lname = "Zero I/O buffers",
e9459e5a
JA
3170 .type = FIO_OPT_STR_SET,
3171 .off1 = td_var_offset(zero_buffers),
3172 .help = "Init IO buffers to all zeroes",
e8b0e958 3173 .category = FIO_OPT_C_IO,
3ceb458f 3174 .group = FIO_OPT_G_IO_BUF,
e9459e5a 3175 },
5973cafb
JA
3176 {
3177 .name = "refill_buffers",
e8b0e958 3178 .lname = "Refill I/O buffers",
5973cafb
JA
3179 .type = FIO_OPT_STR_SET,
3180 .off1 = td_var_offset(refill_buffers),
3181 .help = "Refill IO buffers on every IO submit",
e8b0e958 3182 .category = FIO_OPT_C_IO,
3ceb458f 3183 .group = FIO_OPT_G_IO_BUF,
5973cafb 3184 },
fd68418e
JA
3185 {
3186 .name = "scramble_buffers",
e8b0e958 3187 .lname = "Scramble I/O buffers",
fd68418e
JA
3188 .type = FIO_OPT_BOOL,
3189 .off1 = td_var_offset(scramble_buffers),
3190 .help = "Slightly scramble buffers on every IO submit",
3191 .def = "1",
e8b0e958 3192 .category = FIO_OPT_C_IO,
3ceb458f 3193 .group = FIO_OPT_G_IO_BUF,
fd68418e 3194 },
ce35b1ec
JA
3195 {
3196 .name = "buffer_pattern",
3197 .lname = "Buffer pattern",
3198 .type = FIO_OPT_STR,
3199 .cb = str_buffer_pattern_cb,
a8523a6a 3200 .off1 = td_var_offset(buffer_pattern),
ce35b1ec
JA
3201 .help = "Fill pattern for IO buffers",
3202 .category = FIO_OPT_C_IO,
3203 .group = FIO_OPT_G_IO_BUF,
3204 },
9c42684e
JA
3205 {
3206 .name = "buffer_compress_percentage",
e8b0e958 3207 .lname = "Buffer compression percentage",
9c42684e 3208 .type = FIO_OPT_INT,
bedc9dc2 3209 .cb = str_buffer_compress_cb,
a8523a6a 3210 .off1 = td_var_offset(compress_percentage),
9c42684e 3211 .maxval = 100,
e7f5de90 3212 .minval = 0,
9c42684e 3213 .help = "How compressible the buffer is (approximately)",
20eb06bd 3214 .interval = 5,
e8b0e958 3215 .category = FIO_OPT_C_IO,
3ceb458f 3216 .group = FIO_OPT_G_IO_BUF,
9c42684e 3217 },
f97a43a1
JA
3218 {
3219 .name = "buffer_compress_chunk",
e8b0e958 3220 .lname = "Buffer compression chunk size",
f97a43a1
JA
3221 .type = FIO_OPT_INT,
3222 .off1 = td_var_offset(compress_chunk),
207b18e4 3223 .parent = "buffer_compress_percentage",
d71c154c 3224 .hide = 1,
f97a43a1 3225 .help = "Size of compressible region in buffer",
20eb06bd 3226 .interval = 256,
e8b0e958 3227 .category = FIO_OPT_C_IO,
3ceb458f 3228 .group = FIO_OPT_G_IO_BUF,
f97a43a1 3229 },
5c94b008
JA
3230 {
3231 .name = "dedupe_percentage",
3232 .lname = "Dedupe percentage",
3233 .type = FIO_OPT_INT,
3234 .cb = str_dedupe_cb,
a8523a6a 3235 .off1 = td_var_offset(dedupe_percentage),
5c94b008
JA
3236 .maxval = 100,
3237 .minval = 0,
3238 .help = "Percentage of buffers that are dedupable",
3239 .interval = 1,
3240 .category = FIO_OPT_C_IO,
3241 .group = FIO_OPT_G_IO_BUF,
3242 },
83349190
YH
3243 {
3244 .name = "clat_percentiles",
e8b0e958 3245 .lname = "Completion latency percentiles",
83349190
YH
3246 .type = FIO_OPT_BOOL,
3247 .off1 = td_var_offset(clat_percentiles),
3248 .help = "Enable the reporting of completion latency percentiles",
467b35ed 3249 .def = "1",
e8b0e958
JA
3250 .category = FIO_OPT_C_STAT,
3251 .group = FIO_OPT_G_INVALID,
83349190
YH
3252 },
3253 {
3254 .name = "percentile_list",
66347cfa 3255 .lname = "Percentile list",
83349190
YH
3256 .type = FIO_OPT_FLOAT_LIST,
3257 .off1 = td_var_offset(percentile_list),
435d195a 3258 .off2 = td_var_offset(percentile_precision),
66347cfa
DE
3259 .help = "Specify a custom list of percentiles to report for "
3260 "completion latency and block errors",
fd112d34 3261 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
83349190
YH
3262 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3263 .minfp = 0.0,
3264 .maxfp = 100.0,
e8b0e958
JA
3265 .category = FIO_OPT_C_STAT,
3266 .group = FIO_OPT_G_INVALID,
83349190
YH
3267 },
3268
0a839f30
JA
3269#ifdef FIO_HAVE_DISK_UTIL
3270 {
3271 .name = "disk_util",
e8b0e958 3272 .lname = "Disk utilization",
0a839f30
JA
3273 .type = FIO_OPT_BOOL,
3274 .off1 = td_var_offset(do_disk_util),
f66ab3c8 3275 .help = "Log disk utilization statistics",
0a839f30 3276 .def = "1",
e8b0e958
JA
3277 .category = FIO_OPT_C_STAT,
3278 .group = FIO_OPT_G_INVALID,
0a839f30
JA
3279 },
3280#endif
993bf48b
JA
3281 {
3282 .name = "gtod_reduce",
e8b0e958 3283 .lname = "Reduce gettimeofday() calls",
993bf48b
JA
3284 .type = FIO_OPT_BOOL,
3285 .help = "Greatly reduce number of gettimeofday() calls",
3286 .cb = str_gtod_reduce_cb,
3287 .def = "0",
a4ed77fe 3288 .hide_on_set = 1,
e8b0e958
JA
3289 .category = FIO_OPT_C_STAT,
3290 .group = FIO_OPT_G_INVALID,
993bf48b 3291 },
02af0988
JA
3292 {
3293 .name = "disable_lat",
e8b0e958 3294 .lname = "Disable all latency stats",
02af0988
JA
3295 .type = FIO_OPT_BOOL,
3296 .off1 = td_var_offset(disable_lat),
3297 .help = "Disable latency numbers",
3298 .parent = "gtod_reduce",
d71c154c 3299 .hide = 1,
02af0988 3300 .def = "0",
e8b0e958
JA
3301 .category = FIO_OPT_C_STAT,
3302 .group = FIO_OPT_G_INVALID,
02af0988 3303 },
9520ebb9
JA
3304 {
3305 .name = "disable_clat",
e8b0e958 3306 .lname = "Disable completion latency stats",
9520ebb9
JA
3307 .type = FIO_OPT_BOOL,
3308 .off1 = td_var_offset(disable_clat),
3309 .help = "Disable completion latency numbers",
993bf48b 3310 .parent = "gtod_reduce",
d71c154c 3311 .hide = 1,
9520ebb9 3312 .def = "0",
e8b0e958
JA
3313 .category = FIO_OPT_C_STAT,
3314 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
3315 },
3316 {
3317 .name = "disable_slat",
e8b0e958 3318 .lname = "Disable submission latency stats",
9520ebb9
JA
3319 .type = FIO_OPT_BOOL,
3320 .off1 = td_var_offset(disable_slat),
03e20d68 3321 .help = "Disable submission latency numbers",
993bf48b 3322 .parent = "gtod_reduce",
d71c154c 3323 .hide = 1,
9520ebb9 3324 .def = "0",
e8b0e958
JA
3325 .category = FIO_OPT_C_STAT,
3326 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
3327 },
3328 {
3329 .name = "disable_bw_measurement",
e8b0e958 3330 .lname = "Disable bandwidth stats",
9520ebb9
JA
3331 .type = FIO_OPT_BOOL,
3332 .off1 = td_var_offset(disable_bw),
3333 .help = "Disable bandwidth logging",
993bf48b 3334 .parent = "gtod_reduce",
d71c154c 3335 .hide = 1,
9520ebb9 3336 .def = "0",
e8b0e958
JA
3337 .category = FIO_OPT_C_STAT,
3338 .group = FIO_OPT_G_INVALID,
9520ebb9 3339 },
be4ecfdf
JA
3340 {
3341 .name = "gtod_cpu",
e8b0e958 3342 .lname = "Dedicated gettimeofday() CPU",
be4ecfdf 3343 .type = FIO_OPT_INT,
79c896a1 3344 .off1 = td_var_offset(gtod_cpu),
03e20d68 3345 .help = "Set up dedicated gettimeofday() thread on this CPU",
29d43ff9 3346 .verify = gtod_cpu_verify,
e8b0e958 3347 .category = FIO_OPT_C_GENERAL,
10860056 3348 .group = FIO_OPT_G_CLOCK,
be4ecfdf 3349 },
771e58be
JA
3350 {
3351 .name = "unified_rw_reporting",
3352 .type = FIO_OPT_BOOL,
3353 .off1 = td_var_offset(unified_rw_rep),
3354 .help = "Unify reporting across data direction",
3355 .def = "0",
90b7a96d
JA
3356 .category = FIO_OPT_C_GENERAL,
3357 .group = FIO_OPT_G_INVALID,
771e58be 3358 },
f2bba182
RR
3359 {
3360 .name = "continue_on_error",
e8b0e958 3361 .lname = "Continue on error",
06842027 3362 .type = FIO_OPT_STR,
f2bba182 3363 .off1 = td_var_offset(continue_on_error),
03e20d68 3364 .help = "Continue on non-fatal errors during IO",
06842027 3365 .def = "none",
e8b0e958 3366 .category = FIO_OPT_C_GENERAL,
bc3f552f 3367 .group = FIO_OPT_G_ERR,
06842027
SL
3368 .posval = {
3369 { .ival = "none",
3370 .oval = ERROR_TYPE_NONE,
3371 .help = "Exit when an error is encountered",
3372 },
3373 { .ival = "read",
3374 .oval = ERROR_TYPE_READ,
3375 .help = "Continue on read errors only",
3376 },
3377 { .ival = "write",
3378 .oval = ERROR_TYPE_WRITE,
3379 .help = "Continue on write errors only",
3380 },
3381 { .ival = "io",
3382 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
3383 .help = "Continue on any IO errors",
3384 },
3385 { .ival = "verify",
3386 .oval = ERROR_TYPE_VERIFY,
3387 .help = "Continue on verify errors only",
3388 },
3389 { .ival = "all",
3390 .oval = ERROR_TYPE_ANY,
3391 .help = "Continue on all io and verify errors",
3392 },
3393 { .ival = "0",
3394 .oval = ERROR_TYPE_NONE,
3395 .help = "Alias for 'none'",
3396 },
3397 { .ival = "1",
3398 .oval = ERROR_TYPE_ANY,
3399 .help = "Alias for 'all'",
3400 },
3401 },
f2bba182 3402 },
8b28bd41
DM
3403 {
3404 .name = "ignore_error",
3405 .type = FIO_OPT_STR,
3406 .cb = str_ignore_error_cb,
a8523a6a 3407 .off1 = td_var_offset(ignore_error_nr),
8b28bd41
DM
3408 .help = "Set a specific list of errors to ignore",
3409 .parent = "rw",
a94eb99a 3410 .category = FIO_OPT_C_GENERAL,
bc3f552f 3411 .group = FIO_OPT_G_ERR,
8b28bd41
DM
3412 },
3413 {
3414 .name = "error_dump",
3415 .type = FIO_OPT_BOOL,
3416 .off1 = td_var_offset(error_dump),
3417 .def = "0",
3418 .help = "Dump info on each error",
a94eb99a 3419 .category = FIO_OPT_C_GENERAL,
bc3f552f 3420 .group = FIO_OPT_G_ERR,
8b28bd41 3421 },
9ac8a797
JA
3422 {
3423 .name = "profile",
e8b0e958 3424 .lname = "Profile",
79d16311 3425 .type = FIO_OPT_STR_STORE,
9ac8a797 3426 .off1 = td_var_offset(profile),
9ac8a797 3427 .help = "Select a specific builtin performance test",
13fca827 3428 .category = FIO_OPT_C_PROFILE,
e8b0e958 3429 .group = FIO_OPT_G_INVALID,
9ac8a797 3430 },
a696fa2a
JA
3431 {
3432 .name = "cgroup",
e8b0e958 3433 .lname = "Cgroup",
a696fa2a
JA
3434 .type = FIO_OPT_STR_STORE,
3435 .off1 = td_var_offset(cgroup),
3436 .help = "Add job to cgroup of this name",
e8b0e958 3437 .category = FIO_OPT_C_GENERAL,
a1f6afec
JA
3438 .group = FIO_OPT_G_CGROUP,
3439 },
3440 {
3441 .name = "cgroup_nodelete",
3442 .lname = "Cgroup no-delete",
3443 .type = FIO_OPT_BOOL,
3444 .off1 = td_var_offset(cgroup_nodelete),
3445 .help = "Do not delete cgroups after job completion",
3446 .def = "0",
3447 .parent = "cgroup",
3448 .category = FIO_OPT_C_GENERAL,
3449 .group = FIO_OPT_G_CGROUP,
a696fa2a
JA
3450 },
3451 {
3452 .name = "cgroup_weight",
e8b0e958 3453 .lname = "Cgroup weight",
a696fa2a
JA
3454 .type = FIO_OPT_INT,
3455 .off1 = td_var_offset(cgroup_weight),
3456 .help = "Use given weight for cgroup",
3457 .minval = 100,
3458 .maxval = 1000,
a1f6afec 3459 .parent = "cgroup",
e8b0e958 3460 .category = FIO_OPT_C_GENERAL,
a1f6afec 3461 .group = FIO_OPT_G_CGROUP,
7de87099 3462 },
e0b0d892
JA
3463 {
3464 .name = "uid",
e8b0e958 3465 .lname = "User ID",
e0b0d892
JA
3466 .type = FIO_OPT_INT,
3467 .off1 = td_var_offset(uid),
3468 .help = "Run job with this user ID",
e8b0e958 3469 .category = FIO_OPT_C_GENERAL,
10860056 3470 .group = FIO_OPT_G_CRED,
e0b0d892
JA
3471 },
3472 {
3473 .name = "gid",
e8b0e958 3474 .lname = "Group ID",
e0b0d892
JA
3475 .type = FIO_OPT_INT,
3476 .off1 = td_var_offset(gid),
3477 .help = "Run job with this group ID",
e8b0e958 3478 .category = FIO_OPT_C_GENERAL,
10860056 3479 .group = FIO_OPT_G_CRED,
e0b0d892 3480 },
a1f6afec
JA
3481 {
3482 .name = "kb_base",
3483 .lname = "KB Base",
3484 .type = FIO_OPT_INT,
3485 .off1 = td_var_offset(kb_base),
a1f6afec
JA
3486 .prio = 1,
3487 .def = "1024",
ba9c7219
JA
3488 .posval = {
3489 { .ival = "1024",
3490 .oval = 1024,
3491 .help = "Use 1024 as the K base",
3492 },
3493 { .ival = "1000",
3494 .oval = 1000,
3495 .help = "Use 1000 as the K base",
3496 },
3497 },
a1f6afec
JA
3498 .help = "How many bytes per KB for reporting (1000 or 1024)",
3499 .category = FIO_OPT_C_GENERAL,
3500 .group = FIO_OPT_G_INVALID,
3501 },
cf3a0518
JA
3502 {
3503 .name = "unit_base",
ba9c7219 3504 .lname = "Base unit for reporting (Bits or Bytes)",
cf3a0518
JA
3505 .type = FIO_OPT_INT,
3506 .off1 = td_var_offset(unit_base),
cf3a0518 3507 .prio = 1,
71a08258
JA
3508 .posval = {
3509 { .ival = "0",
3510 .oval = 0,
3511 .help = "Auto-detect",
3512 },
3513 { .ival = "8",
3514 .oval = 8,
3515 .help = "Normal (byte based)",
3516 },
3517 { .ival = "1",
3518 .oval = 1,
3519 .help = "Bit based",
3520 },
3521 },
cf3a0518
JA
3522 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
3523 .category = FIO_OPT_C_GENERAL,
3524 .group = FIO_OPT_G_INVALID,
3525 },
3ceb458f
JA
3526 {
3527 .name = "hugepage-size",
3528 .lname = "Hugepage size",
3529 .type = FIO_OPT_INT,
3530 .off1 = td_var_offset(hugepage_size),
3531 .help = "When using hugepages, specify size of each page",
3532 .def = __fio_stringify(FIO_HUGE_PAGE),
3533 .interval = 1024 * 1024,
3534 .category = FIO_OPT_C_GENERAL,
3535 .group = FIO_OPT_G_INVALID,
3536 },
9e684a49
DE
3537 {
3538 .name = "flow_id",
e8b0e958 3539 .lname = "I/O flow ID",
9e684a49
DE
3540 .type = FIO_OPT_INT,
3541 .off1 = td_var_offset(flow_id),
3542 .help = "The flow index ID to use",
3543 .def = "0",
e8b0e958
JA
3544 .category = FIO_OPT_C_IO,
3545 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
3546 },
3547 {
3548 .name = "flow",
e8b0e958 3549 .lname = "I/O flow weight",
9e684a49
DE
3550 .type = FIO_OPT_INT,
3551 .off1 = td_var_offset(flow),
3552 .help = "Weight for flow control of this job",
3553 .parent = "flow_id",
d71c154c 3554 .hide = 1,
9e684a49 3555 .def = "0",
e8b0e958
JA
3556 .category = FIO_OPT_C_IO,
3557 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
3558 },
3559 {
3560 .name = "flow_watermark",
e8b0e958 3561 .lname = "I/O flow watermark",
9e684a49
DE
3562 .type = FIO_OPT_INT,
3563 .off1 = td_var_offset(flow_watermark),
3564 .help = "High watermark for flow control. This option"
3565 " should be set to the same value for all threads"
3566 " with non-zero flow.",
3567 .parent = "flow_id",
d71c154c 3568 .hide = 1,
9e684a49 3569 .def = "1024",
e8b0e958
JA
3570 .category = FIO_OPT_C_IO,
3571 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
3572 },
3573 {
3574 .name = "flow_sleep",
e8b0e958 3575 .lname = "I/O flow sleep",
9e684a49
DE
3576 .type = FIO_OPT_INT,
3577 .off1 = td_var_offset(flow_sleep),
3578 .help = "How many microseconds to sleep after being held"
3579 " back by the flow control mechanism",
3580 .parent = "flow_id",
d71c154c 3581 .hide = 1,
9e684a49 3582 .def = "0",
e8b0e958
JA
3583 .category = FIO_OPT_C_IO,
3584 .group = FIO_OPT_G_IO_FLOW,
9e684a49 3585 },
65fa28ca
DE
3586 {
3587 .name = "skip_bad",
3588 .lname = "Skip operations against bad blocks",
3589 .type = FIO_OPT_BOOL,
3590 .off1 = td_var_offset(skip_bad),
3591 .help = "Skip operations against known bad blocks.",
3592 .hide = 1,
3593 .def = "0",
3594 .category = FIO_OPT_C_IO,
3595 .group = FIO_OPT_G_MTD,
3596 },
214e1eca
JA
3597 {
3598 .name = NULL,
3599 },
3600};
3601
17af15d4 3602static void add_to_lopt(struct option *lopt, struct fio_option *o,
de890a1e 3603 const char *name, int val)
9f81736c 3604{
17af15d4 3605 lopt->name = (char *) name;
de890a1e 3606 lopt->val = val;
9f81736c 3607 if (o->type == FIO_OPT_STR_SET)
ff52be3d 3608 lopt->has_arg = optional_argument;
9f81736c
JA
3609 else
3610 lopt->has_arg = required_argument;
3611}
3612
de890a1e
SL
3613static void options_to_lopts(struct fio_option *opts,
3614 struct option *long_options,
3615 int i, int option_type)
214e1eca 3616{
de890a1e 3617 struct fio_option *o = &opts[0];
214e1eca 3618 while (o->name) {
de890a1e 3619 add_to_lopt(&long_options[i], o, o->name, option_type);
17af15d4
JA
3620 if (o->alias) {
3621 i++;
de890a1e 3622 add_to_lopt(&long_options[i], o, o->alias, option_type);
17af15d4 3623 }
214e1eca
JA
3624
3625 i++;
3626 o++;
3627 assert(i < FIO_NR_OPTIONS);
3628 }
3629}
3630
de890a1e
SL
3631void fio_options_set_ioengine_opts(struct option *long_options,
3632 struct thread_data *td)
3633{
3634 unsigned int i;
3635
3636 i = 0;
3637 while (long_options[i].name) {
3638 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
3639 memset(&long_options[i], 0, sizeof(*long_options));
3640 break;
3641 }
3642 i++;
3643 }
3644
3645 /*
3646 * Just clear out the prior ioengine options.
3647 */
3648 if (!td || !td->eo)
3649 return;
3650
3651 options_to_lopts(td->io_ops->options, long_options, i,
3652 FIO_GETOPT_IOENGINE);
3653}
3654
3655void fio_options_dup_and_init(struct option *long_options)
3656{
3657 unsigned int i;
3658
9af4a244 3659 options_init(fio_options);
de890a1e
SL
3660
3661 i = 0;
3662 while (long_options[i].name)
3663 i++;
3664
9af4a244 3665 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
de890a1e
SL
3666}
3667
74929ac2
JA
3668struct fio_keyword {
3669 const char *word;
3670 const char *desc;
3671 char *replace;
3672};
3673
3674static struct fio_keyword fio_keywords[] = {
3675 {
3676 .word = "$pagesize",
3677 .desc = "Page size in the system",
3678 },
3679 {
3680 .word = "$mb_memory",
3681 .desc = "Megabytes of memory online",
3682 },
3683 {
3684 .word = "$ncpus",
3685 .desc = "Number of CPUs online in the system",
3686 },
3687 {
3688 .word = NULL,
3689 },
3690};
3691
af1dc266
JA
3692void fio_keywords_exit(void)
3693{
3694 struct fio_keyword *kw;
3695
3696 kw = &fio_keywords[0];
3697 while (kw->word) {
3698 free(kw->replace);
3699 kw->replace = NULL;
3700 kw++;
3701 }
3702}
3703
74929ac2
JA
3704void fio_keywords_init(void)
3705{
3b2e1464 3706 unsigned long long mb_memory;
74929ac2
JA
3707 char buf[128];
3708 long l;
3709
a4cfc477 3710 sprintf(buf, "%lu", (unsigned long) page_size);
74929ac2
JA
3711 fio_keywords[0].replace = strdup(buf);
3712
8eb016d3 3713 mb_memory = os_phys_mem() / (1024 * 1024);
3b2e1464 3714 sprintf(buf, "%llu", mb_memory);
74929ac2
JA
3715 fio_keywords[1].replace = strdup(buf);
3716
c00a2289 3717 l = cpus_online();
74929ac2
JA
3718 sprintf(buf, "%lu", l);
3719 fio_keywords[2].replace = strdup(buf);
3720}
3721
892a6ffc
JA
3722#define BC_APP "bc"
3723
3724static char *bc_calc(char *str)
3725{
d0c814ec 3726 char buf[128], *tmp;
892a6ffc
JA
3727 FILE *f;
3728 int ret;
3729
3730 /*
3731 * No math, just return string
3732 */
d0c814ec
SL
3733 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
3734 !strchr(str, '/')) || strchr(str, '\''))
892a6ffc
JA
3735 return str;
3736
3737 /*
3738 * Split option from value, we only need to calculate the value
3739 */
3740 tmp = strchr(str, '=');
3741 if (!tmp)
3742 return str;
3743
3744 tmp++;
892a6ffc 3745
d0c814ec
SL
3746 /*
3747 * Prevent buffer overflows; such a case isn't reasonable anyway
3748 */
3749 if (strlen(str) >= 128 || strlen(tmp) > 100)
3750 return str;
892a6ffc
JA
3751
3752 sprintf(buf, "which %s > /dev/null", BC_APP);
3753 if (system(buf)) {
3754 log_err("fio: bc is needed for performing math\n");
892a6ffc
JA
3755 return NULL;
3756 }
3757
d0c814ec 3758 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
892a6ffc 3759 f = popen(buf, "r");
3c3ed070 3760 if (!f)
892a6ffc 3761 return NULL;
892a6ffc 3762
d0c814ec 3763 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
1d824f37
JA
3764 if (ret <= 0) {
3765 pclose(f);
892a6ffc 3766 return NULL;
1d824f37 3767 }
892a6ffc 3768
892a6ffc 3769 pclose(f);
d0c814ec
SL
3770 buf[(tmp - str) + ret - 1] = '\0';
3771 memcpy(buf, str, tmp - str);
892a6ffc 3772 free(str);
d0c814ec
SL
3773 return strdup(buf);
3774}
3775
3776/*
3777 * Return a copy of the input string with substrings of the form ${VARNAME}
3778 * substituted with the value of the environment variable VARNAME. The
3779 * substitution always occurs, even if VARNAME is empty or the corresponding
3780 * environment variable undefined.
3781 */
3782static char *option_dup_subs(const char *opt)
3783{
3784 char out[OPT_LEN_MAX+1];
3785 char in[OPT_LEN_MAX+1];
3786 char *outptr = out;
3787 char *inptr = in;
3788 char *ch1, *ch2, *env;
3789 ssize_t nchr = OPT_LEN_MAX;
3790 size_t envlen;
3791
3792 if (strlen(opt) + 1 > OPT_LEN_MAX) {
3793 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
3794 return NULL;
3795 }
3796
3797 in[OPT_LEN_MAX] = '\0';
3798 strncpy(in, opt, OPT_LEN_MAX);
3799
3800 while (*inptr && nchr > 0) {
3801 if (inptr[0] == '$' && inptr[1] == '{') {
3802 ch2 = strchr(inptr, '}');
3803 if (ch2 && inptr+1 < ch2) {
3804 ch1 = inptr+2;
3805 inptr = ch2+1;
3806 *ch2 = '\0';
3807
3808 env = getenv(ch1);
3809 if (env) {
3810 envlen = strlen(env);
3811 if (envlen <= nchr) {
3812 memcpy(outptr, env, envlen);
3813 outptr += envlen;
3814 nchr -= envlen;
3815 }
3816 }
3817
3818 continue;
3819 }
3820 }
3821
3822 *outptr++ = *inptr++;
3823 --nchr;
3824 }
3825
3826 *outptr = '\0';
3827 return strdup(out);
892a6ffc
JA
3828}
3829
74929ac2
JA
3830/*
3831 * Look for reserved variable names and replace them with real values
3832 */
3833static char *fio_keyword_replace(char *opt)
3834{
3835 char *s;
3836 int i;
d0c814ec 3837 int docalc = 0;
74929ac2
JA
3838
3839 for (i = 0; fio_keywords[i].word != NULL; i++) {
3840 struct fio_keyword *kw = &fio_keywords[i];
3841
3842 while ((s = strstr(opt, kw->word)) != NULL) {
3843 char *new = malloc(strlen(opt) + 1);
3844 char *o_org = opt;
3845 int olen = s - opt;
3846 int len;
3847
3848 /*
3849 * Copy part of the string before the keyword and
3850 * sprintf() the replacement after it.
3851 */
3852 memcpy(new, opt, olen);
3853 len = sprintf(new + olen, "%s", kw->replace);
3854
3855 /*
3856 * If there's more in the original string, copy that
3857 * in too
3858 */
3859 opt += strlen(kw->word) + olen;
3860 if (strlen(opt))
3861 memcpy(new + olen + len, opt, opt - o_org - 1);
3862
3863 /*
3864 * replace opt and free the old opt
3865 */
3866 opt = new;
d0c814ec 3867 free(o_org);
7a958bd5 3868
d0c814ec 3869 docalc = 1;
74929ac2
JA
3870 }
3871 }
3872
d0c814ec
SL
3873 /*
3874 * Check for potential math and invoke bc, if possible
3875 */
3876 if (docalc)
3877 opt = bc_calc(opt);
3878
7a958bd5 3879 return opt;
74929ac2
JA
3880}
3881
d0c814ec
SL
3882static char **dup_and_sub_options(char **opts, int num_opts)
3883{
3884 int i;
3885 char **opts_copy = malloc(num_opts * sizeof(*opts));
3886 for (i = 0; i < num_opts; i++) {
3887 opts_copy[i] = option_dup_subs(opts[i]);
3888 if (!opts_copy[i])
3889 continue;
3890 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
3891 }
3892 return opts_copy;
3893}
3894
e15b023b 3895static void show_closest_option(const char *opt)
a2d027b9
JA
3896{
3897 int best_option, best_distance;
3898 int i, distance;
e15b023b
JA
3899 char *name;
3900
3901 if (!strlen(opt))
3902 return;
3903
3904 name = strdup(opt);
3905 i = 0;
3906 while (name[i] != '\0' && name[i] != '=')
3907 i++;
3908 name[i] = '\0';
a2d027b9
JA
3909
3910 best_option = -1;
3911 best_distance = INT_MAX;
3912 i = 0;
3913 while (fio_options[i].name) {
3914 distance = string_distance(name, fio_options[i].name);
3915 if (distance < best_distance) {
3916 best_distance = distance;
3917 best_option = i;
3918 }
3919 i++;
3920 }
3921
3701636d 3922 if (best_option != -1 && string_distance_ok(name, best_distance))
a2d027b9 3923 log_err("Did you mean %s?\n", fio_options[best_option].name);
e15b023b
JA
3924
3925 free(name);
a2d027b9
JA
3926}
3927
c2292325 3928int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
214e1eca 3929{
de890a1e 3930 int i, ret, unknown;
d0c814ec 3931 char **opts_copy;
3b8b7135 3932
9af4a244 3933 sort_options(opts, fio_options, num_opts);
d0c814ec 3934 opts_copy = dup_and_sub_options(opts, num_opts);
3b8b7135 3935
de890a1e
SL
3936 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
3937 struct fio_option *o;
9af4a244 3938 int newret = parse_option(opts_copy[i], opts[i], fio_options,
66e19a38 3939 &o, td, &td->opt_list);
d0c814ec 3940
a8523a6a
JA
3941 if (!newret && o)
3942 fio_option_mark_set(&td->o, o);
3943
de890a1e
SL
3944 if (opts_copy[i]) {
3945 if (newret && !o) {
3946 unknown++;
3947 continue;
3948 }
d0c814ec 3949 free(opts_copy[i]);
de890a1e
SL
3950 opts_copy[i] = NULL;
3951 }
3952
3953 ret |= newret;
3954 }
3955
3956 if (unknown) {
3957 ret |= ioengine_load(td);
3958 if (td->eo) {
3959 sort_options(opts_copy, td->io_ops->options, num_opts);
3960 opts = opts_copy;
3961 }
3962 for (i = 0; i < num_opts; i++) {
3963 struct fio_option *o = NULL;
3964 int newret = 1;
a2d027b9 3965
de890a1e
SL
3966 if (!opts_copy[i])
3967 continue;
3968
3969 if (td->eo)
3970 newret = parse_option(opts_copy[i], opts[i],
3971 td->io_ops->options, &o,
66e19a38 3972 td->eo, &td->opt_list);
de890a1e
SL
3973
3974 ret |= newret;
a2d027b9 3975 if (!o) {
de890a1e 3976 log_err("Bad option <%s>\n", opts[i]);
a2d027b9
JA
3977 show_closest_option(opts[i]);
3978 }
de890a1e
SL
3979 free(opts_copy[i]);
3980 opts_copy[i] = NULL;
3981 }
74929ac2 3982 }
3b8b7135 3983
d0c814ec 3984 free(opts_copy);
3b8b7135 3985 return ret;
214e1eca
JA
3986}
3987
3988int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
3989{
a8523a6a
JA
3990 int ret;
3991
d8b4f395 3992 ret = parse_cmd_option(opt, val, fio_options, td, &td->opt_list);
a8523a6a
JA
3993 if (!ret) {
3994 struct fio_option *o;
3995
3996 o = find_option(fio_options, opt);
3997 if (o)
3998 fio_option_mark_set(&td->o, o);
3999 }
4000
4001 return ret;
214e1eca
JA
4002}
4003
de890a1e
SL
4004int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
4005 char *val)
4006{
d8b4f395
JA
4007 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
4008 &td->opt_list);
de890a1e
SL
4009}
4010
214e1eca
JA
4011void fio_fill_default_options(struct thread_data *td)
4012{
cb1402d6 4013 td->o.magic = OPT_MAGIC;
9af4a244 4014 fill_default_options(td, fio_options);
214e1eca
JA
4015}
4016
4017int fio_show_option_help(const char *opt)
4018{
9af4a244 4019 return show_cmd_help(fio_options, opt);
214e1eca 4020}
d23bb327 4021
de890a1e 4022void options_mem_dupe(void *data, struct fio_option *options)
d23bb327 4023{
de890a1e 4024 struct fio_option *o;
d23bb327 4025 char **ptr;
d23bb327 4026
de890a1e
SL
4027 for (o = &options[0]; o->name; o++) {
4028 if (o->type != FIO_OPT_STR_STORE)
d23bb327
JA
4029 continue;
4030
f0fdbcaf 4031 ptr = td_var(data, o, o->off1);
7e356b2d
JA
4032 if (*ptr)
4033 *ptr = strdup(*ptr);
d23bb327
JA
4034 }
4035}
4036
de890a1e
SL
4037/*
4038 * dupe FIO_OPT_STR_STORE options
4039 */
4040void fio_options_mem_dupe(struct thread_data *td)
4041{
9af4a244 4042 options_mem_dupe(&td->o, fio_options);
1647f592
JA
4043
4044 if (td->eo && td->io_ops) {
de890a1e 4045 void *oldeo = td->eo;
1647f592 4046
de890a1e
SL
4047 td->eo = malloc(td->io_ops->option_struct_size);
4048 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
4049 options_mem_dupe(td->eo, td->io_ops->options);
4050 }
4051}
4052
d6978a32
JA
4053unsigned int fio_get_kb_base(void *data)
4054{
83ea422a 4055 struct thread_options *o = data;
d6978a32
JA
4056 unsigned int kb_base = 0;
4057
cb1402d6
JA
4058 /*
4059 * This is a hack... For private options, *data is not holding
4060 * a pointer to the thread_options, but to private data. This means
4061 * we can't safely dereference it, but magic is first so mem wise
4062 * it is valid. But this also means that if the job first sets
4063 * kb_base and expects that to be honored by private options,
4064 * it will be disappointed. We will return the global default
4065 * for this.
4066 */
4067 if (o && o->magic == OPT_MAGIC)
83ea422a 4068 kb_base = o->kb_base;
d6978a32
JA
4069 if (!kb_base)
4070 kb_base = 1024;
4071
4072 return kb_base;
4073}
9f988e2e 4074
07b3232d 4075int add_option(struct fio_option *o)
9f988e2e 4076{
07b3232d
JA
4077 struct fio_option *__o;
4078 int opt_index = 0;
4079
9af4a244 4080 __o = fio_options;
07b3232d
JA
4081 while (__o->name) {
4082 opt_index++;
4083 __o++;
4084 }
4085
7b504edd
JA
4086 if (opt_index + 1 == FIO_MAX_OPTS) {
4087 log_err("fio: FIO_MAX_OPTS is too small\n");
4088 return 1;
4089 }
4090
9af4a244 4091 memcpy(&fio_options[opt_index], o, sizeof(*o));
7b504edd 4092 fio_options[opt_index + 1].name = NULL;
07b3232d 4093 return 0;
9f988e2e 4094}
e2de69da 4095
07b3232d 4096void invalidate_profile_options(const char *prof_name)
e2de69da 4097{
07b3232d 4098 struct fio_option *o;
e2de69da 4099
9af4a244 4100 o = fio_options;
07b3232d
JA
4101 while (o->name) {
4102 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
4103 o->type = FIO_OPT_INVALID;
4104 o->prof_name = NULL;
4105 }
4106 o++;
e2de69da
JA
4107 }
4108}
f5b6bb85
JA
4109
4110void add_opt_posval(const char *optname, const char *ival, const char *help)
4111{
4112 struct fio_option *o;
4113 unsigned int i;
4114
9af4a244 4115 o = find_option(fio_options, optname);
f5b6bb85
JA
4116 if (!o)
4117 return;
4118
4119 for (i = 0; i < PARSE_MAX_VP; i++) {
4120 if (o->posval[i].ival)
4121 continue;
4122
4123 o->posval[i].ival = ival;
4124 o->posval[i].help = help;
4125 break;
4126 }
4127}
4128
4129void del_opt_posval(const char *optname, const char *ival)
4130{
4131 struct fio_option *o;
4132 unsigned int i;
4133
9af4a244 4134 o = find_option(fio_options, optname);
f5b6bb85
JA
4135 if (!o)
4136 return;
4137
4138 for (i = 0; i < PARSE_MAX_VP; i++) {
4139 if (!o->posval[i].ival)
4140 continue;
4141 if (strcmp(o->posval[i].ival, ival))
4142 continue;
4143
4144 o->posval[i].ival = NULL;
4145 o->posval[i].help = NULL;
4146 }
4147}
7e356b2d
JA
4148
4149void fio_options_free(struct thread_data *td)
4150{
9af4a244 4151 options_free(fio_options, td);
de890a1e
SL
4152 if (td->eo && td->io_ops && td->io_ops->options) {
4153 options_free(td->io_ops->options, td->eo);
4154 free(td->eo);
4155 td->eo = NULL;
4156 }
7e356b2d 4157}
c504ee55
JA
4158
4159struct fio_option *fio_option_find(const char *name)
4160{
4161 return find_option(fio_options, name);
4162}
4163
f0e7f45a
JA
4164static struct fio_option *find_next_opt(struct thread_options *o,
4165 struct fio_option *from,
4166 unsigned int off1)
a8523a6a 4167{
f0e7f45a 4168 struct fio_option *opt;
a8523a6a 4169
f0e7f45a
JA
4170 if (!from)
4171 from = &fio_options[0];
4172 else
4173 from++;
4174
4175 opt = NULL;
4176 do {
4177 if (off1 == from->off1) {
4178 opt = from;
a8523a6a
JA
4179 break;
4180 }
f0e7f45a
JA
4181 from++;
4182 } while (from->name);
a8523a6a 4183
f0e7f45a
JA
4184 return opt;
4185}
4186
4187static int opt_is_set(struct thread_options *o, struct fio_option *opt)
4188{
4189 unsigned int opt_off, index, offset;
a8523a6a
JA
4190
4191 opt_off = opt - &fio_options[0];
4192 index = opt_off / (8 * sizeof(uint64_t));
4193 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
e9d686d6 4194 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
a8523a6a
JA
4195}
4196
72f39748 4197bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
f0e7f45a
JA
4198{
4199 struct fio_option *opt, *next;
4200
4201 next = NULL;
4202 while ((opt = find_next_opt(o, next, off1)) != NULL) {
4203 if (opt_is_set(o, opt))
72f39748 4204 return true;
f0e7f45a
JA
4205
4206 next = opt;
4207 }
4208
72f39748 4209 return false;
f0e7f45a
JA
4210}
4211
a8523a6a
JA
4212void fio_option_mark_set(struct thread_options *o, struct fio_option *opt)
4213{
4214 unsigned int opt_off, index, offset;
4215
4216 opt_off = opt - &fio_options[0];
4217 index = opt_off / (8 * sizeof(uint64_t));
4218 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
e9d686d6 4219 o->set_options[index] |= (uint64_t)1 << offset;
a8523a6a 4220}