fio: add fdp support for io_uring_cmd nvme engine
[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>
5921e80c 7#include <sys/stat.h>
e13c3b50 8#include <netinet/in.h>
214e1eca
JA
9
10#include "fio.h"
4f5af7b2 11#include "verify.h"
214e1eca 12#include "parse.h"
61b9861d 13#include "lib/pattern.h"
9f988e2e 14#include "options.h"
d220c761 15#include "optgroup.h"
b7694961 16#include "zbd.h"
214e1eca 17
e13c3b50 18char client_sockaddr_str[INET6_ADDRSTRLEN] = { 0 };
72a703da 19
a609f12a
JA
20#define cb_data_to_td(data) container_of(data, struct thread_data, o)
21
26f14c31 22static const struct pattern_fmt_desc fmt_desc[] = {
4205998f
JA
23 {
24 .fmt = "%o",
59f94d26 25 .len = FIO_FIELD_SIZE(struct io_u *, offset),
4205998f 26 .paste = paste_blockoff
969b9fbb
BVA
27 },
28 { }
4205998f
JA
29};
30
214e1eca
JA
31/*
32 * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
33 */
34static char *get_opt_postfix(const char *str)
35{
36 char *p = strstr(str, ":");
37
38 if (!p)
39 return NULL;
40
41 p++;
42 strip_blank_front(&p);
43 strip_blank_end(p);
44 return strdup(p);
45}
46
a87c90fd
AK
47static bool split_parse_distr(const char *str, double *val, double *center)
48{
49 char *cp, *p;
50 bool r;
51
52 p = strdup(str);
53 if (!p)
54 return false;
55
56 cp = strstr(p, ":");
57 r = true;
58 if (cp) {
59 *cp = '\0';
60 cp++;
61 r = str_to_float(cp, center, 0);
62 }
63 r = r && str_to_float(p, val, 0);
64 free(p);
65 return r;
66}
67
564ca972
JA
68static int bs_cmp(const void *p1, const void *p2)
69{
70 const struct bssplit *bsp1 = p1;
71 const struct bssplit *bsp2 = p2;
72
a7cd478d 73 return (int) bsp1->perc - (int) bsp2->perc;
564ca972
JA
74}
75
f311f5f3 76int split_parse_ddir(struct thread_options *o, struct split *split,
517c9c72 77 char *str, bool absolute, unsigned int max_splits)
564ca972 78{
59466396
JA
79 unsigned long long perc;
80 unsigned int i;
564ca972 81 long long val;
720e84ad 82 char *fname;
564ca972 83
d2835319 84 split->nr = 0;
564ca972
JA
85
86 i = 0;
564ca972
JA
87 while ((fname = strsep(&str, ":")) != NULL) {
88 char *perc_str;
89
90 if (!strlen(fname))
91 break;
92
564ca972
JA
93 perc_str = strstr(fname, "/");
94 if (perc_str) {
95 *perc_str = '\0';
96 perc_str++;
59466396
JA
97 if (absolute) {
98 if (str_to_decimal(perc_str, &val, 1, o, 0, 0)) {
99 log_err("fio: split conversion failed\n");
100 return 1;
101 }
102 perc = val;
103 } else {
104 perc = atoi(perc_str);
105 if (perc > 100)
106 perc = 100;
107 else if (!perc)
108 perc = -1U;
109 }
110 } else {
111 if (absolute)
112 perc = 0;
113 else
d711cce5 114 perc = -1U;
59466396 115 }
564ca972 116
88038bc7 117 if (str_to_decimal(fname, &val, 1, o, 0, 0)) {
59466396 118 log_err("fio: split conversion failed\n");
564ca972
JA
119 return 1;
120 }
121
d2835319
JA
122 split->val1[i] = val;
123 split->val2[i] = perc;
564ca972 124 i++;
c32e1a09
JA
125 if (i == max_splits) {
126 log_err("fio: hit max of %d split entries\n", i);
d2835319 127 break;
c32e1a09 128 }
564ca972
JA
129 }
130
d2835319
JA
131 split->nr = i;
132 return 0;
133}
134
f311f5f3
DLM
135static int bssplit_ddir(struct thread_options *o, void *eo,
136 enum fio_ddir ddir, char *str, bool data)
d2835319
JA
137{
138 unsigned int i, perc, perc_missing;
5fff9543 139 unsigned long long max_bs, min_bs;
d2835319
JA
140 struct split split;
141
142 memset(&split, 0, sizeof(split));
143
517c9c72 144 if (split_parse_ddir(o, &split, str, data, BSSPLIT_MAX))
d2835319
JA
145 return 1;
146 if (!split.nr)
147 return 0;
148
149 max_bs = 0;
150 min_bs = -1;
151 o->bssplit[ddir] = malloc(split.nr * sizeof(struct bssplit));
152 o->bssplit_nr[ddir] = split.nr;
153 for (i = 0; i < split.nr; i++) {
154 if (split.val1[i] > max_bs)
155 max_bs = split.val1[i];
156 if (split.val1[i] < min_bs)
157 min_bs = split.val1[i];
158
159 o->bssplit[ddir][i].bs = split.val1[i];
160 o->bssplit[ddir][i].perc =split.val2[i];
161 }
564ca972
JA
162
163 /*
164 * Now check if the percentages add up, and how much is missing
165 */
166 perc = perc_missing = 0;
83ea422a 167 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
d2835319 168 struct bssplit *bsp = &o->bssplit[ddir][i];
564ca972 169
d711cce5 170 if (bsp->perc == -1U)
564ca972
JA
171 perc_missing++;
172 else
173 perc += bsp->perc;
174 }
175
40bafa33 176 if (perc > 100 && perc_missing > 1) {
564ca972 177 log_err("fio: bssplit percentages add to more than 100%%\n");
d2835319
JA
178 free(o->bssplit[ddir]);
179 o->bssplit[ddir] = NULL;
564ca972
JA
180 return 1;
181 }
d711cce5 182
564ca972
JA
183 /*
184 * If values didn't have a percentage set, divide the remains between
185 * them.
186 */
187 if (perc_missing) {
d711cce5 188 if (perc_missing == 1 && o->bssplit_nr[ddir] == 1)
40bafa33 189 perc = 100;
83ea422a 190 for (i = 0; i < o->bssplit_nr[ddir]; i++) {
d2835319 191 struct bssplit *bsp = &o->bssplit[ddir][i];
564ca972 192
d711cce5 193 if (bsp->perc == -1U)
564ca972
JA
194 bsp->perc = (100 - perc) / perc_missing;
195 }
196 }
197
83ea422a
JA
198 o->min_bs[ddir] = min_bs;
199 o->max_bs[ddir] = max_bs;
564ca972
JA
200
201 /*
202 * now sort based on percentages, for ease of lookup
203 */
d2835319 204 qsort(o->bssplit[ddir], o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp);
720e84ad 205 return 0;
720e84ad
JA
206}
207
f311f5f3
DLM
208int str_split_parse(struct thread_data *td, char *str,
209 split_parse_fn *fn, void *eo, bool data)
720e84ad 210{
764593c0 211 char *odir, *ddir;
720e84ad
JA
212 int ret = 0;
213
720e84ad
JA
214 odir = strchr(str, ',');
215 if (odir) {
6eaf09d6
SL
216 ddir = strchr(odir + 1, ',');
217 if (ddir) {
f311f5f3 218 ret = fn(&td->o, eo, DDIR_TRIM, ddir + 1, data);
6eaf09d6
SL
219 if (!ret)
220 *ddir = '\0';
221 } else {
222 char *op;
223
224 op = strdup(odir + 1);
f311f5f3 225 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
6eaf09d6
SL
226
227 free(op);
228 }
d79db122 229 if (!ret)
f311f5f3 230 ret = fn(&td->o, eo, DDIR_WRITE, odir + 1, data);
720e84ad
JA
231 if (!ret) {
232 *odir = '\0';
f311f5f3 233 ret = fn(&td->o, eo, DDIR_READ, str, data);
720e84ad
JA
234 }
235 } else {
236 char *op;
237
238 op = strdup(str);
f311f5f3 239 ret = fn(&td->o, eo, DDIR_WRITE, op, data);
6eaf09d6 240 free(op);
720e84ad 241
6eaf09d6
SL
242 if (!ret) {
243 op = strdup(str);
f311f5f3 244 ret = fn(&td->o, eo, DDIR_TRIM, op, data);
6eaf09d6
SL
245 free(op);
246 }
f0c9c217 247 if (!ret)
f311f5f3 248 ret = fn(&td->o, eo, DDIR_READ, str, data);
720e84ad 249 }
564ca972 250
764593c0
JA
251 return ret;
252}
253
a7e8aae0
KB
254static int fio_fdp_cmp(const void *p1, const void *p2)
255{
256 const uint16_t *t1 = p1;
257 const uint16_t *t2 = p2;
258
259 return *t1 - *t2;
260}
261
262static int str_fdp_pli_cb(void *data, const char *input)
263{
264 struct thread_data *td = cb_data_to_td(data);
265 char *str, *p, *v;
266 int i = 0;
267
268 p = str = strdup(input);
269 strip_blank_front(&str);
270 strip_blank_end(str);
271
272 while ((v = strsep(&str, ",")) != NULL && i < FIO_MAX_PLIS)
273 td->o.fdp_plis[i++] = strtoll(v, NULL, 0);
274 free(p);
275
276 qsort(td->o.fdp_plis, i, sizeof(*td->o.fdp_plis), fio_fdp_cmp);
277 td->o.fdp_nrpli = i;
278
279 return 0;
280}
281
764593c0
JA
282static int str_bssplit_cb(void *data, const char *input)
283{
a609f12a 284 struct thread_data *td = cb_data_to_td(data);
764593c0
JA
285 char *str, *p;
286 int ret = 0;
287
764593c0
JA
288 p = str = strdup(input);
289
290 strip_blank_front(&str);
291 strip_blank_end(str);
292
f311f5f3 293 ret = str_split_parse(td, str, bssplit_ddir, NULL, false);
764593c0 294
55baca06
JA
295 if (parse_dryrun()) {
296 int i;
297
298 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
299 free(td->o.bssplit[i]);
300 td->o.bssplit[i] = NULL;
301 td->o.bssplit_nr[i] = 0;
302 }
303 }
304
564ca972 305 free(p);
720e84ad 306 return ret;
564ca972
JA
307}
308
68be9966
NC
309static int parse_cmdprio_bssplit_entry(struct thread_options *o,
310 struct split_prio *entry, char *str)
311{
312 int matches = 0;
313 char *bs_str = NULL;
314 long long bs_val;
315 unsigned int perc = 0, class, level;
316
317 /*
318 * valid entry formats:
319 * bs/ - %s/ - set perc to 0, prio to -1.
320 * bs/perc - %s/%u - set prio to -1.
321 * bs/perc/class/level - %s/%u/%u/%u
322 */
323 matches = sscanf(str, "%m[^/]/%u/%u/%u", &bs_str, &perc, &class, &level);
324 if (matches < 1) {
325 log_err("fio: invalid cmdprio_bssplit format\n");
326 return 1;
327 }
328
329 if (str_to_decimal(bs_str, &bs_val, 1, o, 0, 0)) {
330 log_err("fio: split conversion failed\n");
331 free(bs_str);
332 return 1;
333 }
334 free(bs_str);
335
336 entry->bs = bs_val;
337 entry->perc = min(perc, 100u);
338 entry->prio = -1;
339 switch (matches) {
340 case 1: /* bs/ case */
341 case 2: /* bs/perc case */
342 break;
343 case 4: /* bs/perc/class/level case */
344 class = min(class, (unsigned int) IOPRIO_MAX_PRIO_CLASS);
345 level = min(level, (unsigned int) IOPRIO_MAX_PRIO);
346 entry->prio = ioprio_value(class, level);
347 break;
348 default:
349 log_err("fio: invalid cmdprio_bssplit format\n");
350 return 1;
351 }
352
353 return 0;
354}
355
356/*
357 * Returns a negative integer if the first argument should be before the second
358 * argument in the sorted list. A positive integer if the first argument should
359 * be after the second argument in the sorted list. A zero if they are equal.
360 */
361static int fio_split_prio_cmp(const void *p1, const void *p2)
362{
363 const struct split_prio *tmp1 = p1;
364 const struct split_prio *tmp2 = p2;
365
366 if (tmp1->bs > tmp2->bs)
367 return 1;
368 if (tmp1->bs < tmp2->bs)
369 return -1;
370 return 0;
371}
372
373int split_parse_prio_ddir(struct thread_options *o, struct split_prio **entries,
374 int *nr_entries, char *str)
375{
376 struct split_prio *tmp_entries;
377 unsigned int nr_bssplits;
378 char *str_cpy, *p, *fname;
379
380 /* strsep modifies the string, dup it so that we can use strsep twice */
381 p = str_cpy = strdup(str);
382 if (!p)
383 return 1;
384
385 nr_bssplits = 0;
386 while ((fname = strsep(&str_cpy, ":")) != NULL) {
387 if (!strlen(fname))
388 break;
389 nr_bssplits++;
390 }
391 free(p);
392
393 if (nr_bssplits > BSSPLIT_MAX) {
394 log_err("fio: too many cmdprio_bssplit entries\n");
395 return 1;
396 }
397
398 tmp_entries = calloc(nr_bssplits, sizeof(*tmp_entries));
399 if (!tmp_entries)
400 return 1;
401
402 nr_bssplits = 0;
403 while ((fname = strsep(&str, ":")) != NULL) {
404 struct split_prio *entry;
405
406 if (!strlen(fname))
407 break;
408
409 entry = &tmp_entries[nr_bssplits];
410
411 if (parse_cmdprio_bssplit_entry(o, entry, fname)) {
412 log_err("fio: failed to parse cmdprio_bssplit entry\n");
413 free(tmp_entries);
414 return 1;
415 }
416
417 /* skip zero perc entries, they provide no useful information */
418 if (entry->perc)
419 nr_bssplits++;
420 }
421
422 qsort(tmp_entries, nr_bssplits, sizeof(*tmp_entries),
423 fio_split_prio_cmp);
424
425 *entries = tmp_entries;
426 *nr_entries = nr_bssplits;
427
428 return 0;
429}
430
8b28bd41
DM
431static int str2error(char *str)
432{
a94eb99a 433 const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO",
8b28bd41
DM
434 "ENXIO", "E2BIG", "ENOEXEC", "EBADF",
435 "ECHILD", "EAGAIN", "ENOMEM", "EACCES",
436 "EFAULT", "ENOTBLK", "EBUSY", "EEXIST",
437 "EXDEV", "ENODEV", "ENOTDIR", "EISDIR",
438 "EINVAL", "ENFILE", "EMFILE", "ENOTTY",
439 "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE",
a94eb99a 440 "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" };
7fe481b4 441 int i = 0, num = sizeof(err) / sizeof(char *);
8b28bd41 442
a94eb99a 443 while (i < num) {
8b28bd41
DM
444 if (!strcmp(err[i], str))
445 return i + 1;
446 i++;
447 }
448 return 0;
449}
450
3ed673c6
TK
451static int ignore_error_type(struct thread_data *td, enum error_type_bit etype,
452 char *str)
8b28bd41
DM
453{
454 unsigned int i;
455 int *error;
456 char *fname;
457
458 if (etype >= ERROR_TYPE_CNT) {
459 log_err("Illegal error type\n");
460 return 1;
461 }
462
463 td->o.ignore_error_nr[etype] = 4;
685ffd57 464 error = calloc(4, sizeof(int));
8b28bd41
DM
465
466 i = 0;
467 while ((fname = strsep(&str, ":")) != NULL) {
468
469 if (!strlen(fname))
470 break;
471
472 /*
473 * grow struct buffer, if needed
474 */
475 if (i == td->o.ignore_error_nr[etype]) {
476 td->o.ignore_error_nr[etype] <<= 1;
477 error = realloc(error, td->o.ignore_error_nr[etype]
478 * sizeof(int));
479 }
480 if (fname[0] == 'E') {
481 error[i] = str2error(fname);
482 } else {
483 error[i] = atoi(fname);
484 if (error[i] < 0)
1616e025 485 error[i] = -error[i];
8b28bd41
DM
486 }
487 if (!error[i]) {
d503e281 488 log_err("Unknown error %s, please use number value\n",
8b28bd41 489 fname);
d503e281 490 td->o.ignore_error_nr[etype] = 0;
0fddbf7a 491 free(error);
8b28bd41
DM
492 return 1;
493 }
494 i++;
495 }
496 if (i) {
497 td->o.continue_on_error |= 1 << etype;
498 td->o.ignore_error_nr[etype] = i;
499 td->o.ignore_error[etype] = error;
d503e281
TK
500 } else {
501 td->o.ignore_error_nr[etype] = 0;
c7b086be 502 free(error);
d503e281 503 }
c7b086be 504
8b28bd41
DM
505 return 0;
506
507}
508
d7235efb
JA
509static int str_replay_skip_cb(void *data, const char *input)
510{
511 struct thread_data *td = cb_data_to_td(data);
512 char *str, *p, *n;
513 int ret = 0;
514
515 if (parse_dryrun())
516 return 0;
517
518 p = str = strdup(input);
519
520 strip_blank_front(&str);
521 strip_blank_end(str);
522
523 while (p) {
524 n = strchr(p, ',');
525 if (n)
526 *n++ = '\0';
527 if (!strcmp(p, "read"))
528 td->o.replay_skip |= 1u << DDIR_READ;
529 else if (!strcmp(p, "write"))
530 td->o.replay_skip |= 1u << DDIR_WRITE;
531 else if (!strcmp(p, "trim"))
532 td->o.replay_skip |= 1u << DDIR_TRIM;
533 else if (!strcmp(p, "sync"))
534 td->o.replay_skip |= 1u << DDIR_SYNC;
535 else {
536 log_err("Unknown skip type: %s\n", p);
537 ret = 1;
538 break;
539 }
540 p = n;
541 }
542 free(str);
543 return ret;
544}
545
8b28bd41
DM
546static int str_ignore_error_cb(void *data, const char *input)
547{
a609f12a 548 struct thread_data *td = cb_data_to_td(data);
8b28bd41 549 char *str, *p, *n;
3ed673c6
TK
550 int ret = 1;
551 enum error_type_bit type = 0;
52c0cea3
JA
552
553 if (parse_dryrun())
554 return 0;
555
8b28bd41
DM
556 p = str = strdup(input);
557
558 strip_blank_front(&str);
559 strip_blank_end(str);
560
561 while (p) {
562 n = strchr(p, ',');
563 if (n)
564 *n++ = '\0';
565 ret = ignore_error_type(td, type, p);
566 if (ret)
567 break;
568 p = n;
569 type++;
570 }
571 free(str);
572 return ret;
573}
574
211097b2
JA
575static int str_rw_cb(void *data, const char *str)
576{
a609f12a 577 struct thread_data *td = cb_data_to_td(data);
83ea422a 578 struct thread_options *o = &td->o;
27ca949f 579 char *nr;
211097b2 580
52c0cea3
JA
581 if (parse_dryrun())
582 return 0;
583
83ea422a
JA
584 o->ddir_seq_nr = 1;
585 o->ddir_seq_add = 0;
059b0802 586
27ca949f 587 nr = get_opt_postfix(str);
059b0802
JA
588 if (!nr)
589 return 0;
590
591 if (td_random(td))
83ea422a 592 o->ddir_seq_nr = atoi(nr);
059b0802
JA
593 else {
594 long long val;
595
88038bc7 596 if (str_to_decimal(nr, &val, 1, o, 0, 0)) {
059b0802
JA
597 log_err("fio: rw postfix parsing failed\n");
598 free(nr);
599 return 1;
600 }
601
83ea422a 602 o->ddir_seq_add = val;
182ec6ee 603 }
211097b2 604
059b0802 605 free(nr);
211097b2
JA
606 return 0;
607}
608
214e1eca
JA
609static int str_mem_cb(void *data, const char *mem)
610{
a609f12a 611 struct thread_data *td = cb_data_to_td(data);
214e1eca 612
217b0f1d
LG
613 if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP ||
614 td->o.mem_type == MEM_MMAPSHARED)
836fcc0f 615 td->o.mmapfile = get_opt_postfix(mem);
214e1eca
JA
616
617 return 0;
618}
619
c223da83
JA
620static int fio_clock_source_cb(void *data, const char *str)
621{
a609f12a 622 struct thread_data *td = cb_data_to_td(data);
c223da83
JA
623
624 fio_clock_source = td->o.clocksource;
fa80feae 625 fio_clock_source_set = 1;
01423eae 626 fio_clock_init();
c223da83
JA
627 return 0;
628}
629
85bc833b 630static int str_rwmix_read_cb(void *data, unsigned long long *val)
cb499fc4 631{
a609f12a 632 struct thread_data *td = cb_data_to_td(data);
cb499fc4
JA
633
634 td->o.rwmix[DDIR_READ] = *val;
635 td->o.rwmix[DDIR_WRITE] = 100 - *val;
636 return 0;
637}
638
85bc833b 639static int str_rwmix_write_cb(void *data, unsigned long long *val)
cb499fc4 640{
a609f12a 641 struct thread_data *td = cb_data_to_td(data);
cb499fc4
JA
642
643 td->o.rwmix[DDIR_WRITE] = *val;
644 td->o.rwmix[DDIR_READ] = 100 - *val;
645 return 0;
646}
647
214e1eca
JA
648static int str_exitall_cb(void)
649{
f1867a7f 650 exitall_on_terminate = true;
214e1eca
JA
651 return 0;
652}
653
214e1eca 654#ifdef FIO_HAVE_CPU_AFFINITY
50b5860b 655int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index)
c2acfbac 656{
50b5860b 657 unsigned int i, index, cpus_in_mask;
40f61ec7 658 const long max_cpu = cpus_configured();
c2acfbac 659
50b5860b 660 cpus_in_mask = fio_cpu_count(mask);
3a294b87
VF
661 if (!cpus_in_mask)
662 return 0;
663
50b5860b
JA
664 cpu_index = cpu_index % cpus_in_mask;
665
666 index = 0;
c2acfbac 667 for (i = 0; i < max_cpu; i++) {
50b5860b 668 if (!fio_cpu_isset(mask, i))
c2acfbac 669 continue;
50b5860b
JA
670
671 if (cpu_index != index)
672 fio_cpu_clear(mask, i);
673
674 index++;
c2acfbac
JA
675 }
676
677 return fio_cpu_count(mask);
678}
679
85bc833b 680static int str_cpumask_cb(void *data, unsigned long long *val)
d2e268b0 681{
a609f12a 682 struct thread_data *td = cb_data_to_td(data);
214e1eca 683 unsigned int i;
b03daafb 684 long max_cpu;
d2ce18b5
JA
685 int ret;
686
52c0cea3
JA
687 if (parse_dryrun())
688 return 0;
689
d2ce18b5
JA
690 ret = fio_cpuset_init(&td->o.cpumask);
691 if (ret < 0) {
692 log_err("fio: cpuset_init failed\n");
693 td_verror(td, ret, "fio_cpuset_init");
694 return 1;
695 }
214e1eca 696
40f61ec7 697 max_cpu = cpus_configured();
214e1eca 698
62a7273d
JA
699 for (i = 0; i < sizeof(int) * 8; i++) {
700 if ((1 << i) & *val) {
b8411399 701 if (i >= max_cpu) {
b03daafb 702 log_err("fio: CPU %d too large (max=%ld)\n", i,
b8411399 703 max_cpu - 1);
b03daafb
JA
704 return 1;
705 }
62a7273d 706 dprint(FD_PARSE, "set cpu allowed %d\n", i);
6d459ee7 707 fio_cpu_set(&td->o.cpumask, i);
62a7273d
JA
708 }
709 }
d2e268b0 710
d2e268b0 711 return 0;
214e1eca
JA
712}
713
e8462bd8
JA
714static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask,
715 const char *input)
214e1eca 716{
d2e268b0 717 char *cpu, *str, *p;
b03daafb 718 long max_cpu;
19608d6c 719 int ret = 0;
d2e268b0 720
e8462bd8 721 ret = fio_cpuset_init(mask);
d2ce18b5
JA
722 if (ret < 0) {
723 log_err("fio: cpuset_init failed\n");
724 td_verror(td, ret, "fio_cpuset_init");
725 return 1;
726 }
d2e268b0
JA
727
728 p = str = strdup(input);
214e1eca 729
d2e268b0
JA
730 strip_blank_front(&str);
731 strip_blank_end(str);
732
40f61ec7 733 max_cpu = cpus_configured();
b03daafb 734
d2e268b0 735 while ((cpu = strsep(&str, ",")) != NULL) {
62a7273d
JA
736 char *str2, *cpu2;
737 int icpu, icpu2;
738
d2e268b0
JA
739 if (!strlen(cpu))
740 break;
62a7273d
JA
741
742 str2 = cpu;
743 icpu2 = -1;
744 while ((cpu2 = strsep(&str2, "-")) != NULL) {
745 if (!strlen(cpu2))
746 break;
747
748 icpu2 = atoi(cpu2);
749 }
750
751 icpu = atoi(cpu);
752 if (icpu2 == -1)
753 icpu2 = icpu;
754 while (icpu <= icpu2) {
6d459ee7 755 if (icpu >= FIO_MAX_CPUS) {
19608d6c 756 log_err("fio: your OS only supports up to"
6d459ee7 757 " %d CPUs\n", (int) FIO_MAX_CPUS);
19608d6c
JA
758 ret = 1;
759 break;
760 }
9e986889 761 if (icpu >= max_cpu) {
b03daafb 762 log_err("fio: CPU %d too large (max=%ld)\n",
9e986889 763 icpu, max_cpu - 1);
b03daafb
JA
764 ret = 1;
765 break;
766 }
0b9d69ec 767
62a7273d 768 dprint(FD_PARSE, "set cpu allowed %d\n", icpu);
e8462bd8 769 fio_cpu_set(mask, icpu);
62a7273d
JA
770 icpu++;
771 }
19608d6c
JA
772 if (ret)
773 break;
d2e268b0
JA
774 }
775
776 free(p);
19608d6c 777 return ret;
214e1eca 778}
e8462bd8
JA
779
780static int str_cpus_allowed_cb(void *data, const char *input)
781{
a609f12a 782 struct thread_data *td = cb_data_to_td(data);
e8462bd8 783
52c0cea3
JA
784 if (parse_dryrun())
785 return 0;
786
b2a9e649 787 return set_cpus_allowed(td, &td->o.cpumask, input);
e8462bd8
JA
788}
789
790static int str_verify_cpus_allowed_cb(void *data, const char *input)
791{
a609f12a 792 struct thread_data *td = cb_data_to_td(data);
e8462bd8 793
466155e2
JA
794 if (parse_dryrun())
795 return 0;
796
b2a9e649 797 return set_cpus_allowed(td, &td->o.verify_cpumask, input);
e8462bd8 798}
c08f9fe2 799
105157ad 800#ifdef CONFIG_ZLIB
c08f9fe2
JA
801static int str_log_cpus_allowed_cb(void *data, const char *input)
802{
a609f12a 803 struct thread_data *td = cb_data_to_td(data);
c08f9fe2
JA
804
805 if (parse_dryrun())
806 return 0;
807
808 return set_cpus_allowed(td, &td->o.log_gz_cpumask, input);
809}
105157ad 810#endif /* CONFIG_ZLIB */
c08f9fe2 811
105157ad 812#endif /* FIO_HAVE_CPU_AFFINITY */
214e1eca 813
67bf9823 814#ifdef CONFIG_LIBNUMA
d0b937ed
YR
815static int str_numa_cpunodes_cb(void *data, char *input)
816{
a609f12a 817 struct thread_data *td = cb_data_to_td(data);
43522848 818 struct bitmask *verify_bitmask;
d0b937ed 819
52c0cea3
JA
820 if (parse_dryrun())
821 return 0;
822
d0b937ed
YR
823 /* numa_parse_nodestring() parses a character string list
824 * of nodes into a bit mask. The bit mask is allocated by
825 * numa_allocate_nodemask(), so it should be freed by
826 * numa_free_nodemask().
827 */
43522848
DG
828 verify_bitmask = numa_parse_nodestring(input);
829 if (verify_bitmask == NULL) {
d0b937ed
YR
830 log_err("fio: numa_parse_nodestring failed\n");
831 td_verror(td, 1, "str_numa_cpunodes_cb");
832 return 1;
833 }
43522848 834 numa_free_nodemask(verify_bitmask);
d0b937ed 835
43522848 836 td->o.numa_cpunodes = strdup(input);
d0b937ed
YR
837 return 0;
838}
839
840static int str_numa_mpol_cb(void *data, char *input)
841{
a609f12a 842 struct thread_data *td = cb_data_to_td(data);
d0b937ed 843 const char * const policy_types[] =
05d6f44b 844 { "default", "prefer", "bind", "interleave", "local", NULL };
d0b937ed 845 int i;
52c0cea3 846 char *nodelist;
43522848 847 struct bitmask *verify_bitmask;
52c0cea3
JA
848
849 if (parse_dryrun())
850 return 0;
d0b937ed 851
52c0cea3 852 nodelist = strchr(input, ':');
d0b937ed
YR
853 if (nodelist) {
854 /* NUL-terminate mode */
855 *nodelist++ = '\0';
856 }
857
858 for (i = 0; i <= MPOL_LOCAL; i++) {
859 if (!strcmp(input, policy_types[i])) {
860 td->o.numa_mem_mode = i;
861 break;
862 }
863 }
864 if (i > MPOL_LOCAL) {
865 log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n");
866 goto out;
867 }
868
869 switch (td->o.numa_mem_mode) {
870 case MPOL_PREFERRED:
871 /*
872 * Insist on a nodelist of one node only
873 */
874 if (nodelist) {
875 char *rest = nodelist;
876 while (isdigit(*rest))
877 rest++;
878 if (*rest) {
879 log_err("fio: one node only for \'prefer\'\n");
880 goto out;
881 }
882 } else {
883 log_err("fio: one node is needed for \'prefer\'\n");
884 goto out;
885 }
886 break;
887 case MPOL_INTERLEAVE:
888 /*
889 * Default to online nodes with memory if no nodelist
890 */
891 if (!nodelist)
892 nodelist = strdup("all");
893 break;
894 case MPOL_LOCAL:
895 case MPOL_DEFAULT:
896 /*
897 * Don't allow a nodelist
898 */
899 if (nodelist) {
900 log_err("fio: NO nodelist for \'local\'\n");
901 goto out;
902 }
903 break;
904 case MPOL_BIND:
905 /*
906 * Insist on a nodelist
907 */
908 if (!nodelist) {
909 log_err("fio: a nodelist is needed for \'bind\'\n");
910 goto out;
911 }
912 break;
913 }
914
915
916 /* numa_parse_nodestring() parses a character string list
917 * of nodes into a bit mask. The bit mask is allocated by
918 * numa_allocate_nodemask(), so it should be freed by
919 * numa_free_nodemask().
920 */
921 switch (td->o.numa_mem_mode) {
922 case MPOL_PREFERRED:
923 td->o.numa_mem_prefer_node = atoi(nodelist);
924 break;
925 case MPOL_INTERLEAVE:
926 case MPOL_BIND:
43522848
DG
927 verify_bitmask = numa_parse_nodestring(nodelist);
928 if (verify_bitmask == NULL) {
d0b937ed
YR
929 log_err("fio: numa_parse_nodestring failed\n");
930 td_verror(td, 1, "str_numa_memnodes_cb");
931 return 1;
932 }
43522848
DG
933 td->o.numa_memnodes = strdup(nodelist);
934 numa_free_nodemask(verify_bitmask);
b74e419e 935
d0b937ed
YR
936 break;
937 case MPOL_LOCAL:
938 case MPOL_DEFAULT:
939 default:
940 break;
941 }
942
d0b937ed 943 return 0;
d0b937ed
YR
944out:
945 return 1;
946}
947#endif
948
214e1eca
JA
949static int str_fst_cb(void *data, const char *str)
950{
a609f12a 951 struct thread_data *td = cb_data_to_td(data);
8c07860d 952 double val;
a87c90fd 953 double center = -1;
8c07860d
JA
954 bool done = false;
955 char *nr;
214e1eca
JA
956
957 td->file_service_nr = 1;
8c07860d
JA
958
959 switch (td->o.file_service_type) {
960 case FIO_FSERVICE_RANDOM:
961 case FIO_FSERVICE_RR:
962 case FIO_FSERVICE_SEQ:
963 nr = get_opt_postfix(str);
964 if (nr) {
965 td->file_service_nr = atoi(nr);
966 free(nr);
967 }
968 done = true;
969 break;
970 case FIO_FSERVICE_ZIPF:
971 val = FIO_DEF_ZIPF;
972 break;
973 case FIO_FSERVICE_PARETO:
974 val = FIO_DEF_PARETO;
975 break;
976 case FIO_FSERVICE_GAUSS:
977 val = 0.0;
978 break;
979 default:
980 log_err("fio: bad file service type: %d\n", td->o.file_service_type);
981 return 1;
982 }
983
984 if (done)
985 return 0;
986
987 nr = get_opt_postfix(str);
a87c90fd 988 if (nr && !split_parse_distr(nr, &val, &center)) {
8c07860d 989 log_err("fio: file service type random postfix parsing failed\n");
182ec6ee 990 free(nr);
8c07860d
JA
991 return 1;
992 }
993
994 free(nr);
995
a87c90fd
AK
996 if (center != -1 && (center < 0.00 || center > 1.00)) {
997 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
998 return 1;
999 }
1000 td->random_center = center;
1001
8c07860d
JA
1002 switch (td->o.file_service_type) {
1003 case FIO_FSERVICE_ZIPF:
1004 if (val == 1.00) {
1005 log_err("fio: zipf theta must be different than 1.0\n");
1006 return 1;
1007 }
1008 if (parse_dryrun())
1009 return 0;
1010 td->zipf_theta = val;
1011 break;
1012 case FIO_FSERVICE_PARETO:
1013 if (val <= 0.00 || val >= 1.00) {
1014 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1015 return 1;
1016 }
1017 if (parse_dryrun())
1018 return 0;
1019 td->pareto_h = val;
1020 break;
1021 case FIO_FSERVICE_GAUSS:
1022 if (val < 0.00 || val >= 100.00) {
99c94a6b 1023 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
8c07860d
JA
1024 return 1;
1025 }
1026 if (parse_dryrun())
1027 return 0;
1028 td->gauss_dev = val;
1029 break;
182ec6ee 1030 }
214e1eca
JA
1031
1032 return 0;
1033}
1034
67bf9823 1035#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
1036static int str_sfr_cb(void *data, const char *str)
1037{
a609f12a 1038 struct thread_data *td = cb_data_to_td(data);
44f29692
JA
1039 char *nr = get_opt_postfix(str);
1040
1041 td->sync_file_range_nr = 1;
1042 if (nr) {
1043 td->sync_file_range_nr = atoi(nr);
1044 free(nr);
1045 }
1046
1047 return 0;
1048}
3ae06371 1049#endif
44f29692 1050
f311f5f3
DLM
1051static int zone_split_ddir(struct thread_options *o, void *eo,
1052 enum fio_ddir ddir, char *str, bool absolute)
e0a04ac1 1053{
e0a04ac1 1054 unsigned int i, perc, perc_missing, sperc, sperc_missing;
d2835319 1055 struct split split;
e0a04ac1 1056
d2835319 1057 memset(&split, 0, sizeof(split));
e0a04ac1 1058
517c9c72 1059 if (split_parse_ddir(o, &split, str, absolute, ZONESPLIT_MAX))
d2835319
JA
1060 return 1;
1061 if (!split.nr)
1062 return 0;
e0a04ac1 1063
d2835319
JA
1064 o->zone_split[ddir] = malloc(split.nr * sizeof(struct zone_split));
1065 o->zone_split_nr[ddir] = split.nr;
1066 for (i = 0; i < split.nr; i++) {
1067 o->zone_split[ddir][i].access_perc = split.val1[i];
59466396
JA
1068 if (absolute)
1069 o->zone_split[ddir][i].size = split.val2[i];
1070 else
1071 o->zone_split[ddir][i].size_perc = split.val2[i];
e0a04ac1
JA
1072 }
1073
e0a04ac1
JA
1074 /*
1075 * Now check if the percentages add up, and how much is missing
1076 */
1077 perc = perc_missing = 0;
1078 sperc = sperc_missing = 0;
1079 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
d2835319 1080 struct zone_split *zsp = &o->zone_split[ddir][i];
e0a04ac1
JA
1081
1082 if (zsp->access_perc == (uint8_t) -1U)
1083 perc_missing++;
1084 else
1085 perc += zsp->access_perc;
1086
59466396
JA
1087 if (!absolute) {
1088 if (zsp->size_perc == (uint8_t) -1U)
1089 sperc_missing++;
1090 else
1091 sperc += zsp->size_perc;
1092 }
e0a04ac1
JA
1093 }
1094
1095 if (perc > 100 || sperc > 100) {
1096 log_err("fio: zone_split percentages add to more than 100%%\n");
d2835319
JA
1097 free(o->zone_split[ddir]);
1098 o->zone_split[ddir] = NULL;
e0a04ac1
JA
1099 return 1;
1100 }
1101 if (perc < 100) {
1102 log_err("fio: access percentage don't add up to 100 for zoned "
1103 "random distribution (got=%u)\n", perc);
d2835319
JA
1104 free(o->zone_split[ddir]);
1105 o->zone_split[ddir] = NULL;
e0a04ac1
JA
1106 return 1;
1107 }
1108
1109 /*
1110 * If values didn't have a percentage set, divide the remains between
1111 * them.
1112 */
1113 if (perc_missing) {
1114 if (perc_missing == 1 && o->zone_split_nr[ddir] == 1)
1115 perc = 100;
1116 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
d2835319 1117 struct zone_split *zsp = &o->zone_split[ddir][i];
e0a04ac1
JA
1118
1119 if (zsp->access_perc == (uint8_t) -1U)
1120 zsp->access_perc = (100 - perc) / perc_missing;
1121 }
1122 }
1123 if (sperc_missing) {
1124 if (sperc_missing == 1 && o->zone_split_nr[ddir] == 1)
1125 sperc = 100;
1126 for (i = 0; i < o->zone_split_nr[ddir]; i++) {
d2835319 1127 struct zone_split *zsp = &o->zone_split[ddir][i];
e0a04ac1
JA
1128
1129 if (zsp->size_perc == (uint8_t) -1U)
1130 zsp->size_perc = (100 - sperc) / sperc_missing;
1131 }
1132 }
1133
e0a04ac1
JA
1134 return 0;
1135}
1136
59466396
JA
1137static int parse_zoned_distribution(struct thread_data *td, const char *input,
1138 bool absolute)
e0a04ac1 1139{
59466396 1140 const char *pre = absolute ? "zoned_abs:" : "zoned:";
764593c0 1141 char *str, *p;
e0a04ac1
JA
1142 int i, ret = 0;
1143
1144 p = str = strdup(input);
1145
1146 strip_blank_front(&str);
1147 strip_blank_end(str);
1148
1149 /* We expect it to start like that, bail if not */
59466396 1150 if (strncmp(str, pre, strlen(pre))) {
e0a04ac1
JA
1151 log_err("fio: mismatch in zoned input <%s>\n", str);
1152 free(p);
1153 return 1;
1154 }
59466396 1155 str += strlen(pre);
e0a04ac1 1156
f311f5f3 1157 ret = str_split_parse(td, str, zone_split_ddir, NULL, absolute);
e0a04ac1
JA
1158
1159 free(p);
1160
1161 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1162 int j;
1163
1164 dprint(FD_PARSE, "zone ddir %d (nr=%u): \n", i, td->o.zone_split_nr[i]);
1165
1166 for (j = 0; j < td->o.zone_split_nr[i]; j++) {
1167 struct zone_split *zsp = &td->o.zone_split[i][j];
1168
59466396
JA
1169 if (absolute) {
1170 dprint(FD_PARSE, "\t%d: %u/%llu\n", j,
1171 zsp->access_perc,
1172 (unsigned long long) zsp->size);
1173 } else {
1174 dprint(FD_PARSE, "\t%d: %u/%u\n", j,
1175 zsp->access_perc,
1176 zsp->size_perc);
1177 }
e0a04ac1
JA
1178 }
1179 }
1180
55baca06 1181 if (parse_dryrun()) {
55baca06
JA
1182 for (i = 0; i < DDIR_RWDIR_CNT; i++) {
1183 free(td->o.zone_split[i]);
1184 td->o.zone_split[i] = NULL;
1185 td->o.zone_split_nr[i] = 0;
1186 }
1187
1188 return ret;
1189 }
1190
81bdb791 1191 if (ret) {
dc4bffb8
JA
1192 for (i = 0; i < DDIR_RWDIR_CNT; i++)
1193 td->o.zone_split_nr[i] = 0;
1194 }
e0a04ac1
JA
1195
1196 return ret;
1197}
1198
e25839d4
JA
1199static int str_random_distribution_cb(void *data, const char *str)
1200{
a609f12a 1201 struct thread_data *td = cb_data_to_td(data);
e25839d4 1202 double val;
a87c90fd 1203 double center = -1;
e25839d4
JA
1204 char *nr;
1205
925fee33 1206 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF)
c95f9404 1207 val = FIO_DEF_ZIPF;
925fee33 1208 else if (td->o.random_distribution == FIO_RAND_DIST_PARETO)
c95f9404 1209 val = FIO_DEF_PARETO;
56d9fa4b
JA
1210 else if (td->o.random_distribution == FIO_RAND_DIST_GAUSS)
1211 val = 0.0;
e0a04ac1 1212 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED)
59466396
JA
1213 return parse_zoned_distribution(td, str, false);
1214 else if (td->o.random_distribution == FIO_RAND_DIST_ZONED_ABS)
1215 return parse_zoned_distribution(td, str, true);
925fee33 1216 else
e25839d4
JA
1217 return 0;
1218
1219 nr = get_opt_postfix(str);
a87c90fd 1220 if (nr && !split_parse_distr(nr, &val, &center)) {
e25839d4
JA
1221 log_err("fio: random postfix parsing failed\n");
1222 free(nr);
1223 return 1;
1224 }
1225
078189c1
JA
1226 free(nr);
1227
a87c90fd
AK
1228 if (center != -1 && (center < 0.00 || center > 1.00)) {
1229 log_err("fio: distribution center out of range (0 <= center <= 1.0)\n");
1230 return 1;
1231 }
1232 td->o.random_center.u.f = center;
1233
18ded917
JA
1234 if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) {
1235 if (val == 1.00) {
1236 log_err("fio: zipf theta must different than 1.0\n");
1237 return 1;
1238 }
55baca06
JA
1239 if (parse_dryrun())
1240 return 0;
1e5324e7 1241 td->o.zipf_theta.u.f = val;
56d9fa4b 1242 } else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) {
078189c1
JA
1243 if (val <= 0.00 || val >= 1.00) {
1244 log_err("fio: pareto input out of range (0 < input < 1.0)\n");
1245 return 1;
1246 }
55baca06
JA
1247 if (parse_dryrun())
1248 return 0;
1e5324e7 1249 td->o.pareto_h.u.f = val;
3cdb8cf3 1250 } else {
76527b19 1251 if (val < 0.00 || val >= 100.0) {
99c94a6b 1252 log_err("fio: normal deviation out of range (0 <= input < 100.0)\n");
3cdb8cf3
JA
1253 return 1;
1254 }
55baca06
JA
1255 if (parse_dryrun())
1256 return 0;
f88cd222 1257 td->o.gauss_dev.u.f = val;
3cdb8cf3 1258 }
921c766f
JA
1259
1260 return 0;
1261}
1262
16e56d25
VF
1263static int str_steadystate_cb(void *data, const char *str)
1264{
94f218f6 1265 struct thread_data *td = cb_data_to_td(data);
16e56d25
VF
1266 double val;
1267 char *nr;
1268 char *pct;
1269 long long ll;
1270
2c5d94bc
VF
1271 if (td->o.ss_state != FIO_SS_IOPS && td->o.ss_state != FIO_SS_IOPS_SLOPE &&
1272 td->o.ss_state != FIO_SS_BW && td->o.ss_state != FIO_SS_BW_SLOPE) {
16e56d25
VF
1273 /* should be impossible to get here */
1274 log_err("fio: unknown steady state criterion\n");
1275 return 1;
1276 }
1277
1278 nr = get_opt_postfix(str);
1279 if (!nr) {
1280 log_err("fio: steadystate threshold must be specified in addition to criterion\n");
1281 free(nr);
1282 return 1;
1283 }
1284
1285 /* ENHANCEMENT Allow fio to understand size=10.2% and use here */
1286 pct = strstr(nr, "%");
1287 if (pct) {
1288 *pct = '\0';
1289 strip_blank_end(nr);
1290 if (!str_to_float(nr, &val, 0)) {
1291 log_err("fio: could not parse steadystate threshold percentage\n");
1292 free(nr);
1293 return 1;
1294 }
1295
1296 dprint(FD_PARSE, "set steady state threshold to %f%%\n", val);
1297 free(nr);
1298 if (parse_dryrun())
1299 return 0;
1300
c8caba48 1301 td->o.ss_state |= FIO_SS_PCT;
16e56d25 1302 td->o.ss_limit.u.f = val;
c8caba48 1303 } else if (td->o.ss_state & FIO_SS_IOPS) {
16e56d25
VF
1304 if (!str_to_float(nr, &val, 0)) {
1305 log_err("fio: steadystate IOPS threshold postfix parsing failed\n");
1306 free(nr);
1307 return 1;
1308 }
1309
1310 dprint(FD_PARSE, "set steady state IOPS threshold to %f\n", val);
1311 free(nr);
1312 if (parse_dryrun())
1313 return 0;
1314
16e56d25 1315 td->o.ss_limit.u.f = val;
16e56d25
VF
1316 } else { /* bandwidth criterion */
1317 if (str_to_decimal(nr, &ll, 1, td, 0, 0)) {
1318 log_err("fio: steadystate BW threshold postfix parsing failed\n");
1319 free(nr);
1320 return 1;
1321 }
1322
1323 dprint(FD_PARSE, "set steady state BW threshold to %lld\n", ll);
1324 free(nr);
1325 if (parse_dryrun())
1326 return 0;
1327
16e56d25 1328 td->o.ss_limit.u.f = (double) ll;
16e56d25
VF
1329 }
1330
2c5d94bc 1331 td->ss.state = td->o.ss_state;
16e56d25
VF
1332 return 0;
1333}
1334
8e827d35 1335/*
bcbfeefa 1336 * Return next name in the string. Files are separated with ':'. If the ':'
8e827d35
JA
1337 * is escaped with a '\', then that ':' is part of the filename and does not
1338 * indicate a new file.
1339 */
532eda7e 1340char *get_next_str(char **ptr)
8e827d35
JA
1341{
1342 char *str = *ptr;
1343 char *p, *start;
1344
1345 if (!str || !strlen(str))
1346 return NULL;
1347
1348 start = str;
1349 do {
1350 /*
1351 * No colon, we are done
1352 */
1353 p = strchr(str, ':');
1354 if (!p) {
1355 *ptr = NULL;
1356 break;
1357 }
1358
1359 /*
1360 * We got a colon, but it's the first character. Skip and
1361 * continue
1362 */
1363 if (p == start) {
1364 str = ++start;
1365 continue;
1366 }
1367
1368 if (*(p - 1) != '\\') {
1369 *p = '\0';
1370 *ptr = p + 1;
1371 break;
1372 }
1373
1374 memmove(p - 1, p, strlen(p) + 1);
1375 str = p;
1376 } while (1);
1377
1378 return start;
1379}
1380
bcbfeefa 1381
532eda7e 1382int get_max_str_idx(char *input)
bcbfeefa
CE
1383{
1384 unsigned int cur_idx;
1385 char *str, *p;
1386
1387 p = str = strdup(input);
1388 for (cur_idx = 0; ; cur_idx++)
532eda7e 1389 if (get_next_str(&str) == NULL)
bcbfeefa
CE
1390 break;
1391
1392 free(p);
1393 return cur_idx;
1394}
1395
1396/*
fc002f14 1397 * Returns the directory at the index, indexes > entries will be
bcbfeefa
CE
1398 * assigned via modulo division of the index
1399 */
922a5be8
JA
1400int set_name_idx(char *target, size_t tlen, char *input, int index,
1401 bool unique_filename)
bcbfeefa
CE
1402{
1403 unsigned int cur_idx;
1404 int len;
1405 char *fname, *str, *p;
1406
1407 p = str = strdup(input);
1408
532eda7e 1409 index %= get_max_str_idx(input);
bcbfeefa 1410 for (cur_idx = 0; cur_idx <= index; cur_idx++)
532eda7e 1411 fname = get_next_str(&str);
bcbfeefa 1412
922a5be8 1413 if (client_sockaddr_str[0] && unique_filename) {
e13c3b50
JA
1414 len = snprintf(target, tlen, "%s/%s.", fname,
1415 client_sockaddr_str);
1416 } else
df18600f
SW
1417 len = snprintf(target, tlen, "%s%c", fname,
1418 FIO_OS_PATH_SEPARATOR);
72a703da 1419
e13c3b50 1420 target[tlen - 1] = '\0';
bcbfeefa
CE
1421 free(p);
1422
1423 return len;
1424}
1425
c70c7f58
AK
1426char* get_name_by_idx(char *input, int index)
1427{
1428 unsigned int cur_idx;
1429 char *fname, *str, *p;
1430
1431 p = str = strdup(input);
1432
532eda7e 1433 index %= get_max_str_idx(input);
c70c7f58 1434 for (cur_idx = 0; cur_idx <= index; cur_idx++)
532eda7e 1435 fname = get_next_str(&str);
c70c7f58
AK
1436
1437 fname = strdup(fname);
1438 free(p);
1439
1440 return fname;
1441}
1442
214e1eca
JA
1443static int str_filename_cb(void *data, const char *input)
1444{
a609f12a 1445 struct thread_data *td = cb_data_to_td(data);
214e1eca
JA
1446 char *fname, *str, *p;
1447
1448 p = str = strdup(input);
1449
1450 strip_blank_front(&str);
1451 strip_blank_end(str);
1452
79591fa9
TK
1453 /*
1454 * Ignore what we may already have from nrfiles option.
1455 */
214e1eca 1456 if (!td->files_index)
2dc1bbeb 1457 td->o.nr_files = 0;
214e1eca 1458
532eda7e 1459 while ((fname = get_next_str(&str)) != NULL) {
214e1eca
JA
1460 if (!strlen(fname))
1461 break;
5903e7b7 1462 add_file(td, fname, 0, 1);
214e1eca
JA
1463 }
1464
1465 free(p);
1466 return 0;
1467}
1468
bcbfeefa 1469static int str_directory_cb(void *data, const char fio_unused *unused)
214e1eca 1470{
a609f12a 1471 struct thread_data *td = cb_data_to_td(data);
214e1eca 1472 struct stat sb;
bcbfeefa
CE
1473 char *dirname, *str, *p;
1474 int ret = 0;
214e1eca 1475
f9633d72
JA
1476 if (parse_dryrun())
1477 return 0;
1478
bcbfeefa 1479 p = str = strdup(td->o.directory);
532eda7e 1480 while ((dirname = get_next_str(&str)) != NULL) {
bcbfeefa
CE
1481 if (lstat(dirname, &sb) < 0) {
1482 ret = errno;
921c766f 1483
bcbfeefa
CE
1484 log_err("fio: %s is not a directory\n", dirname);
1485 td_verror(td, ret, "lstat");
1486 goto out;
1487 }
1488 if (!S_ISDIR(sb.st_mode)) {
1489 log_err("fio: %s is not a directory\n", dirname);
1490 ret = 1;
1491 goto out;
1492 }
214e1eca
JA
1493 }
1494
bcbfeefa
CE
1495out:
1496 free(p);
1497 return ret;
214e1eca
JA
1498}
1499
1500static int str_opendir_cb(void *data, const char fio_unused *str)
1501{
a609f12a 1502 struct thread_data *td = cb_data_to_td(data);
214e1eca 1503
52c0cea3
JA
1504 if (parse_dryrun())
1505 return 0;
1506
214e1eca 1507 if (!td->files_index)
2dc1bbeb 1508 td->o.nr_files = 0;
214e1eca 1509
2dc1bbeb 1510 return add_dir_files(td, td->o.opendir);
214e1eca
JA
1511}
1512
ce35b1ec
JA
1513static int str_buffer_pattern_cb(void *data, const char *input)
1514{
a609f12a 1515 struct thread_data *td = cb_data_to_td(data);
ce35b1ec
JA
1516 int ret;
1517
61b9861d 1518 /* FIXME: for now buffer pattern does not support formats */
1dc47d6b
LG
1519 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1520 &td->o.buffer_pattern, NULL, NULL, NULL);
61b9861d
RP
1521 if (ret < 0)
1522 return 1;
ce35b1ec 1523
61b9861d
RP
1524 assert(ret != 0);
1525 td->o.buffer_pattern_bytes = ret;
c55fae03
JA
1526
1527 /*
1528 * If this job is doing any reading or has compression set,
1529 * ensure that we refill buffers for writes or we could be
1530 * invalidating the pattern through reads.
1531 */
1532 if (!td->o.compress_percentage && !td_read(td))
61b9861d 1533 td->o.refill_buffers = 0;
c55fae03
JA
1534 else
1535 td->o.refill_buffers = 1;
1536
61b9861d
RP
1537 td->o.scramble_buffers = 0;
1538 td->o.zero_buffers = 0;
efcd9dcc 1539
61b9861d 1540 return 0;
ce35b1ec
JA
1541}
1542
bedc9dc2
JA
1543static int str_buffer_compress_cb(void *data, unsigned long long *il)
1544{
a609f12a 1545 struct thread_data *td = cb_data_to_td(data);
bedc9dc2
JA
1546
1547 td->flags |= TD_F_COMPRESS;
1548 td->o.compress_percentage = *il;
1549 return 0;
1550}
1551
5c94b008
JA
1552static int str_dedupe_cb(void *data, unsigned long long *il)
1553{
a609f12a 1554 struct thread_data *td = cb_data_to_td(data);
5c94b008
JA
1555
1556 td->flags |= TD_F_COMPRESS;
1557 td->o.dedupe_percentage = *il;
1558 td->o.refill_buffers = 1;
1559 return 0;
1560}
1561
ce35b1ec
JA
1562static int str_verify_pattern_cb(void *data, const char *input)
1563{
a609f12a 1564 struct thread_data *td = cb_data_to_td(data);
ce35b1ec
JA
1565 int ret;
1566
59f94d26 1567 td->o.verify_fmt_sz = FIO_ARRAY_SIZE(td->o.verify_fmt);
1dc47d6b
LG
1568 ret = parse_and_fill_pattern_alloc(input, strlen(input),
1569 &td->o.verify_pattern, fmt_desc, td->o.verify_fmt,
1570 &td->o.verify_fmt_sz);
61b9861d
RP
1571 if (ret < 0)
1572 return 1;
efcd9dcc 1573
61b9861d
RP
1574 assert(ret != 0);
1575 td->o.verify_pattern_bytes = ret;
92bf48d5 1576 /*
b638d82f 1577 * VERIFY_* could already be set
92bf48d5 1578 */
61b9861d 1579 if (!fio_option_is_set(&td->o, verify))
92bf48d5 1580 td->o.verify = VERIFY_PATTERN;
efcd9dcc 1581
61b9861d 1582 return 0;
90059d65 1583}
214e1eca 1584
993bf48b
JA
1585static int str_gtod_reduce_cb(void *data, int *il)
1586{
a609f12a 1587 struct thread_data *td = cb_data_to_td(data);
993bf48b
JA
1588 int val = *il;
1589
56440e63 1590 /*
fc002f14 1591 * Only modify options if gtod_reduce==1
56440e63
VF
1592 * Otherwise leave settings alone.
1593 */
1594 if (val) {
1595 td->o.disable_lat = 1;
1596 td->o.disable_clat = 1;
1597 td->o.disable_slat = 1;
1598 td->o.disable_bw = 1;
1599 td->o.clat_percentiles = 0;
1600 td->o.lat_percentiles = 0;
1601 td->o.slat_percentiles = 0;
8b6a404c 1602 td->ts_cache_mask = 63;
56440e63 1603 }
993bf48b
JA
1604
1605 return 0;
1606}
1607
89978a6b
BW
1608static int str_offset_cb(void *data, unsigned long long *__val)
1609{
1610 struct thread_data *td = cb_data_to_td(data);
1611 unsigned long long v = *__val;
1612
1613 if (parse_is_percent(v)) {
1614 td->o.start_offset = 0;
1615 td->o.start_offset_percent = -1ULL - v;
8f39afa7 1616 td->o.start_offset_nz = 0;
872e0415
JA
1617 dprint(FD_PARSE, "SET start_offset_percent %d\n",
1618 td->o.start_offset_percent);
8f39afa7
AD
1619 } else if (parse_is_zone(v)) {
1620 td->o.start_offset = 0;
1621 td->o.start_offset_percent = 0;
1622 td->o.start_offset_nz = v - ZONE_BASE_VAL;
89978a6b
BW
1623 } else
1624 td->o.start_offset = v;
1625
1626 return 0;
1627}
1628
0b288ba1
VF
1629static int str_offset_increment_cb(void *data, unsigned long long *__val)
1630{
1631 struct thread_data *td = cb_data_to_td(data);
1632 unsigned long long v = *__val;
1633
1634 if (parse_is_percent(v)) {
1635 td->o.offset_increment = 0;
1636 td->o.offset_increment_percent = -1ULL - v;
8f39afa7 1637 td->o.offset_increment_nz = 0;
0b288ba1
VF
1638 dprint(FD_PARSE, "SET offset_increment_percent %d\n",
1639 td->o.offset_increment_percent);
8f39afa7
AD
1640 } else if (parse_is_zone(v)) {
1641 td->o.offset_increment = 0;
1642 td->o.offset_increment_percent = 0;
1643 td->o.offset_increment_nz = v - ZONE_BASE_VAL;
0b288ba1
VF
1644 } else
1645 td->o.offset_increment = v;
1646
1647 return 0;
1648}
1649
7bb59102
JA
1650static int str_size_cb(void *data, unsigned long long *__val)
1651{
a609f12a 1652 struct thread_data *td = cb_data_to_td(data);
7bb59102
JA
1653 unsigned long long v = *__val;
1654
1655 if (parse_is_percent(v)) {
1656 td->o.size = 0;
1657 td->o.size_percent = -1ULL - v;
24e4321c
TK
1658 dprint(FD_PARSE, "SET size_percent %d\n",
1659 td->o.size_percent);
8f39afa7
AD
1660 } else if (parse_is_zone(v)) {
1661 td->o.size = 0;
1662 td->o.size_percent = 0;
1663 td->o.size_nz = v - ZONE_BASE_VAL;
7bb59102
JA
1664 } else
1665 td->o.size = v;
1666
1667 return 0;
1668}
1669
8b38f401
AD
1670static int str_io_size_cb(void *data, unsigned long long *__val)
1671{
1672 struct thread_data *td = cb_data_to_td(data);
1673 unsigned long long v = *__val;
1674
f248a525 1675 if (parse_is_percent_uncapped(v)) {
8b38f401
AD
1676 td->o.io_size = 0;
1677 td->o.io_size_percent = -1ULL - v;
f248a525
AD
1678 if (td->o.io_size_percent > 100) {
1679 log_err("fio: io_size values greater than 100%% aren't supported\n");
1680 return 1;
1681 }
8b38f401
AD
1682 dprint(FD_PARSE, "SET io_size_percent %d\n",
1683 td->o.io_size_percent);
8f39afa7
AD
1684 } else if (parse_is_zone(v)) {
1685 td->o.io_size = 0;
1686 td->o.io_size_percent = 0;
1687 td->o.io_size_nz = v - ZONE_BASE_VAL;
8b38f401
AD
1688 } else
1689 td->o.io_size = v;
1690
1691 return 0;
1692}
1693
8f39afa7
AD
1694static int str_zoneskip_cb(void *data, unsigned long long *__val)
1695{
1696 struct thread_data *td = cb_data_to_td(data);
1697 unsigned long long v = *__val;
1698
1699 if (parse_is_zone(v)) {
1700 td->o.zone_skip = 0;
1701 td->o.zone_skip_nz = v - ZONE_BASE_VAL;
1702 } else
1703 td->o.zone_skip = v;
1704
1705 return 0;
1706}
1707
dded427c
OS
1708static int str_write_bw_log_cb(void *data, const char *str)
1709{
1710 struct thread_data *td = cb_data_to_td(data);
1711
1712 if (str)
1713 td->o.bw_log_file = strdup(str);
1714
1715 td->o.write_bw_log = 1;
1716 return 0;
1717}
1718
1719static int str_write_lat_log_cb(void *data, const char *str)
1720{
1721 struct thread_data *td = cb_data_to_td(data);
1722
1723 if (str)
1724 td->o.lat_log_file = strdup(str);
1725
1726 td->o.write_lat_log = 1;
1727 return 0;
1728}
1729
1730static int str_write_iops_log_cb(void *data, const char *str)
1731{
1732 struct thread_data *td = cb_data_to_td(data);
1733
1734 if (str)
1735 td->o.iops_log_file = strdup(str);
1736
1737 td->o.write_iops_log = 1;
1738 return 0;
1739}
1740
1741static int str_write_hist_log_cb(void *data, const char *str)
1742{
1743 struct thread_data *td = cb_data_to_td(data);
1744
1745 if (str)
1746 td->o.hist_log_file = strdup(str);
1747
1748 td->o.write_hist_log = 1;
1749 return 0;
1750}
1751
6730b40f
TK
1752/*
1753 * str is supposed to be a substring of the strdup'd original string,
1754 * and is valid only if it's a regular file path.
1755 * This function keeps the pointer to the path as needed later.
1756 *
1757 * "external:/path/to/so\0" <- original pointer updated with strdup'd
1758 * "external\0" <- above pointer after parsed, i.e. ->ioengine
1759 * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path
1760 */
1761static int str_ioengine_external_cb(void *data, const char *str)
1762{
1763 struct thread_data *td = cb_data_to_td(data);
1764 struct stat sb;
1765 char *p;
1766
1767 if (!str) {
1768 log_err("fio: null external ioengine path\n");
1769 return 1;
1770 }
1771
1772 p = (char *)str; /* str is mutable */
1773 strip_blank_front(&p);
1774 strip_blank_end(p);
1775
1776 if (stat(p, &sb) || !S_ISREG(sb.st_mode)) {
1777 log_err("fio: invalid external ioengine path \"%s\"\n", p);
1778 return 1;
1779 }
1780
1781 td->o.ioengine_so_path = p;
1782 return 0;
1783}
1784
9109883a 1785static int rw_verify(const struct fio_option *o, void *data)
896cac2a 1786{
a609f12a 1787 struct thread_data *td = cb_data_to_td(data);
896cac2a 1788
d81d0f99
VF
1789 if (read_only && (td_write(td) || td_trim(td))) {
1790 log_err("fio: job <%s> has write or trim bit set, but"
1791 " fio is in read-only mode\n", td->o.name);
896cac2a
JA
1792 return 1;
1793 }
1794
1795 return 0;
1796}
1797
9109883a 1798static int gtod_cpu_verify(const struct fio_option *o, void *data)
29d43ff9 1799{
276ca4f7 1800#ifndef FIO_HAVE_CPU_AFFINITY
a609f12a 1801 struct thread_data *td = cb_data_to_td(data);
29d43ff9 1802
29d43ff9
JA
1803 if (td->o.gtod_cpu) {
1804 log_err("fio: platform must support CPU affinity for"
1805 "gettimeofday() offloading\n");
1806 return 1;
1807 }
1808#endif
1809
1810 return 0;
1811}
1812
214e1eca
JA
1813/*
1814 * Map of job/command line options
1815 */
9af4a244 1816struct fio_option fio_options[FIO_MAX_OPTS] = {
214e1eca
JA
1817 {
1818 .name = "description",
e8b0e958 1819 .lname = "Description of job",
214e1eca 1820 .type = FIO_OPT_STR_STORE,
a609f12a 1821 .off1 = offsetof(struct thread_options, description),
214e1eca 1822 .help = "Text job description",
e8b0e958 1823 .category = FIO_OPT_C_GENERAL,
0626037e 1824 .group = FIO_OPT_G_DESC,
214e1eca
JA
1825 },
1826 {
1827 .name = "name",
e8b0e958 1828 .lname = "Job name",
214e1eca 1829 .type = FIO_OPT_STR_STORE,
a609f12a 1830 .off1 = offsetof(struct thread_options, name),
214e1eca 1831 .help = "Name of this job",
e8b0e958 1832 .category = FIO_OPT_C_GENERAL,
0626037e 1833 .group = FIO_OPT_G_DESC,
214e1eca 1834 },
9cc8cb91
AK
1835 {
1836 .name = "wait_for",
1837 .lname = "Waitee name",
1838 .type = FIO_OPT_STR_STORE,
a609f12a 1839 .off1 = offsetof(struct thread_options, wait_for),
9cc8cb91
AK
1840 .help = "Name of the job this one wants to wait for before starting",
1841 .category = FIO_OPT_C_GENERAL,
1842 .group = FIO_OPT_G_DESC,
1843 },
214e1eca
JA
1844 {
1845 .name = "filename",
e8b0e958 1846 .lname = "Filename(s)",
214e1eca 1847 .type = FIO_OPT_STR_STORE,
a609f12a 1848 .off1 = offsetof(struct thread_options, filename),
46576743 1849 .maxlen = PATH_MAX,
214e1eca 1850 .cb = str_filename_cb,
f0d524b0 1851 .prio = -1, /* must come after "directory" */
214e1eca 1852 .help = "File(s) to use for the workload",
e8b0e958 1853 .category = FIO_OPT_C_FILE,
0626037e 1854 .group = FIO_OPT_G_FILENAME,
214e1eca 1855 },
90fef2d1 1856 {
e8b0e958
JA
1857 .name = "directory",
1858 .lname = "Directory",
1859 .type = FIO_OPT_STR_STORE,
a609f12a 1860 .off1 = offsetof(struct thread_options, directory),
e8b0e958
JA
1861 .cb = str_directory_cb,
1862 .help = "Directory to store files in",
1863 .category = FIO_OPT_C_FILE,
0626037e 1864 .group = FIO_OPT_G_FILENAME,
90fef2d1 1865 },
de98bd30
JA
1866 {
1867 .name = "filename_format",
922a5be8 1868 .lname = "Filename Format",
de98bd30 1869 .type = FIO_OPT_STR_STORE,
a609f12a 1870 .off1 = offsetof(struct thread_options, filename_format),
de98bd30
JA
1871 .prio = -1, /* must come after "directory" */
1872 .help = "Override default $jobname.$jobnum.$filenum naming",
1873 .def = "$jobname.$jobnum.$filenum",
93bb626a
JA
1874 .category = FIO_OPT_C_FILE,
1875 .group = FIO_OPT_G_FILENAME,
ad705bcb 1876 },
922a5be8
JA
1877 {
1878 .name = "unique_filename",
1879 .lname = "Unique Filename",
1880 .type = FIO_OPT_BOOL,
a609f12a 1881 .off1 = offsetof(struct thread_options, unique_filename),
922a5be8
JA
1882 .help = "For network clients, prefix file with source IP",
1883 .def = "1",
1884 .category = FIO_OPT_C_FILE,
1885 .group = FIO_OPT_G_FILENAME,
1886 },
29c1349f
JA
1887 {
1888 .name = "lockfile",
e8b0e958 1889 .lname = "Lockfile",
4d4e80f2 1890 .type = FIO_OPT_STR,
a609f12a 1891 .off1 = offsetof(struct thread_options, file_lock_mode),
29c1349f 1892 .help = "Lock file when doing IO to it",
bc6a0a5d 1893 .prio = 1,
29c1349f 1894 .parent = "filename",
d71c154c 1895 .hide = 0,
4d4e80f2 1896 .def = "none",
e8b0e958 1897 .category = FIO_OPT_C_FILE,
0626037e 1898 .group = FIO_OPT_G_FILENAME,
4d4e80f2
JA
1899 .posval = {
1900 { .ival = "none",
1901 .oval = FILE_LOCK_NONE,
1902 .help = "No file locking",
1903 },
1904 { .ival = "exclusive",
1905 .oval = FILE_LOCK_EXCLUSIVE,
1906 .help = "Exclusive file lock",
1907 },
1908 {
1909 .ival = "readwrite",
1910 .oval = FILE_LOCK_READWRITE,
1911 .help = "Read vs write lock",
1912 },
1913 },
29c1349f 1914 },
214e1eca
JA
1915 {
1916 .name = "opendir",
e8b0e958 1917 .lname = "Open directory",
214e1eca 1918 .type = FIO_OPT_STR_STORE,
a609f12a 1919 .off1 = offsetof(struct thread_options, opendir),
214e1eca
JA
1920 .cb = str_opendir_cb,
1921 .help = "Recursively add files from this directory and down",
e8b0e958 1922 .category = FIO_OPT_C_FILE,
0626037e 1923 .group = FIO_OPT_G_FILENAME,
214e1eca
JA
1924 },
1925 {
1926 .name = "rw",
e8b0e958 1927 .lname = "Read/write",
d3aad8f2 1928 .alias = "readwrite",
214e1eca 1929 .type = FIO_OPT_STR,
211097b2 1930 .cb = str_rw_cb,
a609f12a 1931 .off1 = offsetof(struct thread_options, td_ddir),
214e1eca
JA
1932 .help = "IO direction",
1933 .def = "read",
896cac2a 1934 .verify = rw_verify,
e8b0e958 1935 .category = FIO_OPT_C_IO,
0626037e 1936 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
1937 .posval = {
1938 { .ival = "read",
1939 .oval = TD_DDIR_READ,
1940 .help = "Sequential read",
1941 },
1942 { .ival = "write",
1943 .oval = TD_DDIR_WRITE,
1944 .help = "Sequential write",
1945 },
6eaf09d6
SL
1946 { .ival = "trim",
1947 .oval = TD_DDIR_TRIM,
1948 .help = "Sequential trim",
1949 },
214e1eca
JA
1950 { .ival = "randread",
1951 .oval = TD_DDIR_RANDREAD,
1952 .help = "Random read",
1953 },
1954 { .ival = "randwrite",
1955 .oval = TD_DDIR_RANDWRITE,
1956 .help = "Random write",
1957 },
6eaf09d6
SL
1958 { .ival = "randtrim",
1959 .oval = TD_DDIR_RANDTRIM,
1960 .help = "Random trim",
1961 },
214e1eca
JA
1962 { .ival = "rw",
1963 .oval = TD_DDIR_RW,
1964 .help = "Sequential read and write mix",
1965 },
10b023db
JA
1966 { .ival = "readwrite",
1967 .oval = TD_DDIR_RW,
1968 .help = "Sequential read and write mix",
1969 },
214e1eca
JA
1970 { .ival = "randrw",
1971 .oval = TD_DDIR_RANDRW,
1972 .help = "Random read and write mix"
1973 },
82a90686
JA
1974 { .ival = "trimwrite",
1975 .oval = TD_DDIR_TRIMWRITE,
1976 .help = "Trim and write mix, trims preceding writes"
0e4dd95c 1977 },
c16dc793
JA
1978 { .ival = "randtrimwrite",
1979 .oval = TD_DDIR_RANDTRIMWRITE,
1980 .help = "Randomly trim and write mix, trims preceding writes"
1981 },
214e1eca
JA
1982 },
1983 },
38dad62d
JA
1984 {
1985 .name = "rw_sequencer",
e8b0e958 1986 .lname = "RW Sequencer",
38dad62d 1987 .type = FIO_OPT_STR,
a609f12a 1988 .off1 = offsetof(struct thread_options, rw_seq),
38dad62d
JA
1989 .help = "IO offset generator modifier",
1990 .def = "sequential",
e8b0e958 1991 .category = FIO_OPT_C_IO,
0626037e 1992 .group = FIO_OPT_G_IO_BASIC,
38dad62d
JA
1993 .posval = {
1994 { .ival = "sequential",
1995 .oval = RW_SEQ_SEQ,
1996 .help = "Generate sequential offsets",
1997 },
1998 { .ival = "identical",
1999 .oval = RW_SEQ_IDENT,
2000 .help = "Generate identical offsets",
2001 },
2002 },
2003 },
2004
214e1eca
JA
2005 {
2006 .name = "ioengine",
e8b0e958 2007 .lname = "IO Engine",
214e1eca 2008 .type = FIO_OPT_STR_STORE,
a609f12a 2009 .off1 = offsetof(struct thread_options, ioengine),
214e1eca 2010 .help = "IO engine to use",
58483fa4 2011 .def = FIO_PREFERRED_ENGINE,
e8b0e958 2012 .category = FIO_OPT_C_IO,
0626037e 2013 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
2014 .posval = {
2015 { .ival = "sync",
2016 .help = "Use read/write",
2017 },
a31041ea 2018 { .ival = "psync",
2019 .help = "Use pread/pwrite",
2020 },
1d2af02a 2021 { .ival = "vsync",
03e20d68 2022 .help = "Use readv/writev",
1d2af02a 2023 },
07fc0acd
JA
2024#ifdef CONFIG_PWRITEV
2025 { .ival = "pvsync",
2026 .help = "Use preadv/pwritev",
2027 },
2028#endif
6562685f 2029#ifdef FIO_HAVE_PWRITEV2
2cafffbe
JA
2030 { .ival = "pvsync2",
2031 .help = "Use preadv2/pwritev2",
2032 },
2033#endif
67bf9823 2034#ifdef CONFIG_LIBAIO
214e1eca
JA
2035 { .ival = "libaio",
2036 .help = "Linux native asynchronous IO",
2037 },
2038#endif
bffad86f
JA
2039#ifdef ARCH_HAVE_IOURING
2040 { .ival = "io_uring",
2041 .help = "Fast Linux native aio",
52885fa2
JA
2042 },
2043#endif
67bf9823 2044#ifdef CONFIG_POSIXAIO
214e1eca
JA
2045 { .ival = "posixaio",
2046 .help = "POSIX asynchronous IO",
2047 },
417f0068 2048#endif
997843cb 2049#ifdef CONFIG_SOLARISAIO
417f0068
JA
2050 { .ival = "solarisaio",
2051 .help = "Solaris native asynchronous IO",
2052 },
214e1eca 2053#endif
4700b234 2054#ifdef CONFIG_WINDOWSAIO
03e20d68 2055 { .ival = "windowsaio",
3be80071 2056 .help = "Windows native asynchronous IO"
de890a1e 2057 },
fc5c0345
DG
2058#endif
2059#ifdef CONFIG_RBD
2060 { .ival = "rbd",
2061 .help = "Rados Block Device asynchronous IO"
2062 },
3be80071 2063#endif
214e1eca 2064 { .ival = "mmap",
03e20d68 2065 .help = "Memory mapped IO"
214e1eca 2066 },
67bf9823 2067#ifdef CONFIG_LINUX_SPLICE
214e1eca
JA
2068 { .ival = "splice",
2069 .help = "splice/vmsplice based IO",
2070 },
9cce02e8
JA
2071 { .ival = "netsplice",
2072 .help = "splice/vmsplice to/from the network",
2073 },
214e1eca
JA
2074#endif
2075#ifdef FIO_HAVE_SGIO
2076 { .ival = "sg",
2077 .help = "SCSI generic v3 IO",
2078 },
2079#endif
2080 { .ival = "null",
2081 .help = "Testing engine (no data transfer)",
2082 },
2083 { .ival = "net",
2084 .help = "Network IO",
2085 },
214e1eca 2086 { .ival = "cpuio",
03e20d68 2087 .help = "CPU cycle burner engine",
214e1eca 2088 },
67bf9823 2089#ifdef CONFIG_RDMA
21b8aee8 2090 { .ival = "rdma",
2091 .help = "RDMA IO engine",
2092 },
8200b8c7 2093#endif
e4c4625f
JM
2094#ifdef CONFIG_LIBRPMA_APM
2095 { .ival = "librpma_apm",
2096 .help = "librpma IO engine in APM mode",
2097 },
2098#endif
2099#ifdef CONFIG_LIBRPMA_GPSPM
2100 { .ival = "librpma_gpspm",
2101 .help = "librpma IO engine in GPSPM mode",
2102 },
2103#endif
997843cb 2104#ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT
1ecc95ca
JA
2105 { .ival = "e4defrag",
2106 .help = "ext4 defrag engine",
2107 },
2108#endif
997843cb 2109#ifdef CONFIG_LINUX_FALLOCATE
1ecc95ca
JA
2110 { .ival = "falloc",
2111 .help = "fallocate() file based engine",
2112 },
b8c82a46 2113#endif
a7c386f4 2114#ifdef CONFIG_GFAPI
2115 { .ival = "gfapi",
cc47f094 2116 .help = "Glusterfs libgfapi(sync) based engine"
2117 },
2118 { .ival = "gfapi_async",
2119 .help = "Glusterfs libgfapi(async) based engine"
a7c386f4 2120 },
2121#endif
1b10477b 2122#ifdef CONFIG_LIBHDFS
b74e419e 2123 { .ival = "libhdfs",
1b10477b
MM
2124 .help = "Hadoop Distributed Filesystem (HDFS) engine"
2125 },
5c4ef02e 2126#endif
a40e7a59
GB
2127#ifdef CONFIG_IME
2128 { .ival = "ime_psync",
2129 .help = "DDN's IME synchronous IO engine",
2130 },
2131 { .ival = "ime_psyncv",
2132 .help = "DDN's IME synchronous IO engine using iovecs",
2133 },
2134 { .ival = "ime_aio",
2135 .help = "DDN's IME asynchronous IO engine",
2136 },
2137#endif
104ee4de
DJ
2138#ifdef CONFIG_LINUX_DEVDAX
2139 { .ival = "dev-dax",
2140 .help = "DAX Device based IO engine",
2141 },
1b10477b 2142#endif
edc5fa12
JA
2143 {
2144 .ival = "filecreate",
2145 .help = "File creation engine",
2146 },
214e1eca
JA
2147 { .ival = "external",
2148 .help = "Load external engine (append name)",
6730b40f 2149 .cb = str_ioengine_external_cb,
214e1eca 2150 },
ae0db592
TI
2151#ifdef CONFIG_LIBPMEM
2152 { .ival = "libpmem",
363a5f65 2153 .help = "PMDK libpmem based IO engine",
ae0db592 2154 },
c2f6a13d
LMB
2155#endif
2156#ifdef CONFIG_HTTP
2157 { .ival = "http",
2158 .help = "HTTP (WebDAV/S3) IO engine",
2159 },
ae0db592 2160#endif
d643a1e2
RJ
2161 { .ival = "nbd",
2162 .help = "Network Block Device (NBD) IO engine"
2163 },
c363fdd7
JL
2164#ifdef CONFIG_DFS
2165 { .ival = "dfs",
2166 .help = "DAOS File System (dfs) IO engine",
2167 },
9326926b 2168#endif
98ab1262 2169#ifdef CONFIG_LIBNFS
9326926b
TG
2170 { .ival = "nfs",
2171 .help = "NFS IO engine",
2172 },
a3ff873e
AK
2173#endif
2174#ifdef CONFIG_LIBXNVME
2175 { .ival = "xnvme",
2176 .help = "XNVME IO engine",
2177 },
c363fdd7 2178#endif
214e1eca
JA
2179 },
2180 },
2181 {
2182 .name = "iodepth",
e8b0e958 2183 .lname = "IO Depth",
214e1eca 2184 .type = FIO_OPT_INT,
a609f12a 2185 .off1 = offsetof(struct thread_options, iodepth),
03e20d68 2186 .help = "Number of IO buffers to keep in flight",
757aff4f 2187 .minval = 1,
20eb06bd 2188 .interval = 1,
214e1eca 2189 .def = "1",
e8b0e958 2190 .category = FIO_OPT_C_IO,
0626037e 2191 .group = FIO_OPT_G_IO_BASIC,
214e1eca
JA
2192 },
2193 {
2194 .name = "iodepth_batch",
e8b0e958 2195 .lname = "IO Depth batch",
4950421a 2196 .alias = "iodepth_batch_submit",
214e1eca 2197 .type = FIO_OPT_INT,
a609f12a 2198 .off1 = offsetof(struct thread_options, iodepth_batch),
d65db441 2199 .help = "Number of IO buffers to submit in one go",
afdf9352 2200 .parent = "iodepth",
d71c154c 2201 .hide = 1,
20eb06bd 2202 .interval = 1,
a2e6f8ac 2203 .def = "1",
e8b0e958 2204 .category = FIO_OPT_C_IO,
0626037e 2205 .group = FIO_OPT_G_IO_BASIC,
4950421a
JA
2206 },
2207 {
82407585
RP
2208 .name = "iodepth_batch_complete_min",
2209 .lname = "Min IO depth batch complete",
2210 .alias = "iodepth_batch_complete",
4950421a 2211 .type = FIO_OPT_INT,
a609f12a 2212 .off1 = offsetof(struct thread_options, iodepth_batch_complete_min),
82407585 2213 .help = "Min number of IO buffers to retrieve in one go",
4950421a 2214 .parent = "iodepth",
d71c154c 2215 .hide = 1,
4950421a 2216 .minval = 0,
20eb06bd 2217 .interval = 1,
4950421a 2218 .def = "1",
e8b0e958 2219 .category = FIO_OPT_C_IO,
0626037e 2220 .group = FIO_OPT_G_IO_BASIC,
214e1eca 2221 },
82407585
RP
2222 {
2223 .name = "iodepth_batch_complete_max",
2224 .lname = "Max IO depth batch complete",
2225 .type = FIO_OPT_INT,
a609f12a 2226 .off1 = offsetof(struct thread_options, iodepth_batch_complete_max),
82407585
RP
2227 .help = "Max number of IO buffers to retrieve in one go",
2228 .parent = "iodepth",
2229 .hide = 1,
2230 .minval = 0,
2231 .interval = 1,
2232 .category = FIO_OPT_C_IO,
2233 .group = FIO_OPT_G_IO_BASIC,
2234 },
214e1eca
JA
2235 {
2236 .name = "iodepth_low",
e8b0e958 2237 .lname = "IO Depth batch low",
214e1eca 2238 .type = FIO_OPT_INT,
a609f12a 2239 .off1 = offsetof(struct thread_options, iodepth_low),
214e1eca 2240 .help = "Low water mark for queuing depth",
afdf9352 2241 .parent = "iodepth",
d71c154c 2242 .hide = 1,
20eb06bd 2243 .interval = 1,
e8b0e958 2244 .category = FIO_OPT_C_IO,
0626037e 2245 .group = FIO_OPT_G_IO_BASIC,
214e1eca 2246 },
997b5680
SW
2247 {
2248 .name = "serialize_overlap",
2249 .lname = "Serialize overlap",
2250 .off1 = offsetof(struct thread_options, serialize_overlap),
2251 .type = FIO_OPT_BOOL,
2252 .help = "Wait for in-flight IOs that collide to complete",
2253 .parent = "iodepth",
2254 .def = "0",
2255 .category = FIO_OPT_C_IO,
2256 .group = FIO_OPT_G_IO_BASIC,
2257 },
a9da8ab2
JA
2258 {
2259 .name = "io_submit_mode",
2260 .lname = "IO submit mode",
2261 .type = FIO_OPT_STR,
a609f12a 2262 .off1 = offsetof(struct thread_options, io_submit_mode),
a9da8ab2
JA
2263 .help = "How IO submissions and completions are done",
2264 .def = "inline",
2265 .category = FIO_OPT_C_IO,
2266 .group = FIO_OPT_G_IO_BASIC,
2267 .posval = {
2268 { .ival = "inline",
2269 .oval = IO_MODE_INLINE,
2270 .help = "Submit and complete IO inline",
2271 },
2272 { .ival = "offload",
2273 .oval = IO_MODE_OFFLOAD,
2274 .help = "Offload submit and complete to threads",
2275 },
2276 },
2277 },
214e1eca
JA
2278 {
2279 .name = "size",
e8b0e958 2280 .lname = "Size",
8f39afa7 2281 .type = FIO_OPT_STR_VAL_ZONE,
7bb59102 2282 .cb = str_size_cb,
a609f12a 2283 .off1 = offsetof(struct thread_options, size),
214e1eca 2284 .help = "Total size of device or files",
e8b0e958
JA
2285 .category = FIO_OPT_C_IO,
2286 .group = FIO_OPT_G_INVALID,
214e1eca 2287 },
77731b29 2288 {
a4d3b4db
JA
2289 .name = "io_size",
2290 .alias = "io_limit",
2291 .lname = "IO Size",
8f39afa7 2292 .type = FIO_OPT_STR_VAL_ZONE,
8b38f401 2293 .cb = str_io_size_cb,
5be9bf09 2294 .off1 = offsetof(struct thread_options, io_size),
1684f7fd 2295 .help = "Total size of I/O to be performed",
77731b29
JA
2296 .category = FIO_OPT_C_IO,
2297 .group = FIO_OPT_G_INVALID,
2298 },
aa31f1f1
SL
2299 {
2300 .name = "fill_device",
e8b0e958 2301 .lname = "Fill device",
74586c1e 2302 .alias = "fill_fs",
aa31f1f1 2303 .type = FIO_OPT_BOOL,
a609f12a 2304 .off1 = offsetof(struct thread_options, fill_device),
aa31f1f1
SL
2305 .help = "Write until an ENOSPC error occurs",
2306 .def = "0",
e8b0e958
JA
2307 .category = FIO_OPT_C_FILE,
2308 .group = FIO_OPT_G_INVALID,
aa31f1f1 2309 },
214e1eca
JA
2310 {
2311 .name = "filesize",
e8b0e958 2312 .lname = "File size",
214e1eca 2313 .type = FIO_OPT_STR_VAL,
a609f12a
JA
2314 .off1 = offsetof(struct thread_options, file_size_low),
2315 .off2 = offsetof(struct thread_options, file_size_high),
c3edbdba 2316 .minval = 1,
214e1eca 2317 .help = "Size of individual files",
20eb06bd 2318 .interval = 1024 * 1024,
e8b0e958
JA
2319 .category = FIO_OPT_C_FILE,
2320 .group = FIO_OPT_G_INVALID,
214e1eca 2321 },
bedc9dc2
JA
2322 {
2323 .name = "file_append",
2324 .lname = "File append",
2325 .type = FIO_OPT_BOOL,
a609f12a 2326 .off1 = offsetof(struct thread_options, file_append),
bedc9dc2
JA
2327 .help = "IO will start at the end of the file(s)",
2328 .def = "0",
2329 .category = FIO_OPT_C_FILE,
2330 .group = FIO_OPT_G_INVALID,
2331 },
67a1000f
JA
2332 {
2333 .name = "offset",
e8b0e958 2334 .lname = "IO offset",
67a1000f 2335 .alias = "fileoffset",
8f39afa7 2336 .type = FIO_OPT_STR_VAL_ZONE,
89978a6b 2337 .cb = str_offset_cb,
a609f12a 2338 .off1 = offsetof(struct thread_options, start_offset),
67a1000f
JA
2339 .help = "Start IO from this offset",
2340 .def = "0",
e8b0e958
JA
2341 .category = FIO_OPT_C_IO,
2342 .group = FIO_OPT_G_INVALID,
67a1000f 2343 },
83c8b093
JF
2344 {
2345 .name = "offset_align",
2346 .lname = "IO offset alignment",
2347 .type = FIO_OPT_INT,
2348 .off1 = offsetof(struct thread_options, start_offset_align),
2349 .help = "Start IO from this offset alignment",
2350 .def = "0",
2351 .interval = 512,
2352 .category = FIO_OPT_C_IO,
2353 .group = FIO_OPT_G_INVALID,
2354 },
2d7cd868
JA
2355 {
2356 .name = "offset_increment",
e8b0e958 2357 .lname = "IO offset increment",
8f39afa7 2358 .type = FIO_OPT_STR_VAL_ZONE,
0b288ba1 2359 .cb = str_offset_increment_cb,
a609f12a 2360 .off1 = offsetof(struct thread_options, offset_increment),
2d7cd868
JA
2361 .help = "What is the increment from one offset to the next",
2362 .parent = "offset",
d71c154c 2363 .hide = 1,
2d7cd868 2364 .def = "0",
e8b0e958
JA
2365 .category = FIO_OPT_C_IO,
2366 .group = FIO_OPT_G_INVALID,
2d7cd868 2367 },
ddf24e42
JA
2368 {
2369 .name = "number_ios",
2370 .lname = "Number of IOs to perform",
2371 .type = FIO_OPT_STR_VAL,
a609f12a 2372 .off1 = offsetof(struct thread_options, number_ios),
be3fec7d 2373 .help = "Force job completion after this number of IOs",
ddf24e42
JA
2374 .def = "0",
2375 .category = FIO_OPT_C_IO,
2376 .group = FIO_OPT_G_INVALID,
2377 },
214e1eca
JA
2378 {
2379 .name = "bs",
e8b0e958 2380 .lname = "Block size",
d3aad8f2 2381 .alias = "blocksize",
5fff9543 2382 .type = FIO_OPT_ULL,
a609f12a
JA
2383 .off1 = offsetof(struct thread_options, bs[DDIR_READ]),
2384 .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]),
2385 .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]),
c3edbdba 2386 .minval = 1,
214e1eca 2387 .help = "Block size unit",
2b9136a3 2388 .def = "4096",
67a1000f 2389 .parent = "rw",
d71c154c 2390 .hide = 1,
20eb06bd 2391 .interval = 512,
e8b0e958
JA
2392 .category = FIO_OPT_C_IO,
2393 .group = FIO_OPT_G_INVALID,
214e1eca 2394 },
2b7a01d0
JA
2395 {
2396 .name = "ba",
e8b0e958 2397 .lname = "Block size align",
2b7a01d0 2398 .alias = "blockalign",
5fff9543 2399 .type = FIO_OPT_ULL,
a609f12a
JA
2400 .off1 = offsetof(struct thread_options, ba[DDIR_READ]),
2401 .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]),
2402 .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]),
2b7a01d0
JA
2403 .minval = 1,
2404 .help = "IO block offset alignment",
2405 .parent = "rw",
d71c154c 2406 .hide = 1,
20eb06bd 2407 .interval = 512,
e8b0e958
JA
2408 .category = FIO_OPT_C_IO,
2409 .group = FIO_OPT_G_INVALID,
2b7a01d0 2410 },
214e1eca
JA
2411 {
2412 .name = "bsrange",
e8b0e958 2413 .lname = "Block size range",
d3aad8f2 2414 .alias = "blocksize_range",
214e1eca 2415 .type = FIO_OPT_RANGE,
a609f12a
JA
2416 .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]),
2417 .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]),
2418 .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]),
2419 .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]),
2420 .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]),
2421 .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]),
c3edbdba 2422 .minval = 1,
214e1eca 2423 .help = "Set block size range (in more detail than bs)",
67a1000f 2424 .parent = "rw",
d71c154c 2425 .hide = 1,
20eb06bd 2426 .interval = 4096,
e8b0e958
JA
2427 .category = FIO_OPT_C_IO,
2428 .group = FIO_OPT_G_INVALID,
214e1eca 2429 },
564ca972
JA
2430 {
2431 .name = "bssplit",
e8b0e958 2432 .lname = "Block size split",
5fff9543 2433 .type = FIO_OPT_STR_ULL,
564ca972 2434 .cb = str_bssplit_cb,
a609f12a 2435 .off1 = offsetof(struct thread_options, bssplit),
564ca972
JA
2436 .help = "Set a specific mix of block sizes",
2437 .parent = "rw",
d71c154c 2438 .hide = 1,
e8b0e958
JA
2439 .category = FIO_OPT_C_IO,
2440 .group = FIO_OPT_G_INVALID,
564ca972 2441 },
214e1eca
JA
2442 {
2443 .name = "bs_unaligned",
e8b0e958 2444 .lname = "Block size unaligned",
d3aad8f2 2445 .alias = "blocksize_unaligned",
214e1eca 2446 .type = FIO_OPT_STR_SET,
a609f12a 2447 .off1 = offsetof(struct thread_options, bs_unaligned),
214e1eca 2448 .help = "Don't sector align IO buffer sizes",
67a1000f 2449 .parent = "rw",
d71c154c 2450 .hide = 1,
e8b0e958
JA
2451 .category = FIO_OPT_C_IO,
2452 .group = FIO_OPT_G_INVALID,
214e1eca 2453 },
6aca9b3d
JA
2454 {
2455 .name = "bs_is_seq_rand",
2456 .lname = "Block size division is seq/random (not read/write)",
2457 .type = FIO_OPT_BOOL,
a609f12a 2458 .off1 = offsetof(struct thread_options, bs_is_seq_rand),
86d59660 2459 .help = "Consider any blocksize setting to be sequential,random",
6aca9b3d
JA
2460 .def = "0",
2461 .parent = "blocksize",
2462 .category = FIO_OPT_C_IO,
2463 .group = FIO_OPT_G_INVALID,
2464 },
214e1eca
JA
2465 {
2466 .name = "randrepeat",
e8b0e958 2467 .lname = "Random repeatable",
214e1eca 2468 .type = FIO_OPT_BOOL,
a609f12a 2469 .off1 = offsetof(struct thread_options, rand_repeatable),
214e1eca
JA
2470 .help = "Use repeatable random IO pattern",
2471 .def = "1",
67a1000f 2472 .parent = "rw",
d71c154c 2473 .hide = 1,
e8b0e958 2474 .category = FIO_OPT_C_IO,
3ceb458f 2475 .group = FIO_OPT_G_RANDOM,
214e1eca 2476 },
04778baf
JA
2477 {
2478 .name = "randseed",
2479 .lname = "The random generator seed",
363cffa7 2480 .type = FIO_OPT_STR_VAL,
a609f12a 2481 .off1 = offsetof(struct thread_options, rand_seed),
04778baf 2482 .help = "Set the random generator seed value",
40fe5e7b 2483 .def = "0x89",
04778baf
JA
2484 .parent = "rw",
2485 .category = FIO_OPT_C_IO,
2486 .group = FIO_OPT_G_RANDOM,
2487 },
214e1eca
JA
2488 {
2489 .name = "norandommap",
e8b0e958 2490 .lname = "No randommap",
214e1eca 2491 .type = FIO_OPT_STR_SET,
a609f12a 2492 .off1 = offsetof(struct thread_options, norandommap),
214e1eca 2493 .help = "Accept potential duplicate random blocks",
67a1000f 2494 .parent = "rw",
d71c154c 2495 .hide = 1,
b2452a43 2496 .hide_on_set = 1,
e8b0e958 2497 .category = FIO_OPT_C_IO,
3ceb458f 2498 .group = FIO_OPT_G_RANDOM,
214e1eca 2499 },
2b386d25
JA
2500 {
2501 .name = "softrandommap",
e8b0e958 2502 .lname = "Soft randommap",
2b386d25 2503 .type = FIO_OPT_BOOL,
a609f12a 2504 .off1 = offsetof(struct thread_options, softrandommap),
f66ab3c8 2505 .help = "Set norandommap if randommap allocation fails",
2b386d25 2506 .parent = "norandommap",
d71c154c 2507 .hide = 1,
2b386d25 2508 .def = "0",
e8b0e958 2509 .category = FIO_OPT_C_IO,
3ceb458f 2510 .group = FIO_OPT_G_RANDOM,
2b386d25 2511 },
8055e41d
JA
2512 {
2513 .name = "random_generator",
cce2fdfe 2514 .lname = "Random Generator",
8055e41d 2515 .type = FIO_OPT_STR,
a609f12a 2516 .off1 = offsetof(struct thread_options, random_generator),
8055e41d
JA
2517 .help = "Type of random number generator to use",
2518 .def = "tausworthe",
2519 .posval = {
2520 { .ival = "tausworthe",
2521 .oval = FIO_RAND_GEN_TAUSWORTHE,
2522 .help = "Strong Tausworthe generator",
2523 },
2524 { .ival = "lfsr",
2525 .oval = FIO_RAND_GEN_LFSR,
2526 .help = "Variable length LFSR",
2527 },
c3546b53
JA
2528 {
2529 .ival = "tausworthe64",
2530 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2531 .help = "64-bit Tausworthe variant",
2532 },
8055e41d 2533 },
48107598
JA
2534 .category = FIO_OPT_C_IO,
2535 .group = FIO_OPT_G_RANDOM,
8055e41d 2536 },
e25839d4
JA
2537 {
2538 .name = "random_distribution",
cce2fdfe 2539 .lname = "Random Distribution",
e25839d4 2540 .type = FIO_OPT_STR,
a609f12a 2541 .off1 = offsetof(struct thread_options, random_distribution),
e25839d4
JA
2542 .cb = str_random_distribution_cb,
2543 .help = "Random offset distribution generator",
2544 .def = "random",
2545 .posval = {
2546 { .ival = "random",
2547 .oval = FIO_RAND_DIST_RANDOM,
2548 .help = "Completely random",
2549 },
2550 { .ival = "zipf",
2551 .oval = FIO_RAND_DIST_ZIPF,
2552 .help = "Zipf distribution",
2553 },
925fee33
JA
2554 { .ival = "pareto",
2555 .oval = FIO_RAND_DIST_PARETO,
2556 .help = "Pareto distribution",
2557 },
56d9fa4b
JA
2558 { .ival = "normal",
2559 .oval = FIO_RAND_DIST_GAUSS,
ba2b3b07 2560 .help = "Normal (Gaussian) distribution",
56d9fa4b 2561 },
e0a04ac1
JA
2562 { .ival = "zoned",
2563 .oval = FIO_RAND_DIST_ZONED,
2564 .help = "Zoned random distribution",
2565 },
59466396
JA
2566 { .ival = "zoned_abs",
2567 .oval = FIO_RAND_DIST_ZONED_ABS,
2568 .help = "Zoned absolute random distribution",
2569 },
e25839d4 2570 },
48107598
JA
2571 .category = FIO_OPT_C_IO,
2572 .group = FIO_OPT_G_RANDOM,
e25839d4 2573 },
211c9b89
JA
2574 {
2575 .name = "percentage_random",
2576 .lname = "Percentage Random",
2577 .type = FIO_OPT_INT,
a609f12a
JA
2578 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2579 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2580 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
211c9b89
JA
2581 .maxval = 100,
2582 .help = "Percentage of seq/random mix that should be random",
d9472271 2583 .def = "100,100,100",
211c9b89
JA
2584 .interval = 5,
2585 .inverse = "percentage_sequential",
2586 .category = FIO_OPT_C_IO,
2587 .group = FIO_OPT_G_RANDOM,
2588 },
2589 {
2590 .name = "percentage_sequential",
2591 .lname = "Percentage Sequential",
d9472271 2592 .type = FIO_OPT_DEPRECATED,
211c9b89
JA
2593 .category = FIO_OPT_C_IO,
2594 .group = FIO_OPT_G_RANDOM,
2595 },
56e2a5fc
CE
2596 {
2597 .name = "allrandrepeat",
cce2fdfe 2598 .lname = "All Random Repeat",
56e2a5fc 2599 .type = FIO_OPT_BOOL,
a609f12a 2600 .off1 = offsetof(struct thread_options, allrand_repeatable),
56e2a5fc
CE
2601 .help = "Use repeatable random numbers for everything",
2602 .def = "0",
a869d9c6
JA
2603 .category = FIO_OPT_C_IO,
2604 .group = FIO_OPT_G_RANDOM,
56e2a5fc 2605 },
214e1eca
JA
2606 {
2607 .name = "nrfiles",
e8b0e958 2608 .lname = "Number of files",
d7c8be03 2609 .alias = "nr_files",
214e1eca 2610 .type = FIO_OPT_INT,
a609f12a 2611 .off1 = offsetof(struct thread_options, nr_files),
214e1eca
JA
2612 .help = "Split job workload between this number of files",
2613 .def = "1",
20eb06bd 2614 .interval = 1,
e8b0e958
JA
2615 .category = FIO_OPT_C_FILE,
2616 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2617 },
2618 {
2619 .name = "openfiles",
e8b0e958 2620 .lname = "Number of open files",
214e1eca 2621 .type = FIO_OPT_INT,
a609f12a 2622 .off1 = offsetof(struct thread_options, open_files),
214e1eca 2623 .help = "Number of files to keep open at the same time",
e8b0e958
JA
2624 .category = FIO_OPT_C_FILE,
2625 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2626 },
2627 {
2628 .name = "file_service_type",
e8b0e958 2629 .lname = "File service type",
214e1eca
JA
2630 .type = FIO_OPT_STR,
2631 .cb = str_fst_cb,
a609f12a 2632 .off1 = offsetof(struct thread_options, file_service_type),
214e1eca
JA
2633 .help = "How to select which file to service next",
2634 .def = "roundrobin",
e8b0e958
JA
2635 .category = FIO_OPT_C_FILE,
2636 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2637 .posval = {
2638 { .ival = "random",
2639 .oval = FIO_FSERVICE_RANDOM,
8c07860d
JA
2640 .help = "Choose a file at random (uniform)",
2641 },
2642 { .ival = "zipf",
2643 .oval = FIO_FSERVICE_ZIPF,
2644 .help = "Zipf randomized",
2645 },
2646 { .ival = "pareto",
2647 .oval = FIO_FSERVICE_PARETO,
2648 .help = "Pareto randomized",
2649 },
dd3503d3
SW
2650 { .ival = "normal",
2651 .oval = FIO_FSERVICE_GAUSS,
2652 .help = "Normal (Gaussian) randomized",
2653 },
8c07860d
JA
2654 { .ival = "gauss",
2655 .oval = FIO_FSERVICE_GAUSS,
dd3503d3 2656 .help = "Alias for normal",
214e1eca
JA
2657 },
2658 { .ival = "roundrobin",
2659 .oval = FIO_FSERVICE_RR,
2660 .help = "Round robin select files",
2661 },
a086c257
JA
2662 { .ival = "sequential",
2663 .oval = FIO_FSERVICE_SEQ,
2664 .help = "Finish one file before moving to the next",
2665 },
214e1eca 2666 },
67a1000f 2667 .parent = "nrfiles",
d71c154c 2668 .hide = 1,
67a1000f 2669 },
7bc8c2cf
JA
2670 {
2671 .name = "fallocate",
e8b0e958 2672 .lname = "Fallocate",
a596f047 2673 .type = FIO_OPT_STR,
a609f12a 2674 .off1 = offsetof(struct thread_options, fallocate_mode),
a596f047 2675 .help = "Whether pre-allocation is performed when laying out files",
38ca5f03 2676#ifdef FIO_HAVE_DEFAULT_FALLOCATE
2c3e17be 2677 .def = "native",
38ca5f03
TV
2678#else
2679 .def = "none",
2680#endif
e8b0e958
JA
2681 .category = FIO_OPT_C_FILE,
2682 .group = FIO_OPT_G_INVALID,
a596f047
EG
2683 .posval = {
2684 { .ival = "none",
2685 .oval = FIO_FALLOCATE_NONE,
2686 .help = "Do not pre-allocate space",
2687 },
2c3e17be
SW
2688 { .ival = "native",
2689 .oval = FIO_FALLOCATE_NATIVE,
2690 .help = "Use native pre-allocation if possible",
2691 },
2692#ifdef CONFIG_POSIX_FALLOCATE
a596f047
EG
2693 { .ival = "posix",
2694 .oval = FIO_FALLOCATE_POSIX,
2695 .help = "Use posix_fallocate()",
2696 },
2c3e17be 2697#endif
97ac992c 2698#ifdef CONFIG_LINUX_FALLOCATE
a596f047
EG
2699 { .ival = "keep",
2700 .oval = FIO_FALLOCATE_KEEP_SIZE,
2701 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2702 },
7bc8c2cf 2703#endif
38ca5f03
TV
2704 { .ival = "truncate",
2705 .oval = FIO_FALLOCATE_TRUNCATE,
2706 .help = "Truncate file to final size instead of allocating"
2707 },
a596f047
EG
2708 /* Compatibility with former boolean values */
2709 { .ival = "0",
2710 .oval = FIO_FALLOCATE_NONE,
2711 .help = "Alias for 'none'",
2712 },
2c3e17be 2713#ifdef CONFIG_POSIX_FALLOCATE
a596f047
EG
2714 { .ival = "1",
2715 .oval = FIO_FALLOCATE_POSIX,
2716 .help = "Alias for 'posix'",
2717 },
2c3e17be 2718#endif
a596f047
EG
2719 },
2720 },
67a1000f
JA
2721 {
2722 .name = "fadvise_hint",
e8b0e958 2723 .lname = "Fadvise hint",
ecb2083d 2724 .type = FIO_OPT_STR,
a609f12a 2725 .off1 = offsetof(struct thread_options, fadvise_hint),
ecb2083d
JA
2726 .posval = {
2727 { .ival = "0",
2728 .oval = F_ADV_NONE,
c712c97a 2729 .help = "Don't issue fadvise/madvise",
ecb2083d
JA
2730 },
2731 { .ival = "1",
2732 .oval = F_ADV_TYPE,
2733 .help = "Advise using fio IO pattern",
2734 },
2735 { .ival = "random",
2736 .oval = F_ADV_RANDOM,
2737 .help = "Advise using FADV_RANDOM",
2738 },
2739 { .ival = "sequential",
2740 .oval = F_ADV_SEQUENTIAL,
2741 .help = "Advise using FADV_SEQUENTIAL",
2742 },
2743 },
67a1000f
JA
2744 .help = "Use fadvise() to advise the kernel on IO pattern",
2745 .def = "1",
e8b0e958
JA
2746 .category = FIO_OPT_C_FILE,
2747 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2748 },
2749 {
2750 .name = "fsync",
e8b0e958 2751 .lname = "Fsync",
214e1eca 2752 .type = FIO_OPT_INT,
a609f12a 2753 .off1 = offsetof(struct thread_options, fsync_blocks),
214e1eca
JA
2754 .help = "Issue fsync for writes every given number of blocks",
2755 .def = "0",
20eb06bd 2756 .interval = 1,
e8b0e958
JA
2757 .category = FIO_OPT_C_FILE,
2758 .group = FIO_OPT_G_INVALID,
214e1eca 2759 },
5f9099ea
JA
2760 {
2761 .name = "fdatasync",
e8b0e958 2762 .lname = "Fdatasync",
5f9099ea 2763 .type = FIO_OPT_INT,
a609f12a 2764 .off1 = offsetof(struct thread_options, fdatasync_blocks),
5f9099ea
JA
2765 .help = "Issue fdatasync for writes every given number of blocks",
2766 .def = "0",
20eb06bd 2767 .interval = 1,
e8b0e958
JA
2768 .category = FIO_OPT_C_FILE,
2769 .group = FIO_OPT_G_INVALID,
5f9099ea 2770 },
1ef2b6be
JA
2771 {
2772 .name = "write_barrier",
e8b0e958 2773 .lname = "Write barrier",
1ef2b6be 2774 .type = FIO_OPT_INT,
a609f12a 2775 .off1 = offsetof(struct thread_options, barrier_blocks),
1ef2b6be
JA
2776 .help = "Make every Nth write a barrier write",
2777 .def = "0",
20eb06bd 2778 .interval = 1,
e8b0e958
JA
2779 .category = FIO_OPT_C_IO,
2780 .group = FIO_OPT_G_INVALID,
1ef2b6be 2781 },
67bf9823 2782#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
2783 {
2784 .name = "sync_file_range",
e8b0e958 2785 .lname = "Sync file range",
44f29692
JA
2786 .posval = {
2787 { .ival = "wait_before",
2788 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2789 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
ebadc0ce 2790 .orval = 1,
44f29692
JA
2791 },
2792 { .ival = "write",
2793 .oval = SYNC_FILE_RANGE_WRITE,
2794 .help = "SYNC_FILE_RANGE_WRITE",
ebadc0ce 2795 .orval = 1,
44f29692
JA
2796 },
2797 {
2798 .ival = "wait_after",
2799 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2800 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
ebadc0ce 2801 .orval = 1,
44f29692
JA
2802 },
2803 },
3843deb3 2804 .type = FIO_OPT_STR_MULTI,
44f29692 2805 .cb = str_sfr_cb,
a609f12a 2806 .off1 = offsetof(struct thread_options, sync_file_range),
44f29692 2807 .help = "Use sync_file_range()",
e8b0e958
JA
2808 .category = FIO_OPT_C_FILE,
2809 .group = FIO_OPT_G_INVALID,
44f29692 2810 },
a275c37a 2811#else
54d0a315 2812 {
a275c37a
JA
2813 .name = "sync_file_range",
2814 .lname = "Sync file range",
2815 .type = FIO_OPT_UNSUPPORTED,
2816 .help = "Your platform does not support sync_file_range",
2817 },
44f29692 2818#endif
214e1eca
JA
2819 {
2820 .name = "direct",
e8b0e958 2821 .lname = "Direct I/O",
214e1eca 2822 .type = FIO_OPT_BOOL,
a609f12a 2823 .off1 = offsetof(struct thread_options, odirect),
214e1eca
JA
2824 .help = "Use O_DIRECT IO (negates buffered)",
2825 .def = "0",
a01a1bc5 2826 .inverse = "buffered",
e8b0e958 2827 .category = FIO_OPT_C_IO,
3ceb458f 2828 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2829 },
d01612f3
CM
2830 {
2831 .name = "atomic",
2832 .lname = "Atomic I/O",
2833 .type = FIO_OPT_BOOL,
a609f12a 2834 .off1 = offsetof(struct thread_options, oatomic),
d01612f3
CM
2835 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2836 .def = "0",
2837 .category = FIO_OPT_C_IO,
2838 .group = FIO_OPT_G_IO_TYPE,
2839 },
214e1eca
JA
2840 {
2841 .name = "buffered",
e8b0e958 2842 .lname = "Buffered I/O",
214e1eca 2843 .type = FIO_OPT_BOOL,
a609f12a 2844 .off1 = offsetof(struct thread_options, odirect),
214e1eca
JA
2845 .neg = 1,
2846 .help = "Use buffered IO (negates direct)",
2847 .def = "1",
a01a1bc5 2848 .inverse = "direct",
e8b0e958 2849 .category = FIO_OPT_C_IO,
3ceb458f 2850 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2851 },
2852 {
2853 .name = "overwrite",
e8b0e958 2854 .lname = "Overwrite",
214e1eca 2855 .type = FIO_OPT_BOOL,
a609f12a 2856 .off1 = offsetof(struct thread_options, overwrite),
214e1eca
JA
2857 .help = "When writing, set whether to overwrite current data",
2858 .def = "0",
e8b0e958
JA
2859 .category = FIO_OPT_C_FILE,
2860 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2861 },
2862 {
2863 .name = "loops",
e8b0e958 2864 .lname = "Loops",
214e1eca 2865 .type = FIO_OPT_INT,
a609f12a 2866 .off1 = offsetof(struct thread_options, loops),
214e1eca
JA
2867 .help = "Number of times to run the job",
2868 .def = "1",
20eb06bd 2869 .interval = 1,
e8b0e958 2870 .category = FIO_OPT_C_GENERAL,
a1f6afec 2871 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2872 },
2873 {
2874 .name = "numjobs",
e8b0e958 2875 .lname = "Number of jobs",
214e1eca 2876 .type = FIO_OPT_INT,
a609f12a 2877 .off1 = offsetof(struct thread_options, numjobs),
214e1eca
JA
2878 .help = "Duplicate this job this many times",
2879 .def = "1",
20eb06bd 2880 .interval = 1,
e8b0e958 2881 .category = FIO_OPT_C_GENERAL,
a1f6afec 2882 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2883 },
2884 {
2885 .name = "startdelay",
e8b0e958 2886 .lname = "Start delay",
a5737c93 2887 .type = FIO_OPT_STR_VAL_TIME,
a609f12a
JA
2888 .off1 = offsetof(struct thread_options, start_delay),
2889 .off2 = offsetof(struct thread_options, start_delay_high),
214e1eca
JA
2890 .help = "Only start job when this period has passed",
2891 .def = "0",
0de5b26f 2892 .is_seconds = 1,
88038bc7 2893 .is_time = 1,
e8b0e958 2894 .category = FIO_OPT_C_GENERAL,
a1f6afec 2895 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2896 },
2897 {
2898 .name = "runtime",
e8b0e958 2899 .lname = "Runtime",
214e1eca
JA
2900 .alias = "timeout",
2901 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 2902 .off1 = offsetof(struct thread_options, timeout),
214e1eca
JA
2903 .help = "Stop workload when this amount of time has passed",
2904 .def = "0",
0de5b26f 2905 .is_seconds = 1,
88038bc7 2906 .is_time = 1,
e8b0e958 2907 .category = FIO_OPT_C_GENERAL,
a1f6afec 2908 .group = FIO_OPT_G_RUNTIME,
214e1eca 2909 },
cf4464ca
JA
2910 {
2911 .name = "time_based",
e8b0e958 2912 .lname = "Time based",
cf4464ca 2913 .type = FIO_OPT_STR_SET,
a609f12a 2914 .off1 = offsetof(struct thread_options, time_based),
cf4464ca 2915 .help = "Keep running until runtime/timeout is met",
e8b0e958 2916 .category = FIO_OPT_C_GENERAL,
a1f6afec 2917 .group = FIO_OPT_G_RUNTIME,
cf4464ca 2918 },
62167762
JC
2919 {
2920 .name = "verify_only",
2921 .lname = "Verify only",
2922 .type = FIO_OPT_STR_SET,
a609f12a 2923 .off1 = offsetof(struct thread_options, verify_only),
62167762
JC
2924 .help = "Verifies previously written data is still valid",
2925 .category = FIO_OPT_C_GENERAL,
2926 .group = FIO_OPT_G_RUNTIME,
2927 },
721938ae
JA
2928 {
2929 .name = "ramp_time",
e8b0e958 2930 .lname = "Ramp time",
721938ae 2931 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 2932 .off1 = offsetof(struct thread_options, ramp_time),
721938ae 2933 .help = "Ramp up time before measuring performance",
0de5b26f 2934 .is_seconds = 1,
88038bc7 2935 .is_time = 1,
e8b0e958 2936 .category = FIO_OPT_C_GENERAL,
a1f6afec 2937 .group = FIO_OPT_G_RUNTIME,
721938ae 2938 },
c223da83
JA
2939 {
2940 .name = "clocksource",
e8b0e958 2941 .lname = "Clock source",
c223da83
JA
2942 .type = FIO_OPT_STR,
2943 .cb = fio_clock_source_cb,
a609f12a 2944 .off1 = offsetof(struct thread_options, clocksource),
c223da83 2945 .help = "What type of timing source to use",
e8b0e958 2946 .category = FIO_OPT_C_GENERAL,
10860056 2947 .group = FIO_OPT_G_CLOCK,
c223da83 2948 .posval = {
67bf9823 2949#ifdef CONFIG_GETTIMEOFDAY
c223da83
JA
2950 { .ival = "gettimeofday",
2951 .oval = CS_GTOD,
2952 .help = "Use gettimeofday(2) for timing",
2953 },
67bf9823
JA
2954#endif
2955#ifdef CONFIG_CLOCK_GETTIME
c223da83
JA
2956 { .ival = "clock_gettime",
2957 .oval = CS_CGETTIME,
2958 .help = "Use clock_gettime(2) for timing",
2959 },
67bf9823 2960#endif
c223da83
JA
2961#ifdef ARCH_HAVE_CPU_CLOCK
2962 { .ival = "cpu",
2963 .oval = CS_CPUCLOCK,
2964 .help = "Use CPU private clock",
2965 },
2966#endif
2967 },
2968 },
214e1eca
JA
2969 {
2970 .name = "mem",
d3aad8f2 2971 .alias = "iomem",
e8b0e958 2972 .lname = "I/O Memory",
214e1eca
JA
2973 .type = FIO_OPT_STR,
2974 .cb = str_mem_cb,
a609f12a 2975 .off1 = offsetof(struct thread_options, mem_type),
214e1eca
JA
2976 .help = "Backing type for IO buffers",
2977 .def = "malloc",
e8b0e958
JA
2978 .category = FIO_OPT_C_IO,
2979 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2980 .posval = {
2981 { .ival = "malloc",
2982 .oval = MEM_MALLOC,
2983 .help = "Use malloc(3) for IO buffers",
2984 },
c8931876 2985#ifndef CONFIG_NO_SHM
37c8cdfe
JA
2986 { .ival = "shm",
2987 .oval = MEM_SHM,
2988 .help = "Use shared memory segments for IO buffers",
2989 },
214e1eca
JA
2990#ifdef FIO_HAVE_HUGETLB
2991 { .ival = "shmhuge",
2992 .oval = MEM_SHMHUGE,
2993 .help = "Like shm, but use huge pages",
2994 },
c8931876 2995#endif
b370e46a 2996#endif
37c8cdfe
JA
2997 { .ival = "mmap",
2998 .oval = MEM_MMAP,
2999 .help = "Use mmap(2) (file or anon) for IO buffers",
3000 },
217b0f1d
LG
3001 { .ival = "mmapshared",
3002 .oval = MEM_MMAPSHARED,
3003 .help = "Like mmap, but use the shared flag",
3004 },
214e1eca
JA
3005#ifdef FIO_HAVE_HUGETLB
3006 { .ival = "mmaphuge",
3007 .oval = MEM_MMAPHUGE,
3008 .help = "Like mmap, but use huge pages",
3009 },
03553853
YR
3010#endif
3011#ifdef CONFIG_CUDA
3012 { .ival = "cudamalloc",
3013 .oval = MEM_CUDA_MALLOC,
3014 .help = "Allocate GPU device memory for GPUDirect RDMA",
3015 },
214e1eca
JA
3016#endif
3017 },
3018 },
d529ee19
JA
3019 {
3020 .name = "iomem_align",
3021 .alias = "mem_align",
e8b0e958 3022 .lname = "I/O memory alignment",
d529ee19 3023 .type = FIO_OPT_INT,
a609f12a 3024 .off1 = offsetof(struct thread_options, mem_align),
d529ee19
JA
3025 .minval = 0,
3026 .help = "IO memory buffer offset alignment",
3027 .def = "0",
3028 .parent = "iomem",
d71c154c 3029 .hide = 1,
e8b0e958
JA
3030 .category = FIO_OPT_C_IO,
3031 .group = FIO_OPT_G_INVALID,
d529ee19 3032 },
214e1eca
JA
3033 {
3034 .name = "verify",
e8b0e958 3035 .lname = "Verify",
214e1eca 3036 .type = FIO_OPT_STR,
a609f12a 3037 .off1 = offsetof(struct thread_options, verify),
214e1eca
JA
3038 .help = "Verify data written",
3039 .def = "0",
e8b0e958 3040 .category = FIO_OPT_C_IO,
3ceb458f 3041 .group = FIO_OPT_G_VERIFY,
214e1eca
JA
3042 .posval = {
3043 { .ival = "0",
3044 .oval = VERIFY_NONE,
3045 .help = "Don't do IO verification",
3046 },
fcca4b58
JA
3047 { .ival = "md5",
3048 .oval = VERIFY_MD5,
3049 .help = "Use md5 checksums for verification",
3050 },
d77a7af3
JA
3051 { .ival = "crc64",
3052 .oval = VERIFY_CRC64,
3053 .help = "Use crc64 checksums for verification",
3054 },
214e1eca
JA
3055 { .ival = "crc32",
3056 .oval = VERIFY_CRC32,
3057 .help = "Use crc32 checksums for verification",
3058 },
af497e6a 3059 { .ival = "crc32c-intel",
e3aaafc4
JA
3060 .oval = VERIFY_CRC32C,
3061 .help = "Use crc32c checksums for verification (hw assisted, if available)",
af497e6a 3062 },
bac39e0e
JA
3063 { .ival = "crc32c",
3064 .oval = VERIFY_CRC32C,
e3aaafc4 3065 .help = "Use crc32c checksums for verification (hw assisted, if available)",
bac39e0e 3066 },
969f7ed3
JA
3067 { .ival = "crc16",
3068 .oval = VERIFY_CRC16,
3069 .help = "Use crc16 checksums for verification",
3070 },
1e154bdb
JA
3071 { .ival = "crc7",
3072 .oval = VERIFY_CRC7,
3073 .help = "Use crc7 checksums for verification",
3074 },
7c353ceb
JA
3075 { .ival = "sha1",
3076 .oval = VERIFY_SHA1,
3077 .help = "Use sha1 checksums for verification",
3078 },
cd14cc10
JA
3079 { .ival = "sha256",
3080 .oval = VERIFY_SHA256,
3081 .help = "Use sha256 checksums for verification",
3082 },
3083 { .ival = "sha512",
3084 .oval = VERIFY_SHA512,
3085 .help = "Use sha512 checksums for verification",
ae3a5acc
JA
3086 },
3087 { .ival = "sha3-224",
3088 .oval = VERIFY_SHA3_224,
3089 .help = "Use sha3-224 checksums for verification",
3090 },
3091 { .ival = "sha3-256",
3092 .oval = VERIFY_SHA3_256,
3093 .help = "Use sha3-256 checksums for verification",
3094 },
3095 { .ival = "sha3-384",
3096 .oval = VERIFY_SHA3_384,
3097 .help = "Use sha3-384 checksums for verification",
3098 },
3099 { .ival = "sha3-512",
3100 .oval = VERIFY_SHA3_512,
3101 .help = "Use sha3-512 checksums for verification",
cd14cc10 3102 },
844ea602
JA
3103 { .ival = "xxhash",
3104 .oval = VERIFY_XXHASH,
3105 .help = "Use xxhash checksums for verification",
3106 },
b638d82f
RP
3107 /* Meta information was included into verify_header,
3108 * 'meta' verification is implied by default. */
7437ee87 3109 { .ival = "meta",
b638d82f
RP
3110 .oval = VERIFY_HDR_ONLY,
3111 .help = "Use io information for verification. "
3112 "Now is implied by default, thus option is obsolete, "
3113 "don't use it",
7437ee87 3114 },
59245381
JA
3115 { .ival = "pattern",
3116 .oval = VERIFY_PATTERN_NO_HDR,
3117 .help = "Verify strict pattern",
3118 },
36690c9b
JA
3119 {
3120 .ival = "null",
3121 .oval = VERIFY_NULL,
3122 .help = "Pretend to verify",
3123 },
214e1eca
JA
3124 },
3125 },
005c565a
JA
3126 {
3127 .name = "do_verify",
e8b0e958 3128 .lname = "Perform verify step",
68e1f29a 3129 .type = FIO_OPT_BOOL,
a609f12a 3130 .off1 = offsetof(struct thread_options, do_verify),
005c565a
JA
3131 .help = "Run verification stage after write",
3132 .def = "1",
3133 .parent = "verify",
d71c154c 3134 .hide = 1,
e8b0e958
JA
3135 .category = FIO_OPT_C_IO,
3136 .group = FIO_OPT_G_VERIFY,
005c565a 3137 },
160b966d
JA
3138 {
3139 .name = "verifysort",
e8b0e958 3140 .lname = "Verify sort",
f31feaa2 3141 .type = FIO_OPT_SOFT_DEPRECATED,
e8b0e958
JA
3142 .category = FIO_OPT_C_IO,
3143 .group = FIO_OPT_G_VERIFY,
160b966d 3144 },
1ae83d45
JA
3145 {
3146 .name = "verifysort_nr",
cce2fdfe 3147 .lname = "Verify Sort Nr",
f31feaa2 3148 .type = FIO_OPT_SOFT_DEPRECATED,
836fcc0f
JA
3149 .category = FIO_OPT_C_IO,
3150 .group = FIO_OPT_G_VERIFY,
1ae83d45 3151 },
3f9f4e26 3152 {
a59e170d 3153 .name = "verify_interval",
e8b0e958 3154 .lname = "Verify interval",
e01b22b8 3155 .type = FIO_OPT_INT,
a609f12a 3156 .off1 = offsetof(struct thread_options, verify_interval),
819a9680 3157 .minval = 2 * sizeof(struct verify_header),
a59e170d 3158 .help = "Store verify buffer header every N bytes",
afdf9352 3159 .parent = "verify",
d71c154c 3160 .hide = 1,
20eb06bd 3161 .interval = 2 * sizeof(struct verify_header),
e8b0e958
JA
3162 .category = FIO_OPT_C_IO,
3163 .group = FIO_OPT_G_VERIFY,
3f9f4e26 3164 },
546a9142 3165 {
a59e170d 3166 .name = "verify_offset",
e8b0e958 3167 .lname = "Verify offset",
e01b22b8 3168 .type = FIO_OPT_INT,
a59e170d 3169 .help = "Offset verify header location by N bytes",
a609f12a 3170 .off1 = offsetof(struct thread_options, verify_offset),
203160d5 3171 .minval = sizeof(struct verify_header),
afdf9352 3172 .parent = "verify",
d71c154c 3173 .hide = 1,
e8b0e958
JA
3174 .category = FIO_OPT_C_IO,
3175 .group = FIO_OPT_G_VERIFY,
546a9142 3176 },
e28218f3
SL
3177 {
3178 .name = "verify_pattern",
e8b0e958 3179 .lname = "Verify pattern",
0e92f873 3180 .type = FIO_OPT_STR,
e28218f3 3181 .cb = str_verify_pattern_cb,
a609f12a 3182 .off1 = offsetof(struct thread_options, verify_pattern),
e28218f3
SL
3183 .help = "Fill pattern for IO buffers",
3184 .parent = "verify",
d71c154c 3185 .hide = 1,
e8b0e958
JA
3186 .category = FIO_OPT_C_IO,
3187 .group = FIO_OPT_G_VERIFY,
e28218f3 3188 },
a12a3b4d
JA
3189 {
3190 .name = "verify_fatal",
e8b0e958 3191 .lname = "Verify fatal",
68e1f29a 3192 .type = FIO_OPT_BOOL,
a609f12a 3193 .off1 = offsetof(struct thread_options, verify_fatal),
a12a3b4d
JA
3194 .def = "0",
3195 .help = "Exit on a single verify failure, don't continue",
3196 .parent = "verify",
d71c154c 3197 .hide = 1,
e8b0e958
JA
3198 .category = FIO_OPT_C_IO,
3199 .group = FIO_OPT_G_VERIFY,
a12a3b4d 3200 },
b463e936
JA
3201 {
3202 .name = "verify_dump",
e8b0e958 3203 .lname = "Verify dump",
b463e936 3204 .type = FIO_OPT_BOOL,
a609f12a 3205 .off1 = offsetof(struct thread_options, verify_dump),
ef71e317 3206 .def = "0",
b463e936
JA
3207 .help = "Dump contents of good and bad blocks on failure",
3208 .parent = "verify",
d71c154c 3209 .hide = 1,
e8b0e958
JA
3210 .category = FIO_OPT_C_IO,
3211 .group = FIO_OPT_G_VERIFY,
b463e936 3212 },
e8462bd8
JA
3213 {
3214 .name = "verify_async",
e8b0e958 3215 .lname = "Verify asynchronously",
e8462bd8 3216 .type = FIO_OPT_INT,
a609f12a 3217 .off1 = offsetof(struct thread_options, verify_async),
e8462bd8
JA
3218 .def = "0",
3219 .help = "Number of async verifier threads to use",
3220 .parent = "verify",
d71c154c 3221 .hide = 1,
e8b0e958
JA
3222 .category = FIO_OPT_C_IO,
3223 .group = FIO_OPT_G_VERIFY,
e8462bd8 3224 },
9e144189
JA
3225 {
3226 .name = "verify_backlog",
e8b0e958 3227 .lname = "Verify backlog",
9e144189 3228 .type = FIO_OPT_STR_VAL,
a609f12a 3229 .off1 = offsetof(struct thread_options, verify_backlog),
9e144189
JA
3230 .help = "Verify after this number of blocks are written",
3231 .parent = "verify",
d71c154c 3232 .hide = 1,
e8b0e958
JA
3233 .category = FIO_OPT_C_IO,
3234 .group = FIO_OPT_G_VERIFY,
9e144189
JA
3235 },
3236 {
3237 .name = "verify_backlog_batch",
e8b0e958 3238 .lname = "Verify backlog batch",
9e144189 3239 .type = FIO_OPT_INT,
a609f12a 3240 .off1 = offsetof(struct thread_options, verify_batch),
9e144189 3241 .help = "Verify this number of IO blocks",
0d29de83 3242 .parent = "verify",
d71c154c 3243 .hide = 1,
e8b0e958
JA
3244 .category = FIO_OPT_C_IO,
3245 .group = FIO_OPT_G_VERIFY,
9e144189 3246 },
e8462bd8
JA
3247#ifdef FIO_HAVE_CPU_AFFINITY
3248 {
3249 .name = "verify_async_cpus",
e8b0e958 3250 .lname = "Async verify CPUs",
e8462bd8
JA
3251 .type = FIO_OPT_STR,
3252 .cb = str_verify_cpus_allowed_cb,
a609f12a 3253 .off1 = offsetof(struct thread_options, verify_cpumask),
e8462bd8
JA
3254 .help = "Set CPUs allowed for async verify threads",
3255 .parent = "verify_async",
d71c154c 3256 .hide = 1,
e8b0e958
JA
3257 .category = FIO_OPT_C_IO,
3258 .group = FIO_OPT_G_VERIFY,
e8462bd8 3259 },
a275c37a
JA
3260#else
3261 {
3262 .name = "verify_async_cpus",
3263 .lname = "Async verify CPUs",
3264 .type = FIO_OPT_UNSUPPORTED,
54d0a315 3265 .help = "Your platform does not support CPU affinities",
a275c37a 3266 },
0d29de83 3267#endif
51aa2da8
JA
3268 {
3269 .name = "experimental_verify",
cce2fdfe 3270 .lname = "Experimental Verify",
a609f12a 3271 .off1 = offsetof(struct thread_options, experimental_verify),
51aa2da8 3272 .type = FIO_OPT_BOOL,
b31eaac9 3273 .help = "Enable experimental verification",
ca09be4b
JA
3274 .parent = "verify",
3275 .category = FIO_OPT_C_IO,
3276 .group = FIO_OPT_G_VERIFY,
3277 },
3278 {
3279 .name = "verify_state_load",
3280 .lname = "Load verify state",
a609f12a 3281 .off1 = offsetof(struct thread_options, verify_state),
ca09be4b
JA
3282 .type = FIO_OPT_BOOL,
3283 .help = "Load verify termination state",
3284 .parent = "verify",
3285 .category = FIO_OPT_C_IO,
3286 .group = FIO_OPT_G_VERIFY,
3287 },
3288 {
3289 .name = "verify_state_save",
3290 .lname = "Save verify state",
a609f12a 3291 .off1 = offsetof(struct thread_options, verify_state_save),
ca09be4b
JA
3292 .type = FIO_OPT_BOOL,
3293 .def = "1",
3294 .help = "Save verify state on termination",
3295 .parent = "verify",
836fcc0f
JA
3296 .category = FIO_OPT_C_IO,
3297 .group = FIO_OPT_G_VERIFY,
51aa2da8 3298 },
0d29de83
JA
3299#ifdef FIO_HAVE_TRIM
3300 {
3301 .name = "trim_percentage",
e8b0e958 3302 .lname = "Trim percentage",
0d29de83 3303 .type = FIO_OPT_INT,
a609f12a 3304 .off1 = offsetof(struct thread_options, trim_percentage),
20eb06bd 3305 .minval = 0,
0d29de83 3306 .maxval = 100,
169c098d 3307 .help = "Number of verify blocks to trim (i.e., discard)",
0d29de83
JA
3308 .parent = "verify",
3309 .def = "0",
20eb06bd 3310 .interval = 1,
d71c154c 3311 .hide = 1,
e8b0e958
JA
3312 .category = FIO_OPT_C_IO,
3313 .group = FIO_OPT_G_TRIM,
0d29de83
JA
3314 },
3315 {
3316 .name = "trim_verify_zero",
e8b0e958 3317 .lname = "Verify trim zero",
20eb06bd 3318 .type = FIO_OPT_BOOL,
169c098d 3319 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
a609f12a 3320 .off1 = offsetof(struct thread_options, trim_zero),
0d29de83 3321 .parent = "trim_percentage",
d71c154c 3322 .hide = 1,
0d29de83 3323 .def = "1",
e8b0e958
JA
3324 .category = FIO_OPT_C_IO,
3325 .group = FIO_OPT_G_TRIM,
0d29de83
JA
3326 },
3327 {
3328 .name = "trim_backlog",
e8b0e958 3329 .lname = "Trim backlog",
0d29de83 3330 .type = FIO_OPT_STR_VAL,
a609f12a 3331 .off1 = offsetof(struct thread_options, trim_backlog),
0d29de83
JA
3332 .help = "Trim after this number of blocks are written",
3333 .parent = "trim_percentage",
d71c154c 3334 .hide = 1,
20eb06bd 3335 .interval = 1,
e8b0e958
JA
3336 .category = FIO_OPT_C_IO,
3337 .group = FIO_OPT_G_TRIM,
0d29de83
JA
3338 },
3339 {
3340 .name = "trim_backlog_batch",
e8b0e958 3341 .lname = "Trim backlog batch",
0d29de83 3342 .type = FIO_OPT_INT,
a609f12a 3343 .off1 = offsetof(struct thread_options, trim_batch),
0d29de83
JA
3344 .help = "Trim this number of IO blocks",
3345 .parent = "trim_percentage",
d71c154c 3346 .hide = 1,
20eb06bd 3347 .interval = 1,
e8b0e958
JA
3348 .category = FIO_OPT_C_IO,
3349 .group = FIO_OPT_G_TRIM,
0d29de83 3350 },
a275c37a
JA
3351#else
3352 {
3353 .name = "trim_percentage",
3354 .lname = "Trim percentage",
3355 .type = FIO_OPT_UNSUPPORTED,
3356 .help = "Fio does not support TRIM on your platform",
3357 },
3358 {
3359 .name = "trim_verify_zero",
3360 .lname = "Verify trim zero",
3361 .type = FIO_OPT_UNSUPPORTED,
3362 .help = "Fio does not support TRIM on your platform",
3363 },
3364 {
3365 .name = "trim_backlog",
3366 .lname = "Trim backlog",
3367 .type = FIO_OPT_UNSUPPORTED,
3368 .help = "Fio does not support TRIM on your platform",
3369 },
3370 {
3371 .name = "trim_backlog_batch",
3372 .lname = "Trim backlog batch",
3373 .type = FIO_OPT_UNSUPPORTED,
3374 .help = "Fio does not support TRIM on your platform",
3375 },
e8462bd8 3376#endif
214e1eca
JA
3377 {
3378 .name = "write_iolog",
e8b0e958 3379 .lname = "Write I/O log",
214e1eca 3380 .type = FIO_OPT_STR_STORE,
a609f12a 3381 .off1 = offsetof(struct thread_options, write_iolog_file),
214e1eca 3382 .help = "Store IO pattern to file",
e8b0e958
JA
3383 .category = FIO_OPT_C_IO,
3384 .group = FIO_OPT_G_IOLOG,
214e1eca
JA
3385 },
3386 {
3387 .name = "read_iolog",
e8b0e958 3388 .lname = "Read I/O log",
214e1eca 3389 .type = FIO_OPT_STR_STORE,
a609f12a 3390 .off1 = offsetof(struct thread_options, read_iolog_file),
214e1eca 3391 .help = "Playback IO pattern from file",
e8b0e958
JA
3392 .category = FIO_OPT_C_IO,
3393 .group = FIO_OPT_G_IOLOG,
214e1eca 3394 },
98e7161c
AK
3395 {
3396 .name = "read_iolog_chunked",
3397 .lname = "Read I/O log in parts",
3398 .type = FIO_OPT_BOOL,
3399 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3400 .def = "0",
3401 .parent = "read_iolog",
3402 .help = "Parse IO pattern in chunks",
3403 .category = FIO_OPT_C_IO,
3404 .group = FIO_OPT_G_IOLOG,
3405 },
64bbb865
DN
3406 {
3407 .name = "replay_no_stall",
e8b0e958 3408 .lname = "Don't stall on replay",
20eb06bd 3409 .type = FIO_OPT_BOOL,
a609f12a 3410 .off1 = offsetof(struct thread_options, no_stall),
64bbb865 3411 .def = "0",
87e7a972 3412 .parent = "read_iolog",
d71c154c 3413 .hide = 1,
64bbb865 3414 .help = "Playback IO pattern file as fast as possible without stalls",
e8b0e958
JA
3415 .category = FIO_OPT_C_IO,
3416 .group = FIO_OPT_G_IOLOG,
64bbb865 3417 },
d1c46c04
DN
3418 {
3419 .name = "replay_redirect",
e8b0e958 3420 .lname = "Redirect device for replay",
d1c46c04 3421 .type = FIO_OPT_STR_STORE,
a609f12a 3422 .off1 = offsetof(struct thread_options, replay_redirect),
d1c46c04 3423 .parent = "read_iolog",
d71c154c 3424 .hide = 1,
d1c46c04 3425 .help = "Replay all I/O onto this device, regardless of trace device",
e8b0e958
JA
3426 .category = FIO_OPT_C_IO,
3427 .group = FIO_OPT_G_IOLOG,
d1c46c04 3428 },
0c63576e
JA
3429 {
3430 .name = "replay_scale",
3431 .lname = "Replace offset scale factor",
3432 .type = FIO_OPT_INT,
a609f12a 3433 .off1 = offsetof(struct thread_options, replay_scale),
0c63576e
JA
3434 .parent = "read_iolog",
3435 .def = "1",
3436 .help = "Align offsets to this blocksize",
3437 .category = FIO_OPT_C_IO,
3438 .group = FIO_OPT_G_IOLOG,
3439 },
3440 {
3441 .name = "replay_align",
3442 .lname = "Replace alignment",
3443 .type = FIO_OPT_INT,
a609f12a 3444 .off1 = offsetof(struct thread_options, replay_align),
0c63576e
JA
3445 .parent = "read_iolog",
3446 .help = "Scale offset down by this factor",
3447 .category = FIO_OPT_C_IO,
3448 .group = FIO_OPT_G_IOLOG,
3449 .pow2 = 1,
3450 },
6dd7fa77
JA
3451 {
3452 .name = "replay_time_scale",
3453 .lname = "Replay Time Scale",
3454 .type = FIO_OPT_INT,
3455 .off1 = offsetof(struct thread_options, replay_time_scale),
3456 .def = "100",
3457 .minval = 1,
3458 .parent = "read_iolog",
3459 .hide = 1,
3460 .help = "Scale time for replay events",
3461 .category = FIO_OPT_C_IO,
3462 .group = FIO_OPT_G_IOLOG,
3463 },
d7235efb
JA
3464 {
3465 .name = "replay_skip",
3466 .lname = "Replay Skip",
3467 .type = FIO_OPT_STR,
3468 .cb = str_replay_skip_cb,
3469 .off1 = offsetof(struct thread_options, replay_skip),
3470 .parent = "read_iolog",
3471 .help = "Skip certain IO types (read,write,trim,flush)",
3472 .category = FIO_OPT_C_IO,
3473 .group = FIO_OPT_G_IOLOG,
3474 },
b9921d1a
DZ
3475 {
3476 .name = "merge_blktrace_file",
3477 .lname = "Merged blktrace output filename",
3478 .type = FIO_OPT_STR_STORE,
3479 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3480 .help = "Merged blktrace output filename",
3481 .category = FIO_OPT_C_IO,
3482 .group = FIO_OPT_G_IOLOG,
3483 },
87a48ada
DZ
3484 {
3485 .name = "merge_blktrace_scalars",
3486 .lname = "Percentage to scale each trace",
3487 .type = FIO_OPT_FLOAT_LIST,
3488 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3489 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3490 .help = "Percentage to scale each trace",
3491 .category = FIO_OPT_C_IO,
3492 .group = FIO_OPT_G_IOLOG,
3493 },
55bfd8c8
DZ
3494 {
3495 .name = "merge_blktrace_iters",
3496 .lname = "Number of iterations to run per trace",
3497 .type = FIO_OPT_FLOAT_LIST,
3498 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3499 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3500 .help = "Number of iterations to run per trace",
3501 .category = FIO_OPT_C_IO,
3502 .group = FIO_OPT_G_IOLOG,
3503 },
214e1eca
JA
3504 {
3505 .name = "exec_prerun",
e8b0e958 3506 .lname = "Pre-execute runnable",
214e1eca 3507 .type = FIO_OPT_STR_STORE,
a609f12a 3508 .off1 = offsetof(struct thread_options, exec_prerun),
214e1eca 3509 .help = "Execute this file prior to running job",
e8b0e958
JA
3510 .category = FIO_OPT_C_GENERAL,
3511 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3512 },
3513 {
3514 .name = "exec_postrun",
e8b0e958 3515 .lname = "Post-execute runnable",
214e1eca 3516 .type = FIO_OPT_STR_STORE,
a609f12a 3517 .off1 = offsetof(struct thread_options, exec_postrun),
214e1eca 3518 .help = "Execute this file after running job",
e8b0e958
JA
3519 .category = FIO_OPT_C_GENERAL,
3520 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3521 },
3522#ifdef FIO_HAVE_IOSCHED_SWITCH
3523 {
3524 .name = "ioscheduler",
e8b0e958 3525 .lname = "I/O scheduler",
214e1eca 3526 .type = FIO_OPT_STR_STORE,
a609f12a 3527 .off1 = offsetof(struct thread_options, ioscheduler),
214e1eca 3528 .help = "Use this IO scheduler on the backing device",
e8b0e958
JA
3529 .category = FIO_OPT_C_FILE,
3530 .group = FIO_OPT_G_INVALID,
214e1eca 3531 },
a275c37a
JA
3532#else
3533 {
3534 .name = "ioscheduler",
3535 .lname = "I/O scheduler",
3536 .type = FIO_OPT_UNSUPPORTED,
3537 .help = "Your platform does not support IO scheduler switching",
3538 },
214e1eca 3539#endif
7b865a2f
BVA
3540 {
3541 .name = "zonemode",
3542 .lname = "Zone mode",
3543 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3544 .type = FIO_OPT_STR,
3545 .off1 = offsetof(struct thread_options, zone_mode),
3546 .def = "none",
3547 .category = FIO_OPT_C_IO,
3548 .group = FIO_OPT_G_ZONE,
3549 .posval = {
3550 { .ival = "none",
3551 .oval = ZONE_MODE_NONE,
3552 .help = "no zoning",
3553 },
3554 { .ival = "strided",
3555 .oval = ZONE_MODE_STRIDED,
3556 .help = "strided mode - random I/O is restricted to a single zone",
3557 },
3558 { .ival = "zbd",
3559 .oval = ZONE_MODE_ZBD,
3560 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3561 },
3562 },
3563 },
214e1eca
JA
3564 {
3565 .name = "zonesize",
e8b0e958 3566 .lname = "Zone size",
214e1eca 3567 .type = FIO_OPT_STR_VAL,
a609f12a 3568 .off1 = offsetof(struct thread_options, zone_size),
ed335855
SN
3569 .help = "Amount of data to read per zone",
3570 .def = "0",
20eb06bd 3571 .interval = 1024 * 1024,
e8b0e958
JA
3572 .category = FIO_OPT_C_IO,
3573 .group = FIO_OPT_G_ZONE,
ed335855 3574 },
b8dd9750
HH
3575 {
3576 .name = "zonecapacity",
3577 .lname = "Zone capacity",
3578 .type = FIO_OPT_STR_VAL,
3579 .off1 = offsetof(struct thread_options, zone_capacity),
3580 .help = "Capacity per zone",
3581 .def = "0",
3582 .interval = 1024 * 1024,
3583 .category = FIO_OPT_C_IO,
3584 .group = FIO_OPT_G_ZONE,
3585 },
ed335855
SN
3586 {
3587 .name = "zonerange",
e8b0e958 3588 .lname = "Zone range",
ed335855 3589 .type = FIO_OPT_STR_VAL,
a609f12a 3590 .off1 = offsetof(struct thread_options, zone_range),
214e1eca
JA
3591 .help = "Give size of an IO zone",
3592 .def = "0",
20eb06bd 3593 .interval = 1024 * 1024,
e8b0e958
JA
3594 .category = FIO_OPT_C_IO,
3595 .group = FIO_OPT_G_ZONE,
214e1eca
JA
3596 },
3597 {
3598 .name = "zoneskip",
e8b0e958 3599 .lname = "Zone skip",
8f39afa7
AD
3600 .type = FIO_OPT_STR_VAL_ZONE,
3601 .cb = str_zoneskip_cb,
a609f12a 3602 .off1 = offsetof(struct thread_options, zone_skip),
214e1eca
JA
3603 .help = "Space between IO zones",
3604 .def = "0",
e8b0e958
JA
3605 .category = FIO_OPT_C_IO,
3606 .group = FIO_OPT_G_ZONE,
214e1eca 3607 },
bfbdd35b
BVA
3608 {
3609 .name = "read_beyond_wp",
3610 .lname = "Allow reads beyond the zone write pointer",
3611 .type = FIO_OPT_BOOL,
3612 .off1 = offsetof(struct thread_options, read_beyond_wp),
3613 .help = "Allow reads beyond the zone write pointer",
3614 .def = "0",
3615 .category = FIO_OPT_C_IO,
3616 .group = FIO_OPT_G_INVALID,
3617 },
59b07544
BVA
3618 {
3619 .name = "max_open_zones",
219c662d 3620 .lname = "Per device/file maximum number of open zones",
59b07544
BVA
3621 .type = FIO_OPT_INT,
3622 .off1 = offsetof(struct thread_options, max_open_zones),
b7694961 3623 .maxval = ZBD_MAX_OPEN_ZONES,
219c662d
AD
3624 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3625 .def = "0",
3626 .category = FIO_OPT_C_IO,
3627 .group = FIO_OPT_G_INVALID,
3628 },
3629 {
3630 .name = "job_max_open_zones",
3631 .lname = "Job maximum number of open zones",
3632 .type = FIO_OPT_INT,
3633 .off1 = offsetof(struct thread_options, job_max_open_zones),
3634 .maxval = ZBD_MAX_OPEN_ZONES,
3635 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
59b07544
BVA
3636 .def = "0",
3637 .category = FIO_OPT_C_IO,
3638 .group = FIO_OPT_G_INVALID,
3639 },
575686bb
NC
3640 {
3641 .name = "ignore_zone_limits",
3642 .lname = "Ignore zone resource limits",
3643 .type = FIO_OPT_BOOL,
3644 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3645 .def = "0",
3646 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3647 .category = FIO_OPT_C_IO,
3648 .group = FIO_OPT_G_INVALID,
3649 },
a7c2b6fc
BVA
3650 {
3651 .name = "zone_reset_threshold",
3652 .lname = "Zone reset threshold",
3653 .help = "Zoned block device reset threshold",
3654 .type = FIO_OPT_FLOAT_LIST,
3655 .maxlen = 1,
3656 .off1 = offsetof(struct thread_options, zrt),
3657 .minfp = 0,
3658 .maxfp = 1,
3659 .category = FIO_OPT_C_IO,
3660 .group = FIO_OPT_G_ZONE,
3661 },
3662 {
3663 .name = "zone_reset_frequency",
3664 .lname = "Zone reset frequency",
3665 .help = "Zoned block device zone reset frequency in HZ",
3666 .type = FIO_OPT_FLOAT_LIST,
3667 .maxlen = 1,
3668 .off1 = offsetof(struct thread_options, zrf),
3669 .minfp = 0,
3670 .maxfp = 1,
3671 .category = FIO_OPT_C_IO,
3672 .group = FIO_OPT_G_ZONE,
3673 },
a7e8aae0
KB
3674 {
3675 .name = "fdp",
3676 .lname = "Flexible data placement",
3677 .type = FIO_OPT_BOOL,
3678 .off1 = offsetof(struct thread_options, fdp),
3679 .help = "Use Data placement directive (FDP)",
3680 .def = "0",
3681 .category = FIO_OPT_C_IO,
3682 .group = FIO_OPT_G_INVALID,
3683 },
3684 {
3685 .name = "fdp_pli",
3686 .lname = "FDP Placement ID indicies",
3687 .type = FIO_OPT_STR,
3688 .cb = str_fdp_pli_cb,
3689 .off1 = offsetof(struct thread_options, fdp_plis),
3690 .help = "Sets which placement ids to use (defaults to all)",
3691 .hide = 1,
3692 .category = FIO_OPT_C_IO,
3693 .group = FIO_OPT_G_INVALID,
3694 },
214e1eca
JA
3695 {
3696 .name = "lockmem",
e8b0e958 3697 .lname = "Lock memory",
214e1eca 3698 .type = FIO_OPT_STR_VAL,
a609f12a 3699 .off1 = offsetof(struct thread_options, lockmem),
81c6b6cd 3700 .help = "Lock down this amount of memory (per worker)",
214e1eca 3701 .def = "0",
20eb06bd 3702 .interval = 1024 * 1024,
e8b0e958
JA
3703 .category = FIO_OPT_C_GENERAL,
3704 .group = FIO_OPT_G_INVALID,
214e1eca 3705 },
214e1eca
JA
3706 {
3707 .name = "rwmixread",
e8b0e958 3708 .lname = "Read/write mix read",
214e1eca 3709 .type = FIO_OPT_INT,
cb499fc4 3710 .cb = str_rwmix_read_cb,
a609f12a 3711 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
214e1eca
JA
3712 .maxval = 100,
3713 .help = "Percentage of mixed workload that is reads",
3714 .def = "50",
20eb06bd 3715 .interval = 5,
90265353 3716 .inverse = "rwmixwrite",
e8b0e958
JA
3717 .category = FIO_OPT_C_IO,
3718 .group = FIO_OPT_G_RWMIX,
214e1eca
JA
3719 },
3720 {
3721 .name = "rwmixwrite",
e8b0e958 3722 .lname = "Read/write mix write",
214e1eca 3723 .type = FIO_OPT_INT,
cb499fc4 3724 .cb = str_rwmix_write_cb,
a609f12a 3725 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
214e1eca
JA
3726 .maxval = 100,
3727 .help = "Percentage of mixed workload that is writes",
3728 .def = "50",
20eb06bd 3729 .interval = 5,
90265353 3730 .inverse = "rwmixread",
e8b0e958
JA
3731 .category = FIO_OPT_C_IO,
3732 .group = FIO_OPT_G_RWMIX,
214e1eca 3733 },
afdf9352
JA
3734 {
3735 .name = "rwmixcycle",
e8b0e958 3736 .lname = "Read/write mix cycle",
15ca150e 3737 .type = FIO_OPT_DEPRECATED,
e8b0e958
JA
3738 .category = FIO_OPT_C_IO,
3739 .group = FIO_OPT_G_RWMIX,
afdf9352 3740 },
214e1eca
JA
3741 {
3742 .name = "nice",
e8b0e958 3743 .lname = "Nice",
214e1eca 3744 .type = FIO_OPT_INT,
a609f12a 3745 .off1 = offsetof(struct thread_options, nice),
214e1eca 3746 .help = "Set job CPU nice value",
11fd6aa8
RC
3747 .minval = -20,
3748 .maxval = 19,
214e1eca 3749 .def = "0",
20eb06bd 3750 .interval = 1,
e8b0e958 3751 .category = FIO_OPT_C_GENERAL,
10860056 3752 .group = FIO_OPT_G_CRED,
214e1eca
JA
3753 },
3754#ifdef FIO_HAVE_IOPRIO
3755 {
3756 .name = "prio",
e8b0e958 3757 .lname = "I/O nice priority",
214e1eca 3758 .type = FIO_OPT_INT,
a609f12a 3759 .off1 = offsetof(struct thread_options, ioprio),
214e1eca 3760 .help = "Set job IO priority value",
1767bd34
TK
3761 .minval = IOPRIO_MIN_PRIO,
3762 .maxval = IOPRIO_MAX_PRIO,
20eb06bd 3763 .interval = 1,
e8b0e958 3764 .category = FIO_OPT_C_GENERAL,
10860056 3765 .group = FIO_OPT_G_CRED,
214e1eca 3766 },
32ef447a
TK
3767#else
3768 {
3769 .name = "prio",
3770 .lname = "I/O nice priority",
3771 .type = FIO_OPT_UNSUPPORTED,
3772 .help = "Your platform does not support IO priorities",
3773 },
3774#endif
3775#ifdef FIO_HAVE_IOPRIO_CLASS
3776#ifndef FIO_HAVE_IOPRIO
3777#error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3778#endif
214e1eca
JA
3779 {
3780 .name = "prioclass",
e8b0e958 3781 .lname = "I/O nice priority class",
214e1eca 3782 .type = FIO_OPT_INT,
a609f12a 3783 .off1 = offsetof(struct thread_options, ioprio_class),
214e1eca 3784 .help = "Set job IO priority class",
1767bd34
TK
3785 .minval = IOPRIO_MIN_PRIO_CLASS,
3786 .maxval = IOPRIO_MAX_PRIO_CLASS,
20eb06bd 3787 .interval = 1,
e8b0e958 3788 .category = FIO_OPT_C_GENERAL,
10860056 3789 .group = FIO_OPT_G_CRED,
214e1eca 3790 },
a275c37a 3791#else
a275c37a
JA
3792 {
3793 .name = "prioclass",
3794 .lname = "I/O nice priority class",
3795 .type = FIO_OPT_UNSUPPORTED,
32ef447a 3796 .help = "Your platform does not support IO priority classes",
a275c37a 3797 },
214e1eca
JA
3798#endif
3799 {
3800 .name = "thinktime",
e8b0e958 3801 .lname = "Thinktime",
214e1eca 3802 .type = FIO_OPT_INT,
a609f12a 3803 .off1 = offsetof(struct thread_options, thinktime),
214e1eca
JA
3804 .help = "Idle time between IO buffers (usec)",
3805 .def = "0",
88038bc7 3806 .is_time = 1,
e8b0e958 3807 .category = FIO_OPT_C_IO,
3ceb458f 3808 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
3809 },
3810 {
3811 .name = "thinktime_spin",
e8b0e958 3812 .lname = "Thinktime spin",
214e1eca 3813 .type = FIO_OPT_INT,
a609f12a 3814 .off1 = offsetof(struct thread_options, thinktime_spin),
214e1eca
JA
3815 .help = "Start think time by spinning this amount (usec)",
3816 .def = "0",
88038bc7 3817 .is_time = 1,
afdf9352 3818 .parent = "thinktime",
d71c154c 3819 .hide = 1,
e8b0e958 3820 .category = FIO_OPT_C_IO,
3ceb458f 3821 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
3822 },
3823 {
3824 .name = "thinktime_blocks",
e8b0e958 3825 .lname = "Thinktime blocks",
214e1eca 3826 .type = FIO_OPT_INT,
a609f12a 3827 .off1 = offsetof(struct thread_options, thinktime_blocks),
214e1eca
JA
3828 .help = "IO buffer period between 'thinktime'",
3829 .def = "1",
afdf9352 3830 .parent = "thinktime",
d71c154c 3831 .hide = 1,
e8b0e958 3832 .category = FIO_OPT_C_IO,
3ceb458f 3833 .group = FIO_OPT_G_THINKTIME,
214e1eca 3834 },
33f42c20
HQ
3835 {
3836 .name = "thinktime_blocks_type",
3837 .lname = "Thinktime blocks type",
3838 .type = FIO_OPT_STR,
3839 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3840 .help = "How thinktime_blocks takes effect",
3841 .def = "complete",
3842 .category = FIO_OPT_C_IO,
3843 .group = FIO_OPT_G_THINKTIME,
3844 .posval = {
3845 { .ival = "complete",
3846 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3847 .help = "thinktime_blocks takes effect at the completion side",
3848 },
3849 {
3850 .ival = "issue",
3851 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3852 .help = "thinktime_blocks takes effect at the issue side",
3853 },
3854 },
3855 .parent = "thinktime",
3856 },
f7942acd
SK
3857 {
3858 .name = "thinktime_iotime",
3859 .lname = "Thinktime interval",
3860 .type = FIO_OPT_INT,
3861 .off1 = offsetof(struct thread_options, thinktime_iotime),
3862 .help = "IO time interval between 'thinktime'",
3863 .def = "0",
3864 .parent = "thinktime",
3865 .hide = 1,
3866 .is_seconds = 1,
3867 .is_time = 1,
3868 .category = FIO_OPT_C_IO,
3869 .group = FIO_OPT_G_THINKTIME,
3870 },
214e1eca
JA
3871 {
3872 .name = "rate",
e8b0e958 3873 .lname = "I/O rate",
140a6888 3874 .type = FIO_OPT_ULL,
a609f12a
JA
3875 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3876 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3877 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
214e1eca 3878 .help = "Set bandwidth rate",
e8b0e958
JA
3879 .category = FIO_OPT_C_IO,
3880 .group = FIO_OPT_G_RATE,
214e1eca
JA
3881 },
3882 {
6d428bcd
JA
3883 .name = "rate_min",
3884 .alias = "ratemin",
e8b0e958 3885 .lname = "I/O min rate",
140a6888 3886 .type = FIO_OPT_ULL,
a609f12a
JA
3887 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3888 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3889 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
4e991c23 3890 .help = "Job must meet this rate or it will be shutdown",
afdf9352 3891 .parent = "rate",
d71c154c 3892 .hide = 1,
e8b0e958
JA
3893 .category = FIO_OPT_C_IO,
3894 .group = FIO_OPT_G_RATE,
4e991c23
JA
3895 },
3896 {
3897 .name = "rate_iops",
e8b0e958 3898 .lname = "I/O rate IOPS",
e01b22b8 3899 .type = FIO_OPT_INT,
a609f12a
JA
3900 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3901 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3902 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
4e991c23 3903 .help = "Limit IO used to this number of IO operations/sec",
d71c154c 3904 .hide = 1,
e8b0e958
JA
3905 .category = FIO_OPT_C_IO,
3906 .group = FIO_OPT_G_RATE,
4e991c23
JA
3907 },
3908 {
3909 .name = "rate_iops_min",
e8b0e958 3910 .lname = "I/O min rate IOPS",
e01b22b8 3911 .type = FIO_OPT_INT,
a609f12a
JA
3912 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3913 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3914 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
03e20d68 3915 .help = "Job must meet this rate or it will be shut down",
afdf9352 3916 .parent = "rate_iops",
d71c154c 3917 .hide = 1,
e8b0e958
JA
3918 .category = FIO_OPT_C_IO,
3919 .group = FIO_OPT_G_RATE,
214e1eca 3920 },
ff6bb260 3921 {
6de65959
JA
3922 .name = "rate_process",
3923 .lname = "Rate Process",
3924 .type = FIO_OPT_STR,
a609f12a 3925 .off1 = offsetof(struct thread_options, rate_process),
6de65959
JA
3926 .help = "What process controls how rated IO is managed",
3927 .def = "linear",
ff6bb260
SL
3928 .category = FIO_OPT_C_IO,
3929 .group = FIO_OPT_G_RATE,
6de65959
JA
3930 .posval = {
3931 { .ival = "linear",
3932 .oval = RATE_PROCESS_LINEAR,
3933 .help = "Linear rate of IO",
3934 },
3935 {
3936 .ival = "poisson",
3937 .oval = RATE_PROCESS_POISSON,
3938 .help = "Rate follows Poisson process",
3939 },
3940 },
3941 .parent = "rate",
ff6bb260 3942 },
214e1eca 3943 {
6d428bcd
JA
3944 .name = "rate_cycle",
3945 .alias = "ratecycle",
e8b0e958 3946 .lname = "I/O rate cycle",
214e1eca 3947 .type = FIO_OPT_INT,
a609f12a 3948 .off1 = offsetof(struct thread_options, ratecycle),
214e1eca
JA
3949 .help = "Window average for rate limits (msec)",
3950 .def = "1000",
afdf9352 3951 .parent = "rate",
d71c154c 3952 .hide = 1,
e8b0e958
JA
3953 .category = FIO_OPT_C_IO,
3954 .group = FIO_OPT_G_RATE,
214e1eca 3955 },
1a9bf814
JA
3956 {
3957 .name = "rate_ignore_thinktime",
3958 .lname = "Rate ignore thinktime",
3959 .type = FIO_OPT_BOOL,
3960 .off1 = offsetof(struct thread_options, rate_ign_think),
3961 .help = "Rated IO ignores thinktime settings",
3962 .parent = "rate",
3963 .category = FIO_OPT_C_IO,
3964 .group = FIO_OPT_G_RATE,
3965 },
15501535
JA
3966 {
3967 .name = "max_latency",
dd97d866 3968 .lname = "Max Latency (usec)",
f7cf63bf
VR
3969 .type = FIO_OPT_ULL,
3970 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
3971 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
3972 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
15501535 3973 .help = "Maximum tolerated IO latency (usec)",
88038bc7 3974 .is_time = 1,
1e5324e7 3975 .category = FIO_OPT_C_IO,
3e260a46
JA
3976 .group = FIO_OPT_G_LATPROF,
3977 },
3978 {
3979 .name = "latency_target",
3980 .lname = "Latency Target (usec)",
3981 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 3982 .off1 = offsetof(struct thread_options, latency_target),
3e260a46 3983 .help = "Ramp to max queue depth supporting this latency",
88038bc7 3984 .is_time = 1,
3e260a46
JA
3985 .category = FIO_OPT_C_IO,
3986 .group = FIO_OPT_G_LATPROF,
3987 },
3988 {
3989 .name = "latency_window",
3990 .lname = "Latency Window (usec)",
3991 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 3992 .off1 = offsetof(struct thread_options, latency_window),
3e260a46 3993 .help = "Time to sustain latency_target",
88038bc7 3994 .is_time = 1,
3e260a46
JA
3995 .category = FIO_OPT_C_IO,
3996 .group = FIO_OPT_G_LATPROF,
3997 },
3998 {
3999 .name = "latency_percentile",
4000 .lname = "Latency Percentile",
4001 .type = FIO_OPT_FLOAT_LIST,
a609f12a 4002 .off1 = offsetof(struct thread_options, latency_percentile),
3e260a46
JA
4003 .help = "Percentile of IOs must be below latency_target",
4004 .def = "100",
4005 .maxlen = 1,
4006 .minfp = 0.0,
4007 .maxfp = 100.0,
4008 .category = FIO_OPT_C_IO,
4009 .group = FIO_OPT_G_LATPROF,
15501535 4010 },
e1bcd541
SL
4011 {
4012 .name = "latency_run",
4013 .lname = "Latency Run",
4014 .type = FIO_OPT_BOOL,
4015 .off1 = offsetof(struct thread_options, latency_run),
4016 .help = "Keep adjusting queue depth to match latency_target",
4017 .def = "0",
4018 .category = FIO_OPT_C_IO,
4019 .group = FIO_OPT_G_LATPROF,
4020 },
214e1eca
JA
4021 {
4022 .name = "invalidate",
e8b0e958 4023 .lname = "Cache invalidate",
214e1eca 4024 .type = FIO_OPT_BOOL,
a609f12a 4025 .off1 = offsetof(struct thread_options, invalidate_cache),
214e1eca
JA
4026 .help = "Invalidate buffer/page cache prior to running job",
4027 .def = "1",
e8b0e958 4028 .category = FIO_OPT_C_IO,
3ceb458f 4029 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
4030 },
4031 {
4032 .name = "sync",
e8b0e958 4033 .lname = "Synchronous I/O",
eb9f8d7f 4034 .type = FIO_OPT_STR,
a609f12a 4035 .off1 = offsetof(struct thread_options, sync_io),
eb9f8d7f
AF
4036 .help = "Use synchronous write IO",
4037 .def = "none",
d71c154c 4038 .hide = 1,
e8b0e958 4039 .category = FIO_OPT_C_IO,
3ceb458f 4040 .group = FIO_OPT_G_IO_TYPE,
eb9f8d7f
AF
4041 .posval = {
4042 { .ival = "none",
4043 .oval = 0,
4044 },
4045 { .ival = "0",
4046 .oval = 0,
4047 },
4048 { .ival = "sync",
4049 .oval = O_SYNC,
4050 },
4051 { .ival = "1",
4052 .oval = O_SYNC,
4053 },
4054#ifdef O_DSYNC
4055 { .ival = "dsync",
4056 .oval = O_DSYNC,
4057 },
4058#endif
4059 },
214e1eca 4060 },
ae8e559e
JA
4061#ifdef FIO_HAVE_WRITE_HINT
4062 {
4063 .name = "write_hint",
4064 .lname = "Write hint",
4065 .type = FIO_OPT_STR,
4066 .off1 = offsetof(struct thread_options, write_hint),
4067 .help = "Set expected write life time",
4068 .category = FIO_OPT_C_ENGINE,
4069 .group = FIO_OPT_G_INVALID,
4070 .posval = {
4071 { .ival = "none",
4072 .oval = RWH_WRITE_LIFE_NONE,
4073 },
4074 { .ival = "short",
4075 .oval = RWH_WRITE_LIFE_SHORT,
4076 },
4077 { .ival = "medium",
4078 .oval = RWH_WRITE_LIFE_MEDIUM,
4079 },
4080 { .ival = "long",
4081 .oval = RWH_WRITE_LIFE_LONG,
4082 },
4083 { .ival = "extreme",
4084 .oval = RWH_WRITE_LIFE_EXTREME,
4085 },
4086 },
4087 },
4088#endif
214e1eca
JA
4089 {
4090 .name = "create_serialize",
e8b0e958 4091 .lname = "Create serialize",
214e1eca 4092 .type = FIO_OPT_BOOL,
a609f12a 4093 .off1 = offsetof(struct thread_options, create_serialize),
c2b8035f 4094 .help = "Serialize creation of job files",
214e1eca 4095 .def = "1",
e8b0e958
JA
4096 .category = FIO_OPT_C_FILE,
4097 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4098 },
4099 {
4100 .name = "create_fsync",
e8b0e958 4101 .lname = "Create fsync",
214e1eca 4102 .type = FIO_OPT_BOOL,
a609f12a 4103 .off1 = offsetof(struct thread_options, create_fsync),
03e20d68 4104 .help = "fsync file after creation",
214e1eca 4105 .def = "1",
e8b0e958
JA
4106 .category = FIO_OPT_C_FILE,
4107 .group = FIO_OPT_G_INVALID,
214e1eca 4108 },
814452bd
JA
4109 {
4110 .name = "create_on_open",
e8b0e958 4111 .lname = "Create on open",
814452bd 4112 .type = FIO_OPT_BOOL,
a609f12a 4113 .off1 = offsetof(struct thread_options, create_on_open),
814452bd
JA
4114 .help = "Create files when they are opened for IO",
4115 .def = "0",
e8b0e958
JA
4116 .category = FIO_OPT_C_FILE,
4117 .group = FIO_OPT_G_INVALID,
814452bd 4118 },
25460cf6
JA
4119 {
4120 .name = "create_only",
cce2fdfe 4121 .lname = "Create Only",
25460cf6 4122 .type = FIO_OPT_BOOL,
a609f12a 4123 .off1 = offsetof(struct thread_options, create_only),
25460cf6 4124 .help = "Only perform file creation phase",
d17fda71 4125 .category = FIO_OPT_C_FILE,
25460cf6
JA
4126 .def = "0",
4127 },
2378826d
JA
4128 {
4129 .name = "allow_file_create",
e81ecca3 4130 .lname = "Allow file create",
2378826d 4131 .type = FIO_OPT_BOOL,
a609f12a 4132 .off1 = offsetof(struct thread_options, allow_create),
2378826d
JA
4133 .help = "Permit fio to create files, if they don't exist",
4134 .def = "1",
4135 .category = FIO_OPT_C_FILE,
4136 .group = FIO_OPT_G_FILENAME,
4137 },
e81ecca3
JA
4138 {
4139 .name = "allow_mounted_write",
4140 .lname = "Allow mounted write",
4141 .type = FIO_OPT_BOOL,
a609f12a 4142 .off1 = offsetof(struct thread_options, allow_mounted_write),
e81ecca3
JA
4143 .help = "Allow writes to a mounted partition",
4144 .def = "0",
4145 .category = FIO_OPT_C_FILE,
4146 .group = FIO_OPT_G_FILENAME,
4147 },
0b9d69ec 4148 {
afad68f7 4149 .name = "pre_read",
e8b0e958 4150 .lname = "Pre-read files",
afad68f7 4151 .type = FIO_OPT_BOOL,
a609f12a 4152 .off1 = offsetof(struct thread_options, pre_read),
03e20d68 4153 .help = "Pre-read files before starting official testing",
afad68f7 4154 .def = "0",
e8b0e958
JA
4155 .category = FIO_OPT_C_FILE,
4156 .group = FIO_OPT_G_INVALID,
afad68f7 4157 },
214e1eca
JA
4158#ifdef FIO_HAVE_CPU_AFFINITY
4159 {
4160 .name = "cpumask",
e8b0e958 4161 .lname = "CPU mask",
214e1eca
JA
4162 .type = FIO_OPT_INT,
4163 .cb = str_cpumask_cb,
a609f12a 4164 .off1 = offsetof(struct thread_options, cpumask),
214e1eca 4165 .help = "CPU affinity mask",
e8b0e958 4166 .category = FIO_OPT_C_GENERAL,
10860056 4167 .group = FIO_OPT_G_CRED,
214e1eca 4168 },
d2e268b0
JA
4169 {
4170 .name = "cpus_allowed",
e8b0e958 4171 .lname = "CPUs allowed",
d2e268b0
JA
4172 .type = FIO_OPT_STR,
4173 .cb = str_cpus_allowed_cb,
a609f12a 4174 .off1 = offsetof(struct thread_options, cpumask),
d2e268b0 4175 .help = "Set CPUs allowed",
e8b0e958 4176 .category = FIO_OPT_C_GENERAL,
10860056 4177 .group = FIO_OPT_G_CRED,
d2e268b0 4178 },
c2acfbac
JA
4179 {
4180 .name = "cpus_allowed_policy",
4181 .lname = "CPUs allowed distribution policy",
4182 .type = FIO_OPT_STR,
a609f12a 4183 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
c2acfbac
JA
4184 .help = "Distribution policy for cpus_allowed",
4185 .parent = "cpus_allowed",
4186 .prio = 1,
4187 .posval = {
4188 { .ival = "shared",
4189 .oval = FIO_CPUS_SHARED,
4190 .help = "Mask shared between threads",
4191 },
4192 { .ival = "split",
4193 .oval = FIO_CPUS_SPLIT,
4194 .help = "Mask split between threads",
4195 },
4196 },
4197 .category = FIO_OPT_C_GENERAL,
4198 .group = FIO_OPT_G_CRED,
4199 },
a275c37a
JA
4200#else
4201 {
4202 .name = "cpumask",
4203 .lname = "CPU mask",
4204 .type = FIO_OPT_UNSUPPORTED,
4205 .help = "Your platform does not support CPU affinities",
4206 },
4207 {
4208 .name = "cpus_allowed",
4209 .lname = "CPUs allowed",
4210 .type = FIO_OPT_UNSUPPORTED,
4211 .help = "Your platform does not support CPU affinities",
4212 },
4213 {
4214 .name = "cpus_allowed_policy",
4215 .lname = "CPUs allowed distribution policy",
4216 .type = FIO_OPT_UNSUPPORTED,
4217 .help = "Your platform does not support CPU affinities",
4218 },
d0b937ed 4219#endif
67bf9823 4220#ifdef CONFIG_LIBNUMA
d0b937ed
YR
4221 {
4222 .name = "numa_cpu_nodes",
cce2fdfe 4223 .lname = "NUMA CPU Nodes",
d0b937ed
YR
4224 .type = FIO_OPT_STR,
4225 .cb = str_numa_cpunodes_cb,
a609f12a 4226 .off1 = offsetof(struct thread_options, numa_cpunodes),
d0b937ed 4227 .help = "NUMA CPU nodes bind",
6be54b2d
JA
4228 .category = FIO_OPT_C_GENERAL,
4229 .group = FIO_OPT_G_INVALID,
d0b937ed
YR
4230 },
4231 {
4232 .name = "numa_mem_policy",
cce2fdfe 4233 .lname = "NUMA Memory Policy",
d0b937ed
YR
4234 .type = FIO_OPT_STR,
4235 .cb = str_numa_mpol_cb,
a609f12a 4236 .off1 = offsetof(struct thread_options, numa_memnodes),
d0b937ed 4237 .help = "NUMA memory policy setup",
6be54b2d
JA
4238 .category = FIO_OPT_C_GENERAL,
4239 .group = FIO_OPT_G_INVALID,
d0b937ed 4240 },
a275c37a
JA
4241#else
4242 {
4243 .name = "numa_cpu_nodes",
4244 .lname = "NUMA CPU Nodes",
4245 .type = FIO_OPT_UNSUPPORTED,
4246 .help = "Build fio with libnuma-dev(el) to enable this option",
4247 },
4248 {
4249 .name = "numa_mem_policy",
4250 .lname = "NUMA Memory Policy",
4251 .type = FIO_OPT_UNSUPPORTED,
4252 .help = "Build fio with libnuma-dev(el) to enable this option",
4253 },
03553853
YR
4254#endif
4255#ifdef CONFIG_CUDA
4256 {
4257 .name = "gpu_dev_id",
4258 .lname = "GPU device ID",
4259 .type = FIO_OPT_INT,
4260 .off1 = offsetof(struct thread_options, gpu_dev_id),
4261 .help = "Set GPU device ID for GPUDirect RDMA",
4262 .def = "0",
4263 .category = FIO_OPT_C_GENERAL,
4264 .group = FIO_OPT_G_INVALID,
4265 },
214e1eca
JA
4266#endif
4267 {
4268 .name = "end_fsync",
e8b0e958 4269 .lname = "End fsync",
214e1eca 4270 .type = FIO_OPT_BOOL,
a609f12a 4271 .off1 = offsetof(struct thread_options, end_fsync),
214e1eca
JA
4272 .help = "Include fsync at the end of job",
4273 .def = "0",
e8b0e958
JA
4274 .category = FIO_OPT_C_FILE,
4275 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4276 },
4277 {
4278 .name = "fsync_on_close",
e8b0e958 4279 .lname = "Fsync on close",
214e1eca 4280 .type = FIO_OPT_BOOL,
a609f12a 4281 .off1 = offsetof(struct thread_options, fsync_on_close),
214e1eca
JA
4282 .help = "fsync files on close",
4283 .def = "0",
e8b0e958
JA
4284 .category = FIO_OPT_C_FILE,
4285 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4286 },
4287 {
4288 .name = "unlink",
e8b0e958 4289 .lname = "Unlink file",
214e1eca 4290 .type = FIO_OPT_BOOL,
a609f12a 4291 .off1 = offsetof(struct thread_options, unlink),
214e1eca
JA
4292 .help = "Unlink created files after job has completed",
4293 .def = "0",
e8b0e958
JA
4294 .category = FIO_OPT_C_FILE,
4295 .group = FIO_OPT_G_INVALID,
214e1eca 4296 },
39c1c323 4297 {
4298 .name = "unlink_each_loop",
4299 .lname = "Unlink file after each loop of a job",
4300 .type = FIO_OPT_BOOL,
a609f12a 4301 .off1 = offsetof(struct thread_options, unlink_each_loop),
39c1c323 4302 .help = "Unlink created files after each loop in a job has completed",
4303 .def = "0",
4304 .category = FIO_OPT_C_FILE,
4305 .group = FIO_OPT_G_INVALID,
4306 },
214e1eca
JA
4307 {
4308 .name = "exitall",
e8b0e958 4309 .lname = "Exit-all on terminate",
214e1eca
JA
4310 .type = FIO_OPT_STR_SET,
4311 .cb = str_exitall_cb,
4312 .help = "Terminate all jobs when one exits",
e8b0e958 4313 .category = FIO_OPT_C_GENERAL,
a1f6afec 4314 .group = FIO_OPT_G_PROCESS,
214e1eca 4315 },
64402a8a
HW
4316 {
4317 .name = "exit_what",
4318 .lname = "What jobs to quit on terminate",
4319 .type = FIO_OPT_STR,
4320 .off1 = offsetof(struct thread_options, exit_what),
4321 .help = "Fine-grained control for exitall",
4322 .def = "group",
4323 .category = FIO_OPT_C_GENERAL,
4324 .group = FIO_OPT_G_PROCESS,
4325 .posval = {
4326 { .ival = "group",
4327 .oval = TERMINATE_GROUP,
4328 .help = "exit_all=1 default behaviour",
4329 },
4330 { .ival = "stonewall",
4331 .oval = TERMINATE_STONEWALL,
4332 .help = "quit all currently running jobs; continue with next stonewall",
4333 },
4334 { .ival = "all",
4335 .oval = TERMINATE_ALL,
4336 .help = "Quit everything",
4337 },
4338 },
4339 },
f9cafb12
JA
4340 {
4341 .name = "exitall_on_error",
4342 .lname = "Exit-all on terminate in error",
78abcf9b 4343 .type = FIO_OPT_STR_SET,
a609f12a 4344 .off1 = offsetof(struct thread_options, exitall_error),
f9cafb12
JA
4345 .help = "Terminate all jobs when one exits in error",
4346 .category = FIO_OPT_C_GENERAL,
4347 .group = FIO_OPT_G_PROCESS,
4348 },
214e1eca
JA
4349 {
4350 .name = "stonewall",
e8b0e958 4351 .lname = "Wait for previous",
d392365e 4352 .alias = "wait_for_previous",
214e1eca 4353 .type = FIO_OPT_STR_SET,
a609f12a 4354 .off1 = offsetof(struct thread_options, stonewall),
214e1eca 4355 .help = "Insert a hard barrier between this job and previous",
e8b0e958 4356 .category = FIO_OPT_C_GENERAL,
a1f6afec 4357 .group = FIO_OPT_G_PROCESS,
214e1eca 4358 },
b3d62a75
JA
4359 {
4360 .name = "new_group",
e8b0e958 4361 .lname = "New group",
b3d62a75 4362 .type = FIO_OPT_STR_SET,
a609f12a 4363 .off1 = offsetof(struct thread_options, new_group),
b3d62a75 4364 .help = "Mark the start of a new group (for reporting)",
e8b0e958 4365 .category = FIO_OPT_C_GENERAL,
a1f6afec 4366 .group = FIO_OPT_G_PROCESS,
b3d62a75 4367 },
214e1eca
JA
4368 {
4369 .name = "thread",
e8b0e958 4370 .lname = "Thread",
214e1eca 4371 .type = FIO_OPT_STR_SET,
a609f12a 4372 .off1 = offsetof(struct thread_options, use_thread),
20eb06bd 4373 .help = "Use threads instead of processes",
c8931876
JA
4374#ifdef CONFIG_NO_SHM
4375 .def = "1",
4376 .no_warn_def = 1,
4377#endif
e8b0e958 4378 .category = FIO_OPT_C_GENERAL,
a1f6afec 4379 .group = FIO_OPT_G_PROCESS,
214e1eca 4380 },
3a5db920
JA
4381 {
4382 .name = "per_job_logs",
cce2fdfe 4383 .lname = "Per Job Logs",
3a5db920 4384 .type = FIO_OPT_BOOL,
a609f12a 4385 .off1 = offsetof(struct thread_options, per_job_logs),
3a5db920
JA
4386 .help = "Include job number in generated log files or not",
4387 .def = "1",
4388 .category = FIO_OPT_C_LOG,
4389 .group = FIO_OPT_G_INVALID,
4390 },
214e1eca
JA
4391 {
4392 .name = "write_bw_log",
e8b0e958 4393 .lname = "Write bandwidth log",
dded427c 4394 .type = FIO_OPT_STR,
a609f12a 4395 .off1 = offsetof(struct thread_options, bw_log_file),
dded427c 4396 .cb = str_write_bw_log_cb,
214e1eca 4397 .help = "Write log of bandwidth during run",
e8b0e958
JA
4398 .category = FIO_OPT_C_LOG,
4399 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4400 },
4401 {
4402 .name = "write_lat_log",
e8b0e958 4403 .lname = "Write latency log",
dded427c 4404 .type = FIO_OPT_STR,
a609f12a 4405 .off1 = offsetof(struct thread_options, lat_log_file),
dded427c 4406 .cb = str_write_lat_log_cb,
214e1eca 4407 .help = "Write log of latency during run",
e8b0e958
JA
4408 .category = FIO_OPT_C_LOG,
4409 .group = FIO_OPT_G_INVALID,
214e1eca 4410 },
c8eeb9df
JA
4411 {
4412 .name = "write_iops_log",
e8b0e958 4413 .lname = "Write IOPS log",
dded427c 4414 .type = FIO_OPT_STR,
a609f12a 4415 .off1 = offsetof(struct thread_options, iops_log_file),
dded427c 4416 .cb = str_write_iops_log_cb,
c8eeb9df 4417 .help = "Write log of IOPS during run",
e8b0e958
JA
4418 .category = FIO_OPT_C_LOG,
4419 .group = FIO_OPT_G_INVALID,
c8eeb9df 4420 },
0a852a50
DLM
4421 {
4422 .name = "log_entries",
4423 .lname = "Log entries",
4424 .type = FIO_OPT_INT,
4425 .off1 = offsetof(struct thread_options, log_entries),
4426 .help = "Initial number of entries in a job IO log",
4427 .def = __fio_stringify(DEF_LOG_ENTRIES),
4428 .minval = DEF_LOG_ENTRIES,
4429 .maxval = MAX_LOG_ENTRIES,
4430 .category = FIO_OPT_C_LOG,
4431 .group = FIO_OPT_G_INVALID,
4432 },
b8bc8cba
JA
4433 {
4434 .name = "log_avg_msec",
e8b0e958 4435 .lname = "Log averaging (msec)",
b8bc8cba 4436 .type = FIO_OPT_INT,
a609f12a 4437 .off1 = offsetof(struct thread_options, log_avg_msec),
b8bc8cba
JA
4438 .help = "Average bw/iops/lat logs over this period of time",
4439 .def = "0",
e8b0e958 4440 .category = FIO_OPT_C_LOG,
1e613c9c
KC
4441 .group = FIO_OPT_G_INVALID,
4442 },
4443 {
4444 .name = "log_hist_msec",
4445 .lname = "Log histograms (msec)",
4446 .type = FIO_OPT_INT,
a609f12a 4447 .off1 = offsetof(struct thread_options, log_hist_msec),
1e613c9c
KC
4448 .help = "Dump completion latency histograms at frequency of this time value",
4449 .def = "0",
4450 .category = FIO_OPT_C_LOG,
4451 .group = FIO_OPT_G_INVALID,
4452 },
4453 {
4454 .name = "log_hist_coarseness",
4455 .lname = "Histogram logs coarseness",
4456 .type = FIO_OPT_INT,
a609f12a 4457 .off1 = offsetof(struct thread_options, log_hist_coarseness),
1e613c9c
KC
4458 .help = "Integer in range [0,6]. Higher coarseness outputs"
4459 " fewer histogram bins per sample. The number of bins for"
4460 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4461 .def = "0",
4462 .category = FIO_OPT_C_LOG,
4463 .group = FIO_OPT_G_INVALID,
4464 },
4465 {
4466 .name = "write_hist_log",
4467 .lname = "Write latency histogram logs",
dded427c 4468 .type = FIO_OPT_STR,
a609f12a 4469 .off1 = offsetof(struct thread_options, hist_log_file),
dded427c 4470 .cb = str_write_hist_log_cb,
1e613c9c
KC
4471 .help = "Write log of latency histograms during run",
4472 .category = FIO_OPT_C_LOG,
e8b0e958 4473 .group = FIO_OPT_G_INVALID,
b8bc8cba 4474 },
e6989e10
JA
4475 {
4476 .name = "log_max_value",
4477 .lname = "Log maximum instead of average",
4478 .type = FIO_OPT_BOOL,
a609f12a 4479 .off1 = offsetof(struct thread_options, log_max),
e6989e10
JA
4480 .help = "Log max sample in a window instead of average",
4481 .def = "0",
4482 .category = FIO_OPT_C_LOG,
4483 .group = FIO_OPT_G_INVALID,
4484 },
ae588852
JA
4485 {
4486 .name = "log_offset",
4487 .lname = "Log offset of IO",
4488 .type = FIO_OPT_BOOL,
a609f12a 4489 .off1 = offsetof(struct thread_options, log_offset),
ae588852
JA
4490 .help = "Include offset of IO for each log entry",
4491 .def = "0",
4492 .category = FIO_OPT_C_LOG,
4493 .group = FIO_OPT_G_INVALID,
4494 },
03ec570f
DLM
4495 {
4496 .name = "log_prio",
4497 .lname = "Log priority of IO",
4498 .type = FIO_OPT_BOOL,
4499 .off1 = offsetof(struct thread_options, log_prio),
4500 .help = "Include priority value of IO for each log entry",
4501 .def = "0",
4502 .category = FIO_OPT_C_LOG,
4503 .group = FIO_OPT_G_INVALID,
4504 },
aee2ab67
JA
4505#ifdef CONFIG_ZLIB
4506 {
4507 .name = "log_compression",
4508 .lname = "Log compression",
4509 .type = FIO_OPT_INT,
a609f12a 4510 .off1 = offsetof(struct thread_options, log_gz),
aee2ab67 4511 .help = "Log in compressed chunks of this size",
9919b27b 4512 .minval = 1024ULL,
aee2ab67
JA
4513 .maxval = 512 * 1024 * 1024ULL,
4514 .category = FIO_OPT_C_LOG,
4515 .group = FIO_OPT_G_INVALID,
4516 },
c08f9fe2
JA
4517#ifdef FIO_HAVE_CPU_AFFINITY
4518 {
4519 .name = "log_compression_cpus",
4520 .lname = "Log Compression CPUs",
4521 .type = FIO_OPT_STR,
4522 .cb = str_log_cpus_allowed_cb,
a609f12a 4523 .off1 = offsetof(struct thread_options, log_gz_cpumask),
c08f9fe2
JA
4524 .parent = "log_compression",
4525 .help = "Limit log compression to these CPUs",
4526 .category = FIO_OPT_C_LOG,
4527 .group = FIO_OPT_G_INVALID,
4528 },
a275c37a
JA
4529#else
4530 {
4531 .name = "log_compression_cpus",
4532 .lname = "Log Compression CPUs",
4533 .type = FIO_OPT_UNSUPPORTED,
4534 .help = "Your platform does not support CPU affinities",
4535 },
c08f9fe2 4536#endif
b26317c9
JA
4537 {
4538 .name = "log_store_compressed",
4539 .lname = "Log store compressed",
4540 .type = FIO_OPT_BOOL,
a609f12a 4541 .off1 = offsetof(struct thread_options, log_gz_store),
b26317c9
JA
4542 .help = "Store logs in a compressed format",
4543 .category = FIO_OPT_C_LOG,
4544 .group = FIO_OPT_G_INVALID,
4545 },
a275c37a
JA
4546#else
4547 {
4548 .name = "log_compression",
4549 .lname = "Log compression",
4550 .type = FIO_OPT_UNSUPPORTED,
4551 .help = "Install libz-dev(el) to get compression support",
4552 },
4553 {
4554 .name = "log_store_compressed",
4555 .lname = "Log store compressed",
4556 .type = FIO_OPT_UNSUPPORTED,
4557 .help = "Install libz-dev(el) to get compression support",
4558 },
aee2ab67 4559#endif
3aea75b1
KC
4560 {
4561 .name = "log_unix_epoch",
4562 .lname = "Log epoch unix",
4563 .type = FIO_OPT_BOOL,
4564 .off1 = offsetof(struct thread_options, log_unix_epoch),
4565 .help = "Use Unix time in log files",
4566 .category = FIO_OPT_C_LOG,
4567 .group = FIO_OPT_G_INVALID,
4568 },
d5b3cfd4 4569 {
4570 .name = "log_alternate_epoch",
4571 .lname = "Log epoch alternate",
4572 .type = FIO_OPT_BOOL,
4573 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4574 .help = "Use alternate epoch time in log files. Uses the same epoch as that is used by clock_gettime with specified log_alternate_epoch_clock_id.",
4575 .category = FIO_OPT_C_LOG,
4576 .group = FIO_OPT_G_INVALID,
4577 },
4578 {
4579 .name = "log_alternate_epoch_clock_id",
4580 .lname = "Log alternate epoch clock_id",
4581 .type = FIO_OPT_INT,
4582 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4583 .help = "If log_alternate_epoch or log_unix_epoch is true, this option specifies the clock_id from clock_gettime whose epoch should be used. If neither of those is true, this option has no effect. Default value is 0, or CLOCK_REALTIME",
4584 .category = FIO_OPT_C_LOG,
4585 .group = FIO_OPT_G_INVALID,
4586 },
66347cfa
DE
4587 {
4588 .name = "block_error_percentiles",
4589 .lname = "Block error percentiles",
4590 .type = FIO_OPT_BOOL,
a609f12a 4591 .off1 = offsetof(struct thread_options, block_error_hist),
66347cfa
DE
4592 .help = "Record trim block errors and make a histogram",
4593 .def = "0",
4594 .category = FIO_OPT_C_LOG,
4595 .group = FIO_OPT_G_INVALID,
4596 },
c504ee55
JA
4597 {
4598 .name = "bwavgtime",
4599 .lname = "Bandwidth average time",
4600 .type = FIO_OPT_INT,
a609f12a 4601 .off1 = offsetof(struct thread_options, bw_avg_time),
c504ee55
JA
4602 .help = "Time window over which to calculate bandwidth"
4603 " (msec)",
4604 .def = "500",
4605 .parent = "write_bw_log",
4606 .hide = 1,
4607 .interval = 100,
4608 .category = FIO_OPT_C_LOG,
4609 .group = FIO_OPT_G_INVALID,
4610 },
4611 {
4612 .name = "iopsavgtime",
4613 .lname = "IOPS average time",
4614 .type = FIO_OPT_INT,
a609f12a 4615 .off1 = offsetof(struct thread_options, iops_avg_time),
c504ee55
JA
4616 .help = "Time window over which to calculate IOPS (msec)",
4617 .def = "500",
4618 .parent = "write_iops_log",
4619 .hide = 1,
4620 .interval = 100,
4621 .category = FIO_OPT_C_LOG,
4622 .group = FIO_OPT_G_INVALID,
4623 },
214e1eca
JA
4624 {
4625 .name = "group_reporting",
e8b0e958 4626 .lname = "Group reporting",
d2507043 4627 .type = FIO_OPT_STR_SET,
a609f12a 4628 .off1 = offsetof(struct thread_options, group_reporting),
214e1eca 4629 .help = "Do reporting on a per-group basis",
10860056 4630 .category = FIO_OPT_C_STAT,
e8b0e958 4631 .group = FIO_OPT_G_INVALID,
214e1eca 4632 },
8243be59
JA
4633 {
4634 .name = "stats",
4635 .lname = "Stats",
4636 .type = FIO_OPT_BOOL,
4637 .off1 = offsetof(struct thread_options, stats),
4638 .help = "Enable collection of stats",
4639 .def = "1",
4640 .category = FIO_OPT_C_STAT,
4641 .group = FIO_OPT_G_INVALID,
4642 },
e9459e5a
JA
4643 {
4644 .name = "zero_buffers",
e8b0e958 4645 .lname = "Zero I/O buffers",
e9459e5a 4646 .type = FIO_OPT_STR_SET,
a609f12a 4647 .off1 = offsetof(struct thread_options, zero_buffers),
e9459e5a 4648 .help = "Init IO buffers to all zeroes",
e8b0e958 4649 .category = FIO_OPT_C_IO,
3ceb458f 4650 .group = FIO_OPT_G_IO_BUF,
e9459e5a 4651 },
5973cafb
JA
4652 {
4653 .name = "refill_buffers",
e8b0e958 4654 .lname = "Refill I/O buffers",
5973cafb 4655 .type = FIO_OPT_STR_SET,
a609f12a 4656 .off1 = offsetof(struct thread_options, refill_buffers),
5973cafb 4657 .help = "Refill IO buffers on every IO submit",
e8b0e958 4658 .category = FIO_OPT_C_IO,
3ceb458f 4659 .group = FIO_OPT_G_IO_BUF,
5973cafb 4660 },
fd68418e
JA
4661 {
4662 .name = "scramble_buffers",
e8b0e958 4663 .lname = "Scramble I/O buffers",
fd68418e 4664 .type = FIO_OPT_BOOL,
a609f12a 4665 .off1 = offsetof(struct thread_options, scramble_buffers),
fd68418e
JA
4666 .help = "Slightly scramble buffers on every IO submit",
4667 .def = "1",
e8b0e958 4668 .category = FIO_OPT_C_IO,
3ceb458f 4669 .group = FIO_OPT_G_IO_BUF,
fd68418e 4670 },
ce35b1ec
JA
4671 {
4672 .name = "buffer_pattern",
4673 .lname = "Buffer pattern",
4674 .type = FIO_OPT_STR,
4675 .cb = str_buffer_pattern_cb,
a609f12a 4676 .off1 = offsetof(struct thread_options, buffer_pattern),
ce35b1ec
JA
4677 .help = "Fill pattern for IO buffers",
4678 .category = FIO_OPT_C_IO,
4679 .group = FIO_OPT_G_IO_BUF,
4680 },
9c42684e
JA
4681 {
4682 .name = "buffer_compress_percentage",
e8b0e958 4683 .lname = "Buffer compression percentage",
9c42684e 4684 .type = FIO_OPT_INT,
bedc9dc2 4685 .cb = str_buffer_compress_cb,
a609f12a 4686 .off1 = offsetof(struct thread_options, compress_percentage),
9c42684e 4687 .maxval = 100,
e7f5de90 4688 .minval = 0,
9c42684e 4689 .help = "How compressible the buffer is (approximately)",
20eb06bd 4690 .interval = 5,
e8b0e958 4691 .category = FIO_OPT_C_IO,
3ceb458f 4692 .group = FIO_OPT_G_IO_BUF,
9c42684e 4693 },
f97a43a1
JA
4694 {
4695 .name = "buffer_compress_chunk",
e8b0e958 4696 .lname = "Buffer compression chunk size",
f97a43a1 4697 .type = FIO_OPT_INT,
a609f12a 4698 .off1 = offsetof(struct thread_options, compress_chunk),
207b18e4 4699 .parent = "buffer_compress_percentage",
d71c154c 4700 .hide = 1,
f97a43a1 4701 .help = "Size of compressible region in buffer",
1de80624 4702 .def = "512",
20eb06bd 4703 .interval = 256,
e8b0e958 4704 .category = FIO_OPT_C_IO,
3ceb458f 4705 .group = FIO_OPT_G_IO_BUF,
f97a43a1 4706 },
5c94b008
JA
4707 {
4708 .name = "dedupe_percentage",
4709 .lname = "Dedupe percentage",
4710 .type = FIO_OPT_INT,
4711 .cb = str_dedupe_cb,
a609f12a 4712 .off1 = offsetof(struct thread_options, dedupe_percentage),
5c94b008
JA
4713 .maxval = 100,
4714 .minval = 0,
4715 .help = "Percentage of buffers that are dedupable",
4716 .interval = 1,
4717 .category = FIO_OPT_C_IO,
4718 .group = FIO_OPT_G_IO_BUF,
4719 },
c49cfc76
BD
4720 {
4721 .name = "dedupe_global",
4722 .lname = "Global deduplication",
4723 .type = FIO_OPT_BOOL,
4724 .off1 = offsetof(struct thread_options, dedupe_global),
4725 .help = "Share deduplication buffers across jobs",
4726 .def = "0",
4727 .category = FIO_OPT_C_IO,
4728 .group = FIO_OPT_G_IO_BUF,
4729 },
0d71aa98
BD
4730 {
4731 .name = "dedupe_mode",
4732 .lname = "Dedupe mode",
4733 .help = "Mode for the deduplication buffer generation",
4734 .type = FIO_OPT_STR,
4735 .off1 = offsetof(struct thread_options, dedupe_mode),
4736 .parent = "dedupe_percentage",
4737 .def = "repeat",
4738 .category = FIO_OPT_C_IO,
4739 .group = FIO_OPT_G_IO_BUF,
4740 .posval = {
4741 { .ival = "repeat",
4742 .oval = DEDUPE_MODE_REPEAT,
4743 .help = "repeat previous page",
4744 },
4745 { .ival = "working_set",
4746 .oval = DEDUPE_MODE_WORKING_SET,
4747 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4748 },
4749 },
4750 },
4751 {
4752 .name = "dedupe_working_set_percentage",
4753 .lname = "Dedupe working set percentage",
4754 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4755 .type = FIO_OPT_INT,
4756 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4757 .parent = "dedupe_percentage",
4758 .def = "5",
4759 .maxval = 100,
4760 .minval = 0,
4761 .category = FIO_OPT_C_IO,
4762 .group = FIO_OPT_G_IO_BUF,
4763 },
83349190
YH
4764 {
4765 .name = "clat_percentiles",
e8b0e958 4766 .lname = "Completion latency percentiles",
83349190 4767 .type = FIO_OPT_BOOL,
a609f12a 4768 .off1 = offsetof(struct thread_options, clat_percentiles),
83349190 4769 .help = "Enable the reporting of completion latency percentiles",
467b35ed 4770 .def = "1",
b599759b
JA
4771 .category = FIO_OPT_C_STAT,
4772 .group = FIO_OPT_G_INVALID,
4773 },
4774 {
4775 .name = "lat_percentiles",
4776 .lname = "IO latency percentiles",
4777 .type = FIO_OPT_BOOL,
4778 .off1 = offsetof(struct thread_options, lat_percentiles),
4779 .help = "Enable the reporting of IO latency percentiles",
4780 .def = "0",
56440e63
VF
4781 .category = FIO_OPT_C_STAT,
4782 .group = FIO_OPT_G_INVALID,
4783 },
4784 {
4785 .name = "slat_percentiles",
4786 .lname = "Submission latency percentiles",
4787 .type = FIO_OPT_BOOL,
4788 .off1 = offsetof(struct thread_options, slat_percentiles),
4789 .help = "Enable the reporting of submission latency percentiles",
4790 .def = "0",
e8b0e958
JA
4791 .category = FIO_OPT_C_STAT,
4792 .group = FIO_OPT_G_INVALID,
83349190
YH
4793 },
4794 {
4795 .name = "percentile_list",
66347cfa 4796 .lname = "Percentile list",
83349190 4797 .type = FIO_OPT_FLOAT_LIST,
a609f12a
JA
4798 .off1 = offsetof(struct thread_options, percentile_list),
4799 .off2 = offsetof(struct thread_options, percentile_precision),
66347cfa
DE
4800 .help = "Specify a custom list of percentiles to report for "
4801 "completion latency and block errors",
fd112d34 4802 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
83349190
YH
4803 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4804 .minfp = 0.0,
4805 .maxfp = 100.0,
e8b0e958
JA
4806 .category = FIO_OPT_C_STAT,
4807 .group = FIO_OPT_G_INVALID,
e883cb35
JF
4808 },
4809 {
4810 .name = "significant_figures",
4811 .lname = "Significant figures",
4812 .type = FIO_OPT_INT,
4813 .off1 = offsetof(struct thread_options, sig_figs),
4814 .maxval = 10,
4815 .minval = 1,
4816 .help = "Significant figures for output-format set to normal",
4817 .def = "4",
4818 .interval = 1,
4819 .category = FIO_OPT_C_STAT,
4820 .group = FIO_OPT_G_INVALID,
83349190
YH
4821 },
4822
0a839f30
JA
4823#ifdef FIO_HAVE_DISK_UTIL
4824 {
4825 .name = "disk_util",
e8b0e958 4826 .lname = "Disk utilization",
0a839f30 4827 .type = FIO_OPT_BOOL,
a609f12a 4828 .off1 = offsetof(struct thread_options, do_disk_util),
f66ab3c8 4829 .help = "Log disk utilization statistics",
0a839f30 4830 .def = "1",
e8b0e958
JA
4831 .category = FIO_OPT_C_STAT,
4832 .group = FIO_OPT_G_INVALID,
0a839f30 4833 },
a275c37a
JA
4834#else
4835 {
4836 .name = "disk_util",
4837 .lname = "Disk utilization",
4838 .type = FIO_OPT_UNSUPPORTED,
4839 .help = "Your platform does not support disk utilization",
4840 },
0a839f30 4841#endif
993bf48b
JA
4842 {
4843 .name = "gtod_reduce",
e8b0e958 4844 .lname = "Reduce gettimeofday() calls",
993bf48b
JA
4845 .type = FIO_OPT_BOOL,
4846 .help = "Greatly reduce number of gettimeofday() calls",
4847 .cb = str_gtod_reduce_cb,
4848 .def = "0",
a4ed77fe 4849 .hide_on_set = 1,
e8b0e958
JA
4850 .category = FIO_OPT_C_STAT,
4851 .group = FIO_OPT_G_INVALID,
993bf48b 4852 },
02af0988
JA
4853 {
4854 .name = "disable_lat",
e8b0e958 4855 .lname = "Disable all latency stats",
02af0988 4856 .type = FIO_OPT_BOOL,
a609f12a 4857 .off1 = offsetof(struct thread_options, disable_lat),
02af0988
JA
4858 .help = "Disable latency numbers",
4859 .parent = "gtod_reduce",
d71c154c 4860 .hide = 1,
02af0988 4861 .def = "0",
e8b0e958
JA
4862 .category = FIO_OPT_C_STAT,
4863 .group = FIO_OPT_G_INVALID,
02af0988 4864 },
9520ebb9
JA
4865 {
4866 .name = "disable_clat",
e8b0e958 4867 .lname = "Disable completion latency stats",
9520ebb9 4868 .type = FIO_OPT_BOOL,
a609f12a 4869 .off1 = offsetof(struct thread_options, disable_clat),
9520ebb9 4870 .help = "Disable completion latency numbers",
993bf48b 4871 .parent = "gtod_reduce",
d71c154c 4872 .hide = 1,
9520ebb9 4873 .def = "0",
e8b0e958
JA
4874 .category = FIO_OPT_C_STAT,
4875 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
4876 },
4877 {
4878 .name = "disable_slat",
e8b0e958 4879 .lname = "Disable submission latency stats",
9520ebb9 4880 .type = FIO_OPT_BOOL,
a609f12a 4881 .off1 = offsetof(struct thread_options, disable_slat),
03e20d68 4882 .help = "Disable submission latency numbers",
993bf48b 4883 .parent = "gtod_reduce",
d71c154c 4884 .hide = 1,
9520ebb9 4885 .def = "0",
e8b0e958
JA
4886 .category = FIO_OPT_C_STAT,
4887 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
4888 },
4889 {
4890 .name = "disable_bw_measurement",
afd2ceff 4891 .alias = "disable_bw",
e8b0e958 4892 .lname = "Disable bandwidth stats",
9520ebb9 4893 .type = FIO_OPT_BOOL,
a609f12a 4894 .off1 = offsetof(struct thread_options, disable_bw),
9520ebb9 4895 .help = "Disable bandwidth logging",
993bf48b 4896 .parent = "gtod_reduce",
d71c154c 4897 .hide = 1,
9520ebb9 4898 .def = "0",
e8b0e958
JA
4899 .category = FIO_OPT_C_STAT,
4900 .group = FIO_OPT_G_INVALID,
9520ebb9 4901 },
be4ecfdf
JA
4902 {
4903 .name = "gtod_cpu",
e8b0e958 4904 .lname = "Dedicated gettimeofday() CPU",
be4ecfdf 4905 .type = FIO_OPT_INT,
a609f12a 4906 .off1 = offsetof(struct thread_options, gtod_cpu),
03e20d68 4907 .help = "Set up dedicated gettimeofday() thread on this CPU",
29d43ff9 4908 .verify = gtod_cpu_verify,
e8b0e958 4909 .category = FIO_OPT_C_GENERAL,
10860056 4910 .group = FIO_OPT_G_CLOCK,
be4ecfdf 4911 },
771e58be
JA
4912 {
4913 .name = "unified_rw_reporting",
cce2fdfe 4914 .lname = "Unified RW Reporting",
5cb8a8cd 4915 .type = FIO_OPT_STR,
a609f12a 4916 .off1 = offsetof(struct thread_options, unified_rw_rep),
771e58be 4917 .help = "Unify reporting across data direction",
5cb8a8cd 4918 .def = "none",
90b7a96d
JA
4919 .category = FIO_OPT_C_GENERAL,
4920 .group = FIO_OPT_G_INVALID,
5cb8a8cd
BP
4921 .posval = {
4922 { .ival = "none",
4923 .oval = UNIFIED_SPLIT,
4924 .help = "Normal statistics reporting",
4925 },
4926 { .ival = "mixed",
4927 .oval = UNIFIED_MIXED,
4928 .help = "Statistics are summed per data direction and reported together",
4929 },
4930 { .ival = "both",
4931 .oval = UNIFIED_BOTH,
4932 .help = "Statistics are reported normally, followed by the mixed statistics"
4933 },
4934 /* Compatibility with former boolean values */
4935 { .ival = "0",
4936 .oval = UNIFIED_SPLIT,
4937 .help = "Alias for 'none'",
4938 },
4939 { .ival = "1",
4940 .oval = UNIFIED_MIXED,
4941 .help = "Alias for 'mixed'",
4942 },
4943 { .ival = "2",
4944 .oval = UNIFIED_BOTH,
4945 .help = "Alias for 'both'",
4946 },
4947 },
771e58be 4948 },
f2bba182
RR
4949 {
4950 .name = "continue_on_error",
e8b0e958 4951 .lname = "Continue on error",
06842027 4952 .type = FIO_OPT_STR,
a609f12a 4953 .off1 = offsetof(struct thread_options, continue_on_error),
03e20d68 4954 .help = "Continue on non-fatal errors during IO",
06842027 4955 .def = "none",
e8b0e958 4956 .category = FIO_OPT_C_GENERAL,
bc3f552f 4957 .group = FIO_OPT_G_ERR,
06842027
SL
4958 .posval = {
4959 { .ival = "none",
4960 .oval = ERROR_TYPE_NONE,
4961 .help = "Exit when an error is encountered",
4962 },
4963 { .ival = "read",
4964 .oval = ERROR_TYPE_READ,
4965 .help = "Continue on read errors only",
4966 },
4967 { .ival = "write",
4968 .oval = ERROR_TYPE_WRITE,
4969 .help = "Continue on write errors only",
4970 },
4971 { .ival = "io",
4972 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4973 .help = "Continue on any IO errors",
4974 },
4975 { .ival = "verify",
4976 .oval = ERROR_TYPE_VERIFY,
4977 .help = "Continue on verify errors only",
4978 },
4979 { .ival = "all",
4980 .oval = ERROR_TYPE_ANY,
4981 .help = "Continue on all io and verify errors",
4982 },
4983 { .ival = "0",
4984 .oval = ERROR_TYPE_NONE,
4985 .help = "Alias for 'none'",
4986 },
4987 { .ival = "1",
4988 .oval = ERROR_TYPE_ANY,
4989 .help = "Alias for 'all'",
4990 },
4991 },
f2bba182 4992 },
8b28bd41
DM
4993 {
4994 .name = "ignore_error",
cce2fdfe 4995 .lname = "Ignore Error",
8b28bd41
DM
4996 .type = FIO_OPT_STR,
4997 .cb = str_ignore_error_cb,
a609f12a 4998 .off1 = offsetof(struct thread_options, ignore_error_nr),
8b28bd41
DM
4999 .help = "Set a specific list of errors to ignore",
5000 .parent = "rw",
a94eb99a 5001 .category = FIO_OPT_C_GENERAL,
bc3f552f 5002 .group = FIO_OPT_G_ERR,
8b28bd41
DM
5003 },
5004 {
5005 .name = "error_dump",
cce2fdfe 5006 .lname = "Error Dump",
8b28bd41 5007 .type = FIO_OPT_BOOL,
a609f12a 5008 .off1 = offsetof(struct thread_options, error_dump),
8b28bd41
DM
5009 .def = "0",
5010 .help = "Dump info on each error",
a94eb99a 5011 .category = FIO_OPT_C_GENERAL,
bc3f552f 5012 .group = FIO_OPT_G_ERR,
8b28bd41 5013 },
9ac8a797
JA
5014 {
5015 .name = "profile",
e8b0e958 5016 .lname = "Profile",
79d16311 5017 .type = FIO_OPT_STR_STORE,
a609f12a 5018 .off1 = offsetof(struct thread_options, profile),
9ac8a797 5019 .help = "Select a specific builtin performance test",
13fca827 5020 .category = FIO_OPT_C_PROFILE,
e8b0e958 5021 .group = FIO_OPT_G_INVALID,
9ac8a797 5022 },
a696fa2a
JA
5023 {
5024 .name = "cgroup",
e8b0e958 5025 .lname = "Cgroup",
a696fa2a 5026 .type = FIO_OPT_STR_STORE,
a609f12a 5027 .off1 = offsetof(struct thread_options, cgroup),
a696fa2a 5028 .help = "Add job to cgroup of this name",
e8b0e958 5029 .category = FIO_OPT_C_GENERAL,
a1f6afec
JA
5030 .group = FIO_OPT_G_CGROUP,
5031 },
5032 {
5033 .name = "cgroup_nodelete",
5034 .lname = "Cgroup no-delete",
5035 .type = FIO_OPT_BOOL,
a609f12a 5036 .off1 = offsetof(struct thread_options, cgroup_nodelete),
a1f6afec
JA
5037 .help = "Do not delete cgroups after job completion",
5038 .def = "0",
5039 .parent = "cgroup",
5040 .category = FIO_OPT_C_GENERAL,
5041 .group = FIO_OPT_G_CGROUP,
a696fa2a
JA
5042 },
5043 {
5044 .name = "cgroup_weight",
e8b0e958 5045 .lname = "Cgroup weight",
a696fa2a 5046 .type = FIO_OPT_INT,
a609f12a 5047 .off1 = offsetof(struct thread_options, cgroup_weight),
a696fa2a
JA
5048 .help = "Use given weight for cgroup",
5049 .minval = 100,
5050 .maxval = 1000,
a1f6afec 5051 .parent = "cgroup",
e8b0e958 5052 .category = FIO_OPT_C_GENERAL,
a1f6afec 5053 .group = FIO_OPT_G_CGROUP,
7de87099 5054 },
e0b0d892
JA
5055 {
5056 .name = "uid",
e8b0e958 5057 .lname = "User ID",
e0b0d892 5058 .type = FIO_OPT_INT,
a609f12a 5059 .off1 = offsetof(struct thread_options, uid),
e0b0d892 5060 .help = "Run job with this user ID",
e8b0e958 5061 .category = FIO_OPT_C_GENERAL,
10860056 5062 .group = FIO_OPT_G_CRED,
e0b0d892
JA
5063 },
5064 {
5065 .name = "gid",
e8b0e958 5066 .lname = "Group ID",
e0b0d892 5067 .type = FIO_OPT_INT,
a609f12a 5068 .off1 = offsetof(struct thread_options, gid),
e0b0d892 5069 .help = "Run job with this group ID",
e8b0e958 5070 .category = FIO_OPT_C_GENERAL,
10860056 5071 .group = FIO_OPT_G_CRED,
e0b0d892 5072 },
a1f6afec
JA
5073 {
5074 .name = "kb_base",
5075 .lname = "KB Base",
41dd12d6 5076 .type = FIO_OPT_STR,
a609f12a 5077 .off1 = offsetof(struct thread_options, kb_base),
a1f6afec
JA
5078 .prio = 1,
5079 .def = "1024",
ba9c7219
JA
5080 .posval = {
5081 { .ival = "1024",
5082 .oval = 1024,
d694a6a7 5083 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
ba9c7219
JA
5084 },
5085 { .ival = "1000",
5086 .oval = 1000,
d694a6a7 5087 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
ba9c7219
JA
5088 },
5089 },
d694a6a7 5090 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
a1f6afec
JA
5091 .category = FIO_OPT_C_GENERAL,
5092 .group = FIO_OPT_G_INVALID,
5093 },
cf3a0518
JA
5094 {
5095 .name = "unit_base",
d694a6a7 5096 .lname = "Unit for quantities of data (Bits or Bytes)",
92a1a1d7 5097 .type = FIO_OPT_STR,
a609f12a 5098 .off1 = offsetof(struct thread_options, unit_base),
cf3a0518 5099 .prio = 1,
71a08258
JA
5100 .posval = {
5101 { .ival = "0",
41a87019 5102 .oval = N2S_NONE,
71a08258
JA
5103 .help = "Auto-detect",
5104 },
5105 { .ival = "8",
41a87019 5106 .oval = N2S_BYTEPERSEC,
71a08258
JA
5107 .help = "Normal (byte based)",
5108 },
5109 { .ival = "1",
41a87019 5110 .oval = N2S_BITPERSEC,
71a08258
JA
5111 .help = "Bit based",
5112 },
5113 },
cf3a0518
JA
5114 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5115 .category = FIO_OPT_C_GENERAL,
5116 .group = FIO_OPT_G_INVALID,
5117 },
3ceb458f
JA
5118 {
5119 .name = "hugepage-size",
5120 .lname = "Hugepage size",
5121 .type = FIO_OPT_INT,
a609f12a 5122 .off1 = offsetof(struct thread_options, hugepage_size),
3ceb458f
JA
5123 .help = "When using hugepages, specify size of each page",
5124 .def = __fio_stringify(FIO_HUGE_PAGE),
5125 .interval = 1024 * 1024,
5126 .category = FIO_OPT_C_GENERAL,
5127 .group = FIO_OPT_G_INVALID,
5128 },
9e684a49
DE
5129 {
5130 .name = "flow_id",
e8b0e958 5131 .lname = "I/O flow ID",
9e684a49 5132 .type = FIO_OPT_INT,
a609f12a 5133 .off1 = offsetof(struct thread_options, flow_id),
9e684a49
DE
5134 .help = "The flow index ID to use",
5135 .def = "0",
e8b0e958
JA
5136 .category = FIO_OPT_C_IO,
5137 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
5138 },
5139 {
5140 .name = "flow",
e8b0e958 5141 .lname = "I/O flow weight",
20c7a244 5142 .type = FIO_OPT_INT,
a609f12a 5143 .off1 = offsetof(struct thread_options, flow),
9e684a49
DE
5144 .help = "Weight for flow control of this job",
5145 .parent = "flow_id",
d71c154c 5146 .hide = 1,
9e684a49 5147 .def = "0",
d4e74fda 5148 .maxval = FLOW_MAX_WEIGHT,
e8b0e958
JA
5149 .category = FIO_OPT_C_IO,
5150 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
5151 },
5152 {
5153 .name = "flow_watermark",
e8b0e958 5154 .lname = "I/O flow watermark",
d4e74fda 5155 .type = FIO_OPT_SOFT_DEPRECATED,
e8b0e958
JA
5156 .category = FIO_OPT_C_IO,
5157 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
5158 },
5159 {
5160 .name = "flow_sleep",
e8b0e958 5161 .lname = "I/O flow sleep",
9e684a49 5162 .type = FIO_OPT_INT,
a609f12a 5163 .off1 = offsetof(struct thread_options, flow_sleep),
9e684a49
DE
5164 .help = "How many microseconds to sleep after being held"
5165 " back by the flow control mechanism",
5166 .parent = "flow_id",
d71c154c 5167 .hide = 1,
9e684a49 5168 .def = "0",
e8b0e958
JA
5169 .category = FIO_OPT_C_IO,
5170 .group = FIO_OPT_G_IO_FLOW,
9e684a49 5171 },
16e56d25
VF
5172 {
5173 .name = "steadystate",
5174 .lname = "Steady state threshold",
5175 .alias = "ss",
5176 .type = FIO_OPT_STR,
2c5d94bc 5177 .off1 = offsetof(struct thread_options, ss_state),
16e56d25
VF
5178 .cb = str_steadystate_cb,
5179 .help = "Define the criterion and limit to judge when a job has reached steady state",
5180 .def = "iops_slope:0.01%",
5181 .posval = {
5182 { .ival = "iops",
f0c50c66 5183 .oval = FIO_SS_IOPS,
16e56d25
VF
5184 .help = "maximum mean deviation of IOPS measurements",
5185 },
5186 { .ival = "iops_slope",
f0c50c66 5187 .oval = FIO_SS_IOPS_SLOPE,
16e56d25
VF
5188 .help = "slope calculated from IOPS measurements",
5189 },
5190 { .ival = "bw",
f0c50c66 5191 .oval = FIO_SS_BW,
16e56d25
VF
5192 .help = "maximum mean deviation of bandwidth measurements",
5193 },
5194 {
5195 .ival = "bw_slope",
f0c50c66 5196 .oval = FIO_SS_BW_SLOPE,
16e56d25
VF
5197 .help = "slope calculated from bandwidth measurements",
5198 },
5199 },
5200 .category = FIO_OPT_C_GENERAL,
5201 .group = FIO_OPT_G_RUNTIME,
5202 },
5203 {
5204 .name = "steadystate_duration",
5205 .lname = "Steady state duration",
5206 .alias = "ss_dur",
915ca980 5207 .parent = "steadystate",
16e56d25
VF
5208 .type = FIO_OPT_STR_VAL_TIME,
5209 .off1 = offsetof(struct thread_options, ss_dur),
5210 .help = "Stop workload upon attaining steady state for specified duration",
5211 .def = "0",
5212 .is_seconds = 1,
5213 .is_time = 1,
5214 .category = FIO_OPT_C_GENERAL,
5215 .group = FIO_OPT_G_RUNTIME,
5216 },
5217 {
5218 .name = "steadystate_ramp_time",
5219 .lname = "Steady state ramp time",
5220 .alias = "ss_ramp",
915ca980 5221 .parent = "steadystate",
16e56d25
VF
5222 .type = FIO_OPT_STR_VAL_TIME,
5223 .off1 = offsetof(struct thread_options, ss_ramp_time),
5224 .help = "Delay before initiation of data collection for steady state job termination testing",
5225 .def = "0",
5226 .is_seconds = 1,
5227 .is_time = 1,
5228 .category = FIO_OPT_C_GENERAL,
5229 .group = FIO_OPT_G_RUNTIME,
5230 },
214e1eca
JA
5231 {
5232 .name = NULL,
5233 },
5234};
5235
17af15d4 5236static void add_to_lopt(struct option *lopt, struct fio_option *o,
de890a1e 5237 const char *name, int val)
9f81736c 5238{
17af15d4 5239 lopt->name = (char *) name;
de890a1e 5240 lopt->val = val;
9f81736c 5241 if (o->type == FIO_OPT_STR_SET)
ff52be3d 5242 lopt->has_arg = optional_argument;
9f81736c
JA
5243 else
5244 lopt->has_arg = required_argument;
5245}
5246
de890a1e
SL
5247static void options_to_lopts(struct fio_option *opts,
5248 struct option *long_options,
5249 int i, int option_type)
214e1eca 5250{
de890a1e 5251 struct fio_option *o = &opts[0];
214e1eca 5252 while (o->name) {
de890a1e 5253 add_to_lopt(&long_options[i], o, o->name, option_type);
17af15d4
JA
5254 if (o->alias) {
5255 i++;
de890a1e 5256 add_to_lopt(&long_options[i], o, o->alias, option_type);
17af15d4 5257 }
214e1eca
JA
5258
5259 i++;
5260 o++;
5261 assert(i < FIO_NR_OPTIONS);
5262 }
5263}
5264
de890a1e
SL
5265void fio_options_set_ioengine_opts(struct option *long_options,
5266 struct thread_data *td)
5267{
5268 unsigned int i;
5269
5270 i = 0;
5271 while (long_options[i].name) {
5272 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5273 memset(&long_options[i], 0, sizeof(*long_options));
5274 break;
5275 }
5276 i++;
5277 }
5278
5279 /*
5280 * Just clear out the prior ioengine options.
5281 */
5282 if (!td || !td->eo)
5283 return;
5284
5285 options_to_lopts(td->io_ops->options, long_options, i,
5286 FIO_GETOPT_IOENGINE);
5287}
5288
5289void fio_options_dup_and_init(struct option *long_options)
5290{
5291 unsigned int i;
5292
9af4a244 5293 options_init(fio_options);
de890a1e
SL
5294
5295 i = 0;
5296 while (long_options[i].name)
5297 i++;
5298
9af4a244 5299 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
de890a1e
SL
5300}
5301
74929ac2
JA
5302struct fio_keyword {
5303 const char *word;
5304 const char *desc;
5305 char *replace;
5306};
5307
5308static struct fio_keyword fio_keywords[] = {
5309 {
5310 .word = "$pagesize",
5311 .desc = "Page size in the system",
5312 },
5313 {
5314 .word = "$mb_memory",
5315 .desc = "Megabytes of memory online",
5316 },
5317 {
5318 .word = "$ncpus",
5319 .desc = "Number of CPUs online in the system",
5320 },
5321 {
5322 .word = NULL,
5323 },
5324};
5325
af1dc266
JA
5326void fio_keywords_exit(void)
5327{
5328 struct fio_keyword *kw;
5329
5330 kw = &fio_keywords[0];
5331 while (kw->word) {
5332 free(kw->replace);
5333 kw->replace = NULL;
5334 kw++;
5335 }
5336}
5337
74929ac2
JA
5338void fio_keywords_init(void)
5339{
3b2e1464 5340 unsigned long long mb_memory;
74929ac2
JA
5341 char buf[128];
5342 long l;
5343
a4cfc477 5344 sprintf(buf, "%lu", (unsigned long) page_size);
74929ac2
JA
5345 fio_keywords[0].replace = strdup(buf);
5346
8eb016d3 5347 mb_memory = os_phys_mem() / (1024 * 1024);
3b2e1464 5348 sprintf(buf, "%llu", mb_memory);
74929ac2
JA
5349 fio_keywords[1].replace = strdup(buf);
5350
40f61ec7 5351 l = cpus_configured();
74929ac2
JA
5352 sprintf(buf, "%lu", l);
5353 fio_keywords[2].replace = strdup(buf);
5354}
5355
892a6ffc
JA
5356#define BC_APP "bc"
5357
5358static char *bc_calc(char *str)
5359{
d0c814ec 5360 char buf[128], *tmp;
892a6ffc
JA
5361 FILE *f;
5362 int ret;
5363
5364 /*
5365 * No math, just return string
5366 */
d0c814ec
SL
5367 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5368 !strchr(str, '/')) || strchr(str, '\''))
892a6ffc
JA
5369 return str;
5370
5371 /*
5372 * Split option from value, we only need to calculate the value
5373 */
5374 tmp = strchr(str, '=');
5375 if (!tmp)
5376 return str;
5377
5378 tmp++;
892a6ffc 5379
d0c814ec
SL
5380 /*
5381 * Prevent buffer overflows; such a case isn't reasonable anyway
5382 */
5383 if (strlen(str) >= 128 || strlen(tmp) > 100)
5384 return str;
892a6ffc
JA
5385
5386 sprintf(buf, "which %s > /dev/null", BC_APP);
5387 if (system(buf)) {
5388 log_err("fio: bc is needed for performing math\n");
892a6ffc
JA
5389 return NULL;
5390 }
5391
d0c814ec 5392 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
892a6ffc 5393 f = popen(buf, "r");
3c3ed070 5394 if (!f)
892a6ffc 5395 return NULL;
892a6ffc 5396
d0c814ec 5397 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
1d824f37
JA
5398 if (ret <= 0) {
5399 pclose(f);
892a6ffc 5400 return NULL;
1d824f37 5401 }
892a6ffc 5402
892a6ffc 5403 pclose(f);
d0c814ec
SL
5404 buf[(tmp - str) + ret - 1] = '\0';
5405 memcpy(buf, str, tmp - str);
892a6ffc 5406 free(str);
d0c814ec
SL
5407 return strdup(buf);
5408}
5409
5410/*
5411 * Return a copy of the input string with substrings of the form ${VARNAME}
5412 * substituted with the value of the environment variable VARNAME. The
5413 * substitution always occurs, even if VARNAME is empty or the corresponding
5414 * environment variable undefined.
5415 */
b4f5e72f 5416char *fio_option_dup_subs(const char *opt)
d0c814ec
SL
5417{
5418 char out[OPT_LEN_MAX+1];
5419 char in[OPT_LEN_MAX+1];
5420 char *outptr = out;
5421 char *inptr = in;
5422 char *ch1, *ch2, *env;
5423 ssize_t nchr = OPT_LEN_MAX;
5424 size_t envlen;
5425
5426 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5427 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5428 return NULL;
5429 }
5430
36833fb0 5431 snprintf(in, sizeof(in), "%s", opt);
d0c814ec
SL
5432
5433 while (*inptr && nchr > 0) {
5434 if (inptr[0] == '$' && inptr[1] == '{') {
5435 ch2 = strchr(inptr, '}');
5436 if (ch2 && inptr+1 < ch2) {
5437 ch1 = inptr+2;
5438 inptr = ch2+1;
5439 *ch2 = '\0';
5440
5441 env = getenv(ch1);
5442 if (env) {
5443 envlen = strlen(env);
5444 if (envlen <= nchr) {
5445 memcpy(outptr, env, envlen);
5446 outptr += envlen;
5447 nchr -= envlen;
5448 }
5449 }
5450
5451 continue;
5452 }
5453 }
5454
5455 *outptr++ = *inptr++;
5456 --nchr;
5457 }
5458
5459 *outptr = '\0';
5460 return strdup(out);
892a6ffc
JA
5461}
5462
74929ac2
JA
5463/*
5464 * Look for reserved variable names and replace them with real values
5465 */
5466static char *fio_keyword_replace(char *opt)
5467{
5468 char *s;
5469 int i;
d0c814ec 5470 int docalc = 0;
74929ac2
JA
5471
5472 for (i = 0; fio_keywords[i].word != NULL; i++) {
5473 struct fio_keyword *kw = &fio_keywords[i];
5474
5475 while ((s = strstr(opt, kw->word)) != NULL) {
33153428 5476 char *new = calloc(strlen(opt) + 1, 1);
74929ac2
JA
5477 char *o_org = opt;
5478 int olen = s - opt;
5479 int len;
5480
5481 /*
5482 * Copy part of the string before the keyword and
5483 * sprintf() the replacement after it.
5484 */
5485 memcpy(new, opt, olen);
5486 len = sprintf(new + olen, "%s", kw->replace);
5487
5488 /*
5489 * If there's more in the original string, copy that
5490 * in too
5491 */
85b9ee7e 5492 opt += olen + strlen(kw->word);
33153428 5493 /* keeps final zero thanks to calloc */
74929ac2 5494 if (strlen(opt))
85b9ee7e 5495 memcpy(new + olen + len, opt, strlen(opt));
74929ac2
JA
5496
5497 /*
5498 * replace opt and free the old opt
5499 */
5500 opt = new;
d0c814ec 5501 free(o_org);
7a958bd5 5502
d0c814ec 5503 docalc = 1;
74929ac2
JA
5504 }
5505 }
5506
d0c814ec
SL
5507 /*
5508 * Check for potential math and invoke bc, if possible
5509 */
5510 if (docalc)
5511 opt = bc_calc(opt);
5512
7a958bd5 5513 return opt;
74929ac2
JA
5514}
5515
d0c814ec
SL
5516static char **dup_and_sub_options(char **opts, int num_opts)
5517{
5518 int i;
5519 char **opts_copy = malloc(num_opts * sizeof(*opts));
5520 for (i = 0; i < num_opts; i++) {
b4f5e72f 5521 opts_copy[i] = fio_option_dup_subs(opts[i]);
d0c814ec
SL
5522 if (!opts_copy[i])
5523 continue;
5524 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5525 }
5526 return opts_copy;
5527}
5528
e15b023b 5529static void show_closest_option(const char *opt)
a2d027b9
JA
5530{
5531 int best_option, best_distance;
5532 int i, distance;
e15b023b
JA
5533 char *name;
5534
5535 if (!strlen(opt))
5536 return;
5537
5538 name = strdup(opt);
5539 i = 0;
5540 while (name[i] != '\0' && name[i] != '=')
5541 i++;
5542 name[i] = '\0';
a2d027b9
JA
5543
5544 best_option = -1;
5545 best_distance = INT_MAX;
5546 i = 0;
5547 while (fio_options[i].name) {
5548 distance = string_distance(name, fio_options[i].name);
5549 if (distance < best_distance) {
5550 best_distance = distance;
5551 best_option = i;
5552 }
5553 i++;
5554 }
5555
75e6bcba
JA
5556 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5557 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
a2d027b9 5558 log_err("Did you mean %s?\n", fio_options[best_option].name);
e15b023b
JA
5559
5560 free(name);
a2d027b9
JA
5561}
5562
c2292325 5563int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
214e1eca 5564{
de890a1e 5565 int i, ret, unknown;
d0c814ec 5566 char **opts_copy;
3b8b7135 5567
9af4a244 5568 sort_options(opts, fio_options, num_opts);
d0c814ec 5569 opts_copy = dup_and_sub_options(opts, num_opts);
3b8b7135 5570
de890a1e 5571 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
9109883a 5572 const struct fio_option *o;
9af4a244 5573 int newret = parse_option(opts_copy[i], opts[i], fio_options,
a609f12a 5574 &o, &td->o, &td->opt_list);
d0c814ec 5575
a8523a6a
JA
5576 if (!newret && o)
5577 fio_option_mark_set(&td->o, o);
5578
de890a1e
SL
5579 if (opts_copy[i]) {
5580 if (newret && !o) {
5581 unknown++;
5582 continue;
5583 }
d0c814ec 5584 free(opts_copy[i]);
de890a1e
SL
5585 opts_copy[i] = NULL;
5586 }
5587
5588 ret |= newret;
5589 }
5590
5591 if (unknown) {
5592 ret |= ioengine_load(td);
5593 if (td->eo) {
5594 sort_options(opts_copy, td->io_ops->options, num_opts);
5595 opts = opts_copy;
5596 }
5597 for (i = 0; i < num_opts; i++) {
9109883a 5598 const struct fio_option *o = NULL;
de890a1e 5599 int newret = 1;
a2d027b9 5600
de890a1e
SL
5601 if (!opts_copy[i])
5602 continue;
5603
5604 if (td->eo)
5605 newret = parse_option(opts_copy[i], opts[i],
5606 td->io_ops->options, &o,
66e19a38 5607 td->eo, &td->opt_list);
de890a1e
SL
5608
5609 ret |= newret;
a2d027b9 5610 if (!o) {
de890a1e 5611 log_err("Bad option <%s>\n", opts[i]);
a2d027b9
JA
5612 show_closest_option(opts[i]);
5613 }
de890a1e
SL
5614 free(opts_copy[i]);
5615 opts_copy[i] = NULL;
5616 }
74929ac2 5617 }
3b8b7135 5618
d0c814ec 5619 free(opts_copy);
3b8b7135 5620 return ret;
214e1eca
JA
5621}
5622
5623int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5624{
a8523a6a
JA
5625 int ret;
5626
a609f12a 5627 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
a8523a6a 5628 if (!ret) {
9109883a 5629 const struct fio_option *o;
a8523a6a 5630
9109883a 5631 o = find_option_c(fio_options, opt);
a8523a6a
JA
5632 if (o)
5633 fio_option_mark_set(&td->o, o);
5634 }
5635
5636 return ret;
214e1eca
JA
5637}
5638
de890a1e
SL
5639int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5640 char *val)
5641{
d8b4f395
JA
5642 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5643 &td->opt_list);
de890a1e
SL
5644}
5645
214e1eca
JA
5646void fio_fill_default_options(struct thread_data *td)
5647{
cb1402d6 5648 td->o.magic = OPT_MAGIC;
a609f12a 5649 fill_default_options(&td->o, fio_options);
214e1eca
JA
5650}
5651
5652int fio_show_option_help(const char *opt)
5653{
9af4a244 5654 return show_cmd_help(fio_options, opt);
214e1eca 5655}
d23bb327 5656
de890a1e
SL
5657/*
5658 * dupe FIO_OPT_STR_STORE options
5659 */
5660void fio_options_mem_dupe(struct thread_data *td)
5661{
53b5693d 5662 options_mem_dupe(fio_options, &td->o);
1647f592
JA
5663
5664 if (td->eo && td->io_ops) {
de890a1e 5665 void *oldeo = td->eo;
1647f592 5666
de890a1e
SL
5667 td->eo = malloc(td->io_ops->option_struct_size);
5668 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
53b5693d 5669 options_mem_dupe(td->io_ops->options, td->eo);
de890a1e
SL
5670 }
5671}
5672
d6978a32
JA
5673unsigned int fio_get_kb_base(void *data)
5674{
a609f12a
JA
5675 struct thread_data *td = cb_data_to_td(data);
5676 struct thread_options *o = &td->o;
d6978a32
JA
5677 unsigned int kb_base = 0;
5678
cb1402d6
JA
5679 /*
5680 * This is a hack... For private options, *data is not holding
5681 * a pointer to the thread_options, but to private data. This means
5682 * we can't safely dereference it, but magic is first so mem wise
5683 * it is valid. But this also means that if the job first sets
5684 * kb_base and expects that to be honored by private options,
5685 * it will be disappointed. We will return the global default
5686 * for this.
5687 */
5688 if (o && o->magic == OPT_MAGIC)
83ea422a 5689 kb_base = o->kb_base;
d6978a32
JA
5690 if (!kb_base)
5691 kb_base = 1024;
5692
5693 return kb_base;
5694}
9f988e2e 5695
9109883a 5696int add_option(const struct fio_option *o)
9f988e2e 5697{
07b3232d
JA
5698 struct fio_option *__o;
5699 int opt_index = 0;
5700
9af4a244 5701 __o = fio_options;
07b3232d
JA
5702 while (__o->name) {
5703 opt_index++;
5704 __o++;
5705 }
5706
7b504edd
JA
5707 if (opt_index + 1 == FIO_MAX_OPTS) {
5708 log_err("fio: FIO_MAX_OPTS is too small\n");
5709 return 1;
5710 }
5711
9af4a244 5712 memcpy(&fio_options[opt_index], o, sizeof(*o));
7b504edd 5713 fio_options[opt_index + 1].name = NULL;
07b3232d 5714 return 0;
9f988e2e 5715}
e2de69da 5716
07b3232d 5717void invalidate_profile_options(const char *prof_name)
e2de69da 5718{
07b3232d 5719 struct fio_option *o;
e2de69da 5720
9af4a244 5721 o = fio_options;
07b3232d
JA
5722 while (o->name) {
5723 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5724 o->type = FIO_OPT_INVALID;
5725 o->prof_name = NULL;
5726 }
5727 o++;
e2de69da
JA
5728 }
5729}
f5b6bb85
JA
5730
5731void add_opt_posval(const char *optname, const char *ival, const char *help)
5732{
5733 struct fio_option *o;
5734 unsigned int i;
5735
9af4a244 5736 o = find_option(fio_options, optname);
f5b6bb85
JA
5737 if (!o)
5738 return;
5739
5740 for (i = 0; i < PARSE_MAX_VP; i++) {
5741 if (o->posval[i].ival)
5742 continue;
5743
5744 o->posval[i].ival = ival;
5745 o->posval[i].help = help;
5746 break;
5747 }
5748}
5749
5750void del_opt_posval(const char *optname, const char *ival)
5751{
5752 struct fio_option *o;
5753 unsigned int i;
5754
9af4a244 5755 o = find_option(fio_options, optname);
f5b6bb85
JA
5756 if (!o)
5757 return;
5758
5759 for (i = 0; i < PARSE_MAX_VP; i++) {
5760 if (!o->posval[i].ival)
5761 continue;
5762 if (strcmp(o->posval[i].ival, ival))
5763 continue;
5764
5765 o->posval[i].ival = NULL;
5766 o->posval[i].help = NULL;
5767 }
5768}
7e356b2d
JA
5769
5770void fio_options_free(struct thread_data *td)
5771{
ca6336a8 5772 options_free(fio_options, &td->o);
de890a1e
SL
5773 if (td->eo && td->io_ops && td->io_ops->options) {
5774 options_free(td->io_ops->options, td->eo);
5775 free(td->eo);
5776 td->eo = NULL;
5777 }
7e356b2d 5778}
c504ee55 5779
8009f543
NC
5780void fio_dump_options_free(struct thread_data *td)
5781{
5782 while (!flist_empty(&td->opt_list)) {
5783 struct print_option *p;
5784
5785 p = flist_first_entry(&td->opt_list, struct print_option, list);
5786 flist_del_init(&p->list);
5787 free(p->name);
5788 free(p->value);
5789 free(p);
5790 }
5791}
5792
c504ee55
JA
5793struct fio_option *fio_option_find(const char *name)
5794{
5795 return find_option(fio_options, name);
5796}
5797
517c9c72 5798static struct fio_option *find_next_opt(struct fio_option *from,
f0e7f45a 5799 unsigned int off1)
a8523a6a 5800{
f0e7f45a 5801 struct fio_option *opt;
a8523a6a 5802
f0e7f45a
JA
5803 if (!from)
5804 from = &fio_options[0];
5805 else
5806 from++;
5807
5808 opt = NULL;
5809 do {
5810 if (off1 == from->off1) {
5811 opt = from;
a8523a6a
JA
5812 break;
5813 }
f0e7f45a
JA
5814 from++;
5815 } while (from->name);
a8523a6a 5816
f0e7f45a
JA
5817 return opt;
5818}
5819
5820static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5821{
5822 unsigned int opt_off, index, offset;
a8523a6a
JA
5823
5824 opt_off = opt - &fio_options[0];
5825 index = opt_off / (8 * sizeof(uint64_t));
5826 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
e9d686d6 5827 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
a8523a6a
JA
5828}
5829
72f39748 5830bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
f0e7f45a
JA
5831{
5832 struct fio_option *opt, *next;
5833
5834 next = NULL;
517c9c72 5835 while ((opt = find_next_opt(next, off1)) != NULL) {
f0e7f45a 5836 if (opt_is_set(o, opt))
72f39748 5837 return true;
f0e7f45a
JA
5838
5839 next = opt;
5840 }
5841
72f39748 5842 return false;
f0e7f45a
JA
5843}
5844
9109883a 5845void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
a8523a6a
JA
5846{
5847 unsigned int opt_off, index, offset;
5848
5849 opt_off = opt - &fio_options[0];
5850 index = opt_off / (8 * sizeof(uint64_t));
5851 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
e9d686d6 5852 o->set_options[index] |= (uint64_t)1 << offset;
a8523a6a 5853}