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