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