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