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