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