engines/libaio: fix io_getevents min/max events arguments
[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",
e8b0e958 2468 .lname = "Random repeatable",
214e1eca 2469 .type = FIO_OPT_BOOL,
a609f12a 2470 .off1 = offsetof(struct thread_options, rand_repeatable),
214e1eca
JA
2471 .help = "Use repeatable random IO pattern",
2472 .def = "1",
67a1000f 2473 .parent = "rw",
d71c154c 2474 .hide = 1,
e8b0e958 2475 .category = FIO_OPT_C_IO,
3ceb458f 2476 .group = FIO_OPT_G_RANDOM,
214e1eca 2477 },
04778baf
JA
2478 {
2479 .name = "randseed",
2480 .lname = "The random generator seed",
363cffa7 2481 .type = FIO_OPT_STR_VAL,
a609f12a 2482 .off1 = offsetof(struct thread_options, rand_seed),
04778baf 2483 .help = "Set the random generator seed value",
40fe5e7b 2484 .def = "0x89",
04778baf
JA
2485 .parent = "rw",
2486 .category = FIO_OPT_C_IO,
2487 .group = FIO_OPT_G_RANDOM,
2488 },
214e1eca
JA
2489 {
2490 .name = "norandommap",
e8b0e958 2491 .lname = "No randommap",
214e1eca 2492 .type = FIO_OPT_STR_SET,
a609f12a 2493 .off1 = offsetof(struct thread_options, norandommap),
214e1eca 2494 .help = "Accept potential duplicate random blocks",
67a1000f 2495 .parent = "rw",
d71c154c 2496 .hide = 1,
b2452a43 2497 .hide_on_set = 1,
e8b0e958 2498 .category = FIO_OPT_C_IO,
3ceb458f 2499 .group = FIO_OPT_G_RANDOM,
214e1eca 2500 },
2b386d25
JA
2501 {
2502 .name = "softrandommap",
e8b0e958 2503 .lname = "Soft randommap",
2b386d25 2504 .type = FIO_OPT_BOOL,
a609f12a 2505 .off1 = offsetof(struct thread_options, softrandommap),
f66ab3c8 2506 .help = "Set norandommap if randommap allocation fails",
2b386d25 2507 .parent = "norandommap",
d71c154c 2508 .hide = 1,
2b386d25 2509 .def = "0",
e8b0e958 2510 .category = FIO_OPT_C_IO,
3ceb458f 2511 .group = FIO_OPT_G_RANDOM,
2b386d25 2512 },
8055e41d
JA
2513 {
2514 .name = "random_generator",
cce2fdfe 2515 .lname = "Random Generator",
8055e41d 2516 .type = FIO_OPT_STR,
a609f12a 2517 .off1 = offsetof(struct thread_options, random_generator),
8055e41d
JA
2518 .help = "Type of random number generator to use",
2519 .def = "tausworthe",
2520 .posval = {
2521 { .ival = "tausworthe",
2522 .oval = FIO_RAND_GEN_TAUSWORTHE,
2523 .help = "Strong Tausworthe generator",
2524 },
2525 { .ival = "lfsr",
2526 .oval = FIO_RAND_GEN_LFSR,
2527 .help = "Variable length LFSR",
2528 },
c3546b53
JA
2529 {
2530 .ival = "tausworthe64",
2531 .oval = FIO_RAND_GEN_TAUSWORTHE64,
2532 .help = "64-bit Tausworthe variant",
2533 },
8055e41d 2534 },
48107598
JA
2535 .category = FIO_OPT_C_IO,
2536 .group = FIO_OPT_G_RANDOM,
8055e41d 2537 },
e25839d4
JA
2538 {
2539 .name = "random_distribution",
cce2fdfe 2540 .lname = "Random Distribution",
e25839d4 2541 .type = FIO_OPT_STR,
a609f12a 2542 .off1 = offsetof(struct thread_options, random_distribution),
e25839d4
JA
2543 .cb = str_random_distribution_cb,
2544 .help = "Random offset distribution generator",
2545 .def = "random",
2546 .posval = {
2547 { .ival = "random",
2548 .oval = FIO_RAND_DIST_RANDOM,
2549 .help = "Completely random",
2550 },
2551 { .ival = "zipf",
2552 .oval = FIO_RAND_DIST_ZIPF,
2553 .help = "Zipf distribution",
2554 },
925fee33
JA
2555 { .ival = "pareto",
2556 .oval = FIO_RAND_DIST_PARETO,
2557 .help = "Pareto distribution",
2558 },
56d9fa4b
JA
2559 { .ival = "normal",
2560 .oval = FIO_RAND_DIST_GAUSS,
ba2b3b07 2561 .help = "Normal (Gaussian) distribution",
56d9fa4b 2562 },
e0a04ac1
JA
2563 { .ival = "zoned",
2564 .oval = FIO_RAND_DIST_ZONED,
2565 .help = "Zoned random distribution",
2566 },
59466396
JA
2567 { .ival = "zoned_abs",
2568 .oval = FIO_RAND_DIST_ZONED_ABS,
2569 .help = "Zoned absolute random distribution",
2570 },
e25839d4 2571 },
48107598
JA
2572 .category = FIO_OPT_C_IO,
2573 .group = FIO_OPT_G_RANDOM,
e25839d4 2574 },
211c9b89
JA
2575 {
2576 .name = "percentage_random",
2577 .lname = "Percentage Random",
2578 .type = FIO_OPT_INT,
a609f12a
JA
2579 .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]),
2580 .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]),
2581 .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]),
211c9b89
JA
2582 .maxval = 100,
2583 .help = "Percentage of seq/random mix that should be random",
d9472271 2584 .def = "100,100,100",
211c9b89
JA
2585 .interval = 5,
2586 .inverse = "percentage_sequential",
2587 .category = FIO_OPT_C_IO,
2588 .group = FIO_OPT_G_RANDOM,
2589 },
2590 {
2591 .name = "percentage_sequential",
2592 .lname = "Percentage Sequential",
d9472271 2593 .type = FIO_OPT_DEPRECATED,
211c9b89
JA
2594 .category = FIO_OPT_C_IO,
2595 .group = FIO_OPT_G_RANDOM,
2596 },
56e2a5fc
CE
2597 {
2598 .name = "allrandrepeat",
cce2fdfe 2599 .lname = "All Random Repeat",
56e2a5fc 2600 .type = FIO_OPT_BOOL,
a609f12a 2601 .off1 = offsetof(struct thread_options, allrand_repeatable),
56e2a5fc
CE
2602 .help = "Use repeatable random numbers for everything",
2603 .def = "0",
a869d9c6
JA
2604 .category = FIO_OPT_C_IO,
2605 .group = FIO_OPT_G_RANDOM,
56e2a5fc 2606 },
214e1eca
JA
2607 {
2608 .name = "nrfiles",
e8b0e958 2609 .lname = "Number of files",
d7c8be03 2610 .alias = "nr_files",
214e1eca 2611 .type = FIO_OPT_INT,
a609f12a 2612 .off1 = offsetof(struct thread_options, nr_files),
214e1eca
JA
2613 .help = "Split job workload between this number of files",
2614 .def = "1",
20eb06bd 2615 .interval = 1,
e8b0e958
JA
2616 .category = FIO_OPT_C_FILE,
2617 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2618 },
2619 {
2620 .name = "openfiles",
e8b0e958 2621 .lname = "Number of open files",
214e1eca 2622 .type = FIO_OPT_INT,
a609f12a 2623 .off1 = offsetof(struct thread_options, open_files),
214e1eca 2624 .help = "Number of files to keep open at the same time",
e8b0e958
JA
2625 .category = FIO_OPT_C_FILE,
2626 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2627 },
2628 {
2629 .name = "file_service_type",
e8b0e958 2630 .lname = "File service type",
214e1eca
JA
2631 .type = FIO_OPT_STR,
2632 .cb = str_fst_cb,
a609f12a 2633 .off1 = offsetof(struct thread_options, file_service_type),
214e1eca
JA
2634 .help = "How to select which file to service next",
2635 .def = "roundrobin",
e8b0e958
JA
2636 .category = FIO_OPT_C_FILE,
2637 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2638 .posval = {
2639 { .ival = "random",
2640 .oval = FIO_FSERVICE_RANDOM,
8c07860d
JA
2641 .help = "Choose a file at random (uniform)",
2642 },
2643 { .ival = "zipf",
2644 .oval = FIO_FSERVICE_ZIPF,
2645 .help = "Zipf randomized",
2646 },
2647 { .ival = "pareto",
2648 .oval = FIO_FSERVICE_PARETO,
2649 .help = "Pareto randomized",
2650 },
dd3503d3
SW
2651 { .ival = "normal",
2652 .oval = FIO_FSERVICE_GAUSS,
2653 .help = "Normal (Gaussian) randomized",
2654 },
8c07860d
JA
2655 { .ival = "gauss",
2656 .oval = FIO_FSERVICE_GAUSS,
dd3503d3 2657 .help = "Alias for normal",
214e1eca
JA
2658 },
2659 { .ival = "roundrobin",
2660 .oval = FIO_FSERVICE_RR,
2661 .help = "Round robin select files",
2662 },
a086c257
JA
2663 { .ival = "sequential",
2664 .oval = FIO_FSERVICE_SEQ,
2665 .help = "Finish one file before moving to the next",
2666 },
214e1eca 2667 },
67a1000f 2668 .parent = "nrfiles",
d71c154c 2669 .hide = 1,
67a1000f 2670 },
7bc8c2cf
JA
2671 {
2672 .name = "fallocate",
e8b0e958 2673 .lname = "Fallocate",
a596f047 2674 .type = FIO_OPT_STR,
a609f12a 2675 .off1 = offsetof(struct thread_options, fallocate_mode),
a596f047 2676 .help = "Whether pre-allocation is performed when laying out files",
38ca5f03 2677#ifdef FIO_HAVE_DEFAULT_FALLOCATE
2c3e17be 2678 .def = "native",
38ca5f03
TV
2679#else
2680 .def = "none",
2681#endif
e8b0e958
JA
2682 .category = FIO_OPT_C_FILE,
2683 .group = FIO_OPT_G_INVALID,
a596f047
EG
2684 .posval = {
2685 { .ival = "none",
2686 .oval = FIO_FALLOCATE_NONE,
2687 .help = "Do not pre-allocate space",
2688 },
2c3e17be
SW
2689 { .ival = "native",
2690 .oval = FIO_FALLOCATE_NATIVE,
2691 .help = "Use native pre-allocation if possible",
2692 },
2693#ifdef CONFIG_POSIX_FALLOCATE
a596f047
EG
2694 { .ival = "posix",
2695 .oval = FIO_FALLOCATE_POSIX,
2696 .help = "Use posix_fallocate()",
2697 },
2c3e17be 2698#endif
97ac992c 2699#ifdef CONFIG_LINUX_FALLOCATE
a596f047
EG
2700 { .ival = "keep",
2701 .oval = FIO_FALLOCATE_KEEP_SIZE,
2702 .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)",
2703 },
7bc8c2cf 2704#endif
38ca5f03
TV
2705 { .ival = "truncate",
2706 .oval = FIO_FALLOCATE_TRUNCATE,
2707 .help = "Truncate file to final size instead of allocating"
2708 },
a596f047
EG
2709 /* Compatibility with former boolean values */
2710 { .ival = "0",
2711 .oval = FIO_FALLOCATE_NONE,
2712 .help = "Alias for 'none'",
2713 },
2c3e17be 2714#ifdef CONFIG_POSIX_FALLOCATE
a596f047
EG
2715 { .ival = "1",
2716 .oval = FIO_FALLOCATE_POSIX,
2717 .help = "Alias for 'posix'",
2718 },
2c3e17be 2719#endif
a596f047
EG
2720 },
2721 },
67a1000f
JA
2722 {
2723 .name = "fadvise_hint",
e8b0e958 2724 .lname = "Fadvise hint",
ecb2083d 2725 .type = FIO_OPT_STR,
a609f12a 2726 .off1 = offsetof(struct thread_options, fadvise_hint),
ecb2083d
JA
2727 .posval = {
2728 { .ival = "0",
2729 .oval = F_ADV_NONE,
c712c97a 2730 .help = "Don't issue fadvise/madvise",
ecb2083d
JA
2731 },
2732 { .ival = "1",
2733 .oval = F_ADV_TYPE,
2734 .help = "Advise using fio IO pattern",
2735 },
2736 { .ival = "random",
2737 .oval = F_ADV_RANDOM,
2738 .help = "Advise using FADV_RANDOM",
2739 },
2740 { .ival = "sequential",
2741 .oval = F_ADV_SEQUENTIAL,
2742 .help = "Advise using FADV_SEQUENTIAL",
2743 },
638689b1 2744#ifdef POSIX_FADV_NOREUSE
eb314e70
YX
2745 { .ival = "noreuse",
2746 .oval = F_ADV_NOREUSE,
2747 .help = "Advise using FADV_NOREUSE",
2748 },
638689b1 2749#endif
ecb2083d 2750 },
67a1000f
JA
2751 .help = "Use fadvise() to advise the kernel on IO pattern",
2752 .def = "1",
e8b0e958
JA
2753 .category = FIO_OPT_C_FILE,
2754 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2755 },
2756 {
2757 .name = "fsync",
e8b0e958 2758 .lname = "Fsync",
214e1eca 2759 .type = FIO_OPT_INT,
a609f12a 2760 .off1 = offsetof(struct thread_options, fsync_blocks),
214e1eca
JA
2761 .help = "Issue fsync for writes every given number of blocks",
2762 .def = "0",
20eb06bd 2763 .interval = 1,
e8b0e958
JA
2764 .category = FIO_OPT_C_FILE,
2765 .group = FIO_OPT_G_INVALID,
214e1eca 2766 },
5f9099ea
JA
2767 {
2768 .name = "fdatasync",
e8b0e958 2769 .lname = "Fdatasync",
5f9099ea 2770 .type = FIO_OPT_INT,
a609f12a 2771 .off1 = offsetof(struct thread_options, fdatasync_blocks),
5f9099ea
JA
2772 .help = "Issue fdatasync for writes every given number of blocks",
2773 .def = "0",
20eb06bd 2774 .interval = 1,
e8b0e958
JA
2775 .category = FIO_OPT_C_FILE,
2776 .group = FIO_OPT_G_INVALID,
5f9099ea 2777 },
1ef2b6be
JA
2778 {
2779 .name = "write_barrier",
e8b0e958 2780 .lname = "Write barrier",
1ef2b6be 2781 .type = FIO_OPT_INT,
a609f12a 2782 .off1 = offsetof(struct thread_options, barrier_blocks),
1ef2b6be
JA
2783 .help = "Make every Nth write a barrier write",
2784 .def = "0",
20eb06bd 2785 .interval = 1,
e8b0e958
JA
2786 .category = FIO_OPT_C_IO,
2787 .group = FIO_OPT_G_INVALID,
1ef2b6be 2788 },
67bf9823 2789#ifdef CONFIG_SYNC_FILE_RANGE
44f29692
JA
2790 {
2791 .name = "sync_file_range",
e8b0e958 2792 .lname = "Sync file range",
44f29692
JA
2793 .posval = {
2794 { .ival = "wait_before",
2795 .oval = SYNC_FILE_RANGE_WAIT_BEFORE,
2796 .help = "SYNC_FILE_RANGE_WAIT_BEFORE",
ebadc0ce 2797 .orval = 1,
44f29692
JA
2798 },
2799 { .ival = "write",
2800 .oval = SYNC_FILE_RANGE_WRITE,
2801 .help = "SYNC_FILE_RANGE_WRITE",
ebadc0ce 2802 .orval = 1,
44f29692
JA
2803 },
2804 {
2805 .ival = "wait_after",
2806 .oval = SYNC_FILE_RANGE_WAIT_AFTER,
2807 .help = "SYNC_FILE_RANGE_WAIT_AFTER",
ebadc0ce 2808 .orval = 1,
44f29692
JA
2809 },
2810 },
3843deb3 2811 .type = FIO_OPT_STR_MULTI,
44f29692 2812 .cb = str_sfr_cb,
a609f12a 2813 .off1 = offsetof(struct thread_options, sync_file_range),
44f29692 2814 .help = "Use sync_file_range()",
e8b0e958
JA
2815 .category = FIO_OPT_C_FILE,
2816 .group = FIO_OPT_G_INVALID,
44f29692 2817 },
a275c37a 2818#else
54d0a315 2819 {
a275c37a
JA
2820 .name = "sync_file_range",
2821 .lname = "Sync file range",
2822 .type = FIO_OPT_UNSUPPORTED,
2823 .help = "Your platform does not support sync_file_range",
2824 },
44f29692 2825#endif
214e1eca
JA
2826 {
2827 .name = "direct",
e8b0e958 2828 .lname = "Direct I/O",
214e1eca 2829 .type = FIO_OPT_BOOL,
a609f12a 2830 .off1 = offsetof(struct thread_options, odirect),
214e1eca
JA
2831 .help = "Use O_DIRECT IO (negates buffered)",
2832 .def = "0",
a01a1bc5 2833 .inverse = "buffered",
e8b0e958 2834 .category = FIO_OPT_C_IO,
3ceb458f 2835 .group = FIO_OPT_G_IO_TYPE,
214e1eca 2836 },
d01612f3
CM
2837 {
2838 .name = "atomic",
2839 .lname = "Atomic I/O",
2840 .type = FIO_OPT_BOOL,
a609f12a 2841 .off1 = offsetof(struct thread_options, oatomic),
d01612f3
CM
2842 .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)",
2843 .def = "0",
2844 .category = FIO_OPT_C_IO,
2845 .group = FIO_OPT_G_IO_TYPE,
2846 },
214e1eca
JA
2847 {
2848 .name = "buffered",
e8b0e958 2849 .lname = "Buffered I/O",
214e1eca 2850 .type = FIO_OPT_BOOL,
a609f12a 2851 .off1 = offsetof(struct thread_options, odirect),
214e1eca
JA
2852 .neg = 1,
2853 .help = "Use buffered IO (negates direct)",
2854 .def = "1",
a01a1bc5 2855 .inverse = "direct",
e8b0e958 2856 .category = FIO_OPT_C_IO,
3ceb458f 2857 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
2858 },
2859 {
2860 .name = "overwrite",
e8b0e958 2861 .lname = "Overwrite",
214e1eca 2862 .type = FIO_OPT_BOOL,
a609f12a 2863 .off1 = offsetof(struct thread_options, overwrite),
214e1eca
JA
2864 .help = "When writing, set whether to overwrite current data",
2865 .def = "0",
e8b0e958
JA
2866 .category = FIO_OPT_C_FILE,
2867 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2868 },
2869 {
2870 .name = "loops",
e8b0e958 2871 .lname = "Loops",
214e1eca 2872 .type = FIO_OPT_INT,
a609f12a 2873 .off1 = offsetof(struct thread_options, loops),
214e1eca
JA
2874 .help = "Number of times to run the job",
2875 .def = "1",
20eb06bd 2876 .interval = 1,
e8b0e958 2877 .category = FIO_OPT_C_GENERAL,
a1f6afec 2878 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2879 },
2880 {
2881 .name = "numjobs",
e8b0e958 2882 .lname = "Number of jobs",
214e1eca 2883 .type = FIO_OPT_INT,
a609f12a 2884 .off1 = offsetof(struct thread_options, numjobs),
214e1eca
JA
2885 .help = "Duplicate this job this many times",
2886 .def = "1",
20eb06bd 2887 .interval = 1,
e8b0e958 2888 .category = FIO_OPT_C_GENERAL,
a1f6afec 2889 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2890 },
2891 {
2892 .name = "startdelay",
e8b0e958 2893 .lname = "Start delay",
a5737c93 2894 .type = FIO_OPT_STR_VAL_TIME,
a609f12a
JA
2895 .off1 = offsetof(struct thread_options, start_delay),
2896 .off2 = offsetof(struct thread_options, start_delay_high),
214e1eca
JA
2897 .help = "Only start job when this period has passed",
2898 .def = "0",
0de5b26f 2899 .is_seconds = 1,
88038bc7 2900 .is_time = 1,
e8b0e958 2901 .category = FIO_OPT_C_GENERAL,
a1f6afec 2902 .group = FIO_OPT_G_RUNTIME,
214e1eca
JA
2903 },
2904 {
2905 .name = "runtime",
e8b0e958 2906 .lname = "Runtime",
214e1eca
JA
2907 .alias = "timeout",
2908 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 2909 .off1 = offsetof(struct thread_options, timeout),
214e1eca
JA
2910 .help = "Stop workload when this amount of time has passed",
2911 .def = "0",
0de5b26f 2912 .is_seconds = 1,
88038bc7 2913 .is_time = 1,
e8b0e958 2914 .category = FIO_OPT_C_GENERAL,
a1f6afec 2915 .group = FIO_OPT_G_RUNTIME,
214e1eca 2916 },
cf4464ca
JA
2917 {
2918 .name = "time_based",
e8b0e958 2919 .lname = "Time based",
cf4464ca 2920 .type = FIO_OPT_STR_SET,
a609f12a 2921 .off1 = offsetof(struct thread_options, time_based),
cf4464ca 2922 .help = "Keep running until runtime/timeout is met",
e8b0e958 2923 .category = FIO_OPT_C_GENERAL,
a1f6afec 2924 .group = FIO_OPT_G_RUNTIME,
cf4464ca 2925 },
62167762
JC
2926 {
2927 .name = "verify_only",
2928 .lname = "Verify only",
2929 .type = FIO_OPT_STR_SET,
a609f12a 2930 .off1 = offsetof(struct thread_options, verify_only),
62167762
JC
2931 .help = "Verifies previously written data is still valid",
2932 .category = FIO_OPT_C_GENERAL,
2933 .group = FIO_OPT_G_RUNTIME,
2934 },
721938ae
JA
2935 {
2936 .name = "ramp_time",
e8b0e958 2937 .lname = "Ramp time",
721938ae 2938 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 2939 .off1 = offsetof(struct thread_options, ramp_time),
721938ae 2940 .help = "Ramp up time before measuring performance",
0de5b26f 2941 .is_seconds = 1,
88038bc7 2942 .is_time = 1,
e8b0e958 2943 .category = FIO_OPT_C_GENERAL,
a1f6afec 2944 .group = FIO_OPT_G_RUNTIME,
721938ae 2945 },
c223da83
JA
2946 {
2947 .name = "clocksource",
e8b0e958 2948 .lname = "Clock source",
c223da83
JA
2949 .type = FIO_OPT_STR,
2950 .cb = fio_clock_source_cb,
a609f12a 2951 .off1 = offsetof(struct thread_options, clocksource),
c223da83 2952 .help = "What type of timing source to use",
e8b0e958 2953 .category = FIO_OPT_C_GENERAL,
10860056 2954 .group = FIO_OPT_G_CLOCK,
c223da83 2955 .posval = {
67bf9823 2956#ifdef CONFIG_GETTIMEOFDAY
c223da83
JA
2957 { .ival = "gettimeofday",
2958 .oval = CS_GTOD,
2959 .help = "Use gettimeofday(2) for timing",
2960 },
67bf9823
JA
2961#endif
2962#ifdef CONFIG_CLOCK_GETTIME
c223da83
JA
2963 { .ival = "clock_gettime",
2964 .oval = CS_CGETTIME,
2965 .help = "Use clock_gettime(2) for timing",
2966 },
67bf9823 2967#endif
c223da83
JA
2968#ifdef ARCH_HAVE_CPU_CLOCK
2969 { .ival = "cpu",
2970 .oval = CS_CPUCLOCK,
2971 .help = "Use CPU private clock",
2972 },
2973#endif
2974 },
2975 },
214e1eca
JA
2976 {
2977 .name = "mem",
d3aad8f2 2978 .alias = "iomem",
e8b0e958 2979 .lname = "I/O Memory",
214e1eca
JA
2980 .type = FIO_OPT_STR,
2981 .cb = str_mem_cb,
a609f12a 2982 .off1 = offsetof(struct thread_options, mem_type),
214e1eca
JA
2983 .help = "Backing type for IO buffers",
2984 .def = "malloc",
e8b0e958
JA
2985 .category = FIO_OPT_C_IO,
2986 .group = FIO_OPT_G_INVALID,
214e1eca
JA
2987 .posval = {
2988 { .ival = "malloc",
2989 .oval = MEM_MALLOC,
2990 .help = "Use malloc(3) for IO buffers",
2991 },
c8931876 2992#ifndef CONFIG_NO_SHM
37c8cdfe
JA
2993 { .ival = "shm",
2994 .oval = MEM_SHM,
2995 .help = "Use shared memory segments for IO buffers",
2996 },
214e1eca
JA
2997#ifdef FIO_HAVE_HUGETLB
2998 { .ival = "shmhuge",
2999 .oval = MEM_SHMHUGE,
3000 .help = "Like shm, but use huge pages",
3001 },
c8931876 3002#endif
b370e46a 3003#endif
37c8cdfe
JA
3004 { .ival = "mmap",
3005 .oval = MEM_MMAP,
3006 .help = "Use mmap(2) (file or anon) for IO buffers",
3007 },
217b0f1d
LG
3008 { .ival = "mmapshared",
3009 .oval = MEM_MMAPSHARED,
3010 .help = "Like mmap, but use the shared flag",
3011 },
214e1eca
JA
3012#ifdef FIO_HAVE_HUGETLB
3013 { .ival = "mmaphuge",
3014 .oval = MEM_MMAPHUGE,
3015 .help = "Like mmap, but use huge pages",
3016 },
03553853
YR
3017#endif
3018#ifdef CONFIG_CUDA
3019 { .ival = "cudamalloc",
3020 .oval = MEM_CUDA_MALLOC,
3021 .help = "Allocate GPU device memory for GPUDirect RDMA",
3022 },
214e1eca
JA
3023#endif
3024 },
3025 },
d529ee19
JA
3026 {
3027 .name = "iomem_align",
3028 .alias = "mem_align",
e8b0e958 3029 .lname = "I/O memory alignment",
d529ee19 3030 .type = FIO_OPT_INT,
a609f12a 3031 .off1 = offsetof(struct thread_options, mem_align),
d529ee19
JA
3032 .minval = 0,
3033 .help = "IO memory buffer offset alignment",
3034 .def = "0",
3035 .parent = "iomem",
d71c154c 3036 .hide = 1,
e8b0e958
JA
3037 .category = FIO_OPT_C_IO,
3038 .group = FIO_OPT_G_INVALID,
d529ee19 3039 },
214e1eca
JA
3040 {
3041 .name = "verify",
e8b0e958 3042 .lname = "Verify",
214e1eca 3043 .type = FIO_OPT_STR,
a609f12a 3044 .off1 = offsetof(struct thread_options, verify),
214e1eca
JA
3045 .help = "Verify data written",
3046 .def = "0",
e8b0e958 3047 .category = FIO_OPT_C_IO,
3ceb458f 3048 .group = FIO_OPT_G_VERIFY,
214e1eca
JA
3049 .posval = {
3050 { .ival = "0",
3051 .oval = VERIFY_NONE,
3052 .help = "Don't do IO verification",
3053 },
fcca4b58
JA
3054 { .ival = "md5",
3055 .oval = VERIFY_MD5,
3056 .help = "Use md5 checksums for verification",
3057 },
d77a7af3
JA
3058 { .ival = "crc64",
3059 .oval = VERIFY_CRC64,
3060 .help = "Use crc64 checksums for verification",
3061 },
214e1eca
JA
3062 { .ival = "crc32",
3063 .oval = VERIFY_CRC32,
3064 .help = "Use crc32 checksums for verification",
3065 },
af497e6a 3066 { .ival = "crc32c-intel",
e3aaafc4
JA
3067 .oval = VERIFY_CRC32C,
3068 .help = "Use crc32c checksums for verification (hw assisted, if available)",
af497e6a 3069 },
bac39e0e
JA
3070 { .ival = "crc32c",
3071 .oval = VERIFY_CRC32C,
e3aaafc4 3072 .help = "Use crc32c checksums for verification (hw assisted, if available)",
bac39e0e 3073 },
969f7ed3
JA
3074 { .ival = "crc16",
3075 .oval = VERIFY_CRC16,
3076 .help = "Use crc16 checksums for verification",
3077 },
1e154bdb
JA
3078 { .ival = "crc7",
3079 .oval = VERIFY_CRC7,
3080 .help = "Use crc7 checksums for verification",
3081 },
7c353ceb
JA
3082 { .ival = "sha1",
3083 .oval = VERIFY_SHA1,
3084 .help = "Use sha1 checksums for verification",
3085 },
cd14cc10
JA
3086 { .ival = "sha256",
3087 .oval = VERIFY_SHA256,
3088 .help = "Use sha256 checksums for verification",
3089 },
3090 { .ival = "sha512",
3091 .oval = VERIFY_SHA512,
3092 .help = "Use sha512 checksums for verification",
ae3a5acc
JA
3093 },
3094 { .ival = "sha3-224",
3095 .oval = VERIFY_SHA3_224,
3096 .help = "Use sha3-224 checksums for verification",
3097 },
3098 { .ival = "sha3-256",
3099 .oval = VERIFY_SHA3_256,
3100 .help = "Use sha3-256 checksums for verification",
3101 },
3102 { .ival = "sha3-384",
3103 .oval = VERIFY_SHA3_384,
3104 .help = "Use sha3-384 checksums for verification",
3105 },
3106 { .ival = "sha3-512",
3107 .oval = VERIFY_SHA3_512,
3108 .help = "Use sha3-512 checksums for verification",
cd14cc10 3109 },
844ea602
JA
3110 { .ival = "xxhash",
3111 .oval = VERIFY_XXHASH,
3112 .help = "Use xxhash checksums for verification",
3113 },
b638d82f
RP
3114 /* Meta information was included into verify_header,
3115 * 'meta' verification is implied by default. */
7437ee87 3116 { .ival = "meta",
b638d82f
RP
3117 .oval = VERIFY_HDR_ONLY,
3118 .help = "Use io information for verification. "
3119 "Now is implied by default, thus option is obsolete, "
3120 "don't use it",
7437ee87 3121 },
59245381
JA
3122 { .ival = "pattern",
3123 .oval = VERIFY_PATTERN_NO_HDR,
3124 .help = "Verify strict pattern",
3125 },
36690c9b
JA
3126 {
3127 .ival = "null",
3128 .oval = VERIFY_NULL,
3129 .help = "Pretend to verify",
3130 },
214e1eca
JA
3131 },
3132 },
005c565a
JA
3133 {
3134 .name = "do_verify",
e8b0e958 3135 .lname = "Perform verify step",
68e1f29a 3136 .type = FIO_OPT_BOOL,
a609f12a 3137 .off1 = offsetof(struct thread_options, do_verify),
005c565a
JA
3138 .help = "Run verification stage after write",
3139 .def = "1",
3140 .parent = "verify",
d71c154c 3141 .hide = 1,
e8b0e958
JA
3142 .category = FIO_OPT_C_IO,
3143 .group = FIO_OPT_G_VERIFY,
005c565a 3144 },
160b966d
JA
3145 {
3146 .name = "verifysort",
e8b0e958 3147 .lname = "Verify sort",
f31feaa2 3148 .type = FIO_OPT_SOFT_DEPRECATED,
e8b0e958
JA
3149 .category = FIO_OPT_C_IO,
3150 .group = FIO_OPT_G_VERIFY,
160b966d 3151 },
1ae83d45
JA
3152 {
3153 .name = "verifysort_nr",
cce2fdfe 3154 .lname = "Verify Sort Nr",
f31feaa2 3155 .type = FIO_OPT_SOFT_DEPRECATED,
836fcc0f
JA
3156 .category = FIO_OPT_C_IO,
3157 .group = FIO_OPT_G_VERIFY,
1ae83d45 3158 },
3f9f4e26 3159 {
a59e170d 3160 .name = "verify_interval",
e8b0e958 3161 .lname = "Verify interval",
e01b22b8 3162 .type = FIO_OPT_INT,
a609f12a 3163 .off1 = offsetof(struct thread_options, verify_interval),
819a9680 3164 .minval = 2 * sizeof(struct verify_header),
a59e170d 3165 .help = "Store verify buffer header every N bytes",
afdf9352 3166 .parent = "verify",
d71c154c 3167 .hide = 1,
20eb06bd 3168 .interval = 2 * sizeof(struct verify_header),
e8b0e958
JA
3169 .category = FIO_OPT_C_IO,
3170 .group = FIO_OPT_G_VERIFY,
3f9f4e26 3171 },
546a9142 3172 {
a59e170d 3173 .name = "verify_offset",
e8b0e958 3174 .lname = "Verify offset",
e01b22b8 3175 .type = FIO_OPT_INT,
a59e170d 3176 .help = "Offset verify header location by N bytes",
a609f12a 3177 .off1 = offsetof(struct thread_options, verify_offset),
203160d5 3178 .minval = sizeof(struct verify_header),
afdf9352 3179 .parent = "verify",
d71c154c 3180 .hide = 1,
e8b0e958
JA
3181 .category = FIO_OPT_C_IO,
3182 .group = FIO_OPT_G_VERIFY,
546a9142 3183 },
e28218f3
SL
3184 {
3185 .name = "verify_pattern",
e8b0e958 3186 .lname = "Verify pattern",
0e92f873 3187 .type = FIO_OPT_STR,
e28218f3 3188 .cb = str_verify_pattern_cb,
a609f12a 3189 .off1 = offsetof(struct thread_options, verify_pattern),
e28218f3
SL
3190 .help = "Fill pattern for IO buffers",
3191 .parent = "verify",
d71c154c 3192 .hide = 1,
e8b0e958
JA
3193 .category = FIO_OPT_C_IO,
3194 .group = FIO_OPT_G_VERIFY,
e28218f3 3195 },
a12a3b4d
JA
3196 {
3197 .name = "verify_fatal",
e8b0e958 3198 .lname = "Verify fatal",
68e1f29a 3199 .type = FIO_OPT_BOOL,
a609f12a 3200 .off1 = offsetof(struct thread_options, verify_fatal),
a12a3b4d
JA
3201 .def = "0",
3202 .help = "Exit on a single verify failure, don't continue",
3203 .parent = "verify",
d71c154c 3204 .hide = 1,
e8b0e958
JA
3205 .category = FIO_OPT_C_IO,
3206 .group = FIO_OPT_G_VERIFY,
a12a3b4d 3207 },
b463e936
JA
3208 {
3209 .name = "verify_dump",
e8b0e958 3210 .lname = "Verify dump",
b463e936 3211 .type = FIO_OPT_BOOL,
a609f12a 3212 .off1 = offsetof(struct thread_options, verify_dump),
ef71e317 3213 .def = "0",
b463e936
JA
3214 .help = "Dump contents of good and bad blocks on failure",
3215 .parent = "verify",
d71c154c 3216 .hide = 1,
e8b0e958
JA
3217 .category = FIO_OPT_C_IO,
3218 .group = FIO_OPT_G_VERIFY,
b463e936 3219 },
e8462bd8
JA
3220 {
3221 .name = "verify_async",
e8b0e958 3222 .lname = "Verify asynchronously",
e8462bd8 3223 .type = FIO_OPT_INT,
a609f12a 3224 .off1 = offsetof(struct thread_options, verify_async),
e8462bd8
JA
3225 .def = "0",
3226 .help = "Number of async verifier threads to use",
3227 .parent = "verify",
d71c154c 3228 .hide = 1,
e8b0e958
JA
3229 .category = FIO_OPT_C_IO,
3230 .group = FIO_OPT_G_VERIFY,
e8462bd8 3231 },
9e144189
JA
3232 {
3233 .name = "verify_backlog",
e8b0e958 3234 .lname = "Verify backlog",
9e144189 3235 .type = FIO_OPT_STR_VAL,
a609f12a 3236 .off1 = offsetof(struct thread_options, verify_backlog),
9e144189
JA
3237 .help = "Verify after this number of blocks are written",
3238 .parent = "verify",
d71c154c 3239 .hide = 1,
e8b0e958
JA
3240 .category = FIO_OPT_C_IO,
3241 .group = FIO_OPT_G_VERIFY,
9e144189
JA
3242 },
3243 {
3244 .name = "verify_backlog_batch",
e8b0e958 3245 .lname = "Verify backlog batch",
9e144189 3246 .type = FIO_OPT_INT,
a609f12a 3247 .off1 = offsetof(struct thread_options, verify_batch),
9e144189 3248 .help = "Verify this number of IO blocks",
0d29de83 3249 .parent = "verify",
d71c154c 3250 .hide = 1,
e8b0e958
JA
3251 .category = FIO_OPT_C_IO,
3252 .group = FIO_OPT_G_VERIFY,
9e144189 3253 },
e8462bd8
JA
3254#ifdef FIO_HAVE_CPU_AFFINITY
3255 {
3256 .name = "verify_async_cpus",
e8b0e958 3257 .lname = "Async verify CPUs",
e8462bd8
JA
3258 .type = FIO_OPT_STR,
3259 .cb = str_verify_cpus_allowed_cb,
a609f12a 3260 .off1 = offsetof(struct thread_options, verify_cpumask),
e8462bd8
JA
3261 .help = "Set CPUs allowed for async verify threads",
3262 .parent = "verify_async",
d71c154c 3263 .hide = 1,
e8b0e958
JA
3264 .category = FIO_OPT_C_IO,
3265 .group = FIO_OPT_G_VERIFY,
e8462bd8 3266 },
a275c37a
JA
3267#else
3268 {
3269 .name = "verify_async_cpus",
3270 .lname = "Async verify CPUs",
3271 .type = FIO_OPT_UNSUPPORTED,
54d0a315 3272 .help = "Your platform does not support CPU affinities",
a275c37a 3273 },
0d29de83 3274#endif
51aa2da8
JA
3275 {
3276 .name = "experimental_verify",
cce2fdfe 3277 .lname = "Experimental Verify",
a609f12a 3278 .off1 = offsetof(struct thread_options, experimental_verify),
51aa2da8 3279 .type = FIO_OPT_BOOL,
b31eaac9 3280 .help = "Enable experimental verification",
ca09be4b
JA
3281 .parent = "verify",
3282 .category = FIO_OPT_C_IO,
3283 .group = FIO_OPT_G_VERIFY,
3284 },
3285 {
3286 .name = "verify_state_load",
3287 .lname = "Load verify state",
a609f12a 3288 .off1 = offsetof(struct thread_options, verify_state),
ca09be4b
JA
3289 .type = FIO_OPT_BOOL,
3290 .help = "Load verify termination state",
3291 .parent = "verify",
3292 .category = FIO_OPT_C_IO,
3293 .group = FIO_OPT_G_VERIFY,
3294 },
3295 {
3296 .name = "verify_state_save",
3297 .lname = "Save verify state",
a609f12a 3298 .off1 = offsetof(struct thread_options, verify_state_save),
ca09be4b
JA
3299 .type = FIO_OPT_BOOL,
3300 .def = "1",
3301 .help = "Save verify state on termination",
3302 .parent = "verify",
836fcc0f
JA
3303 .category = FIO_OPT_C_IO,
3304 .group = FIO_OPT_G_VERIFY,
51aa2da8 3305 },
0d29de83
JA
3306#ifdef FIO_HAVE_TRIM
3307 {
3308 .name = "trim_percentage",
e8b0e958 3309 .lname = "Trim percentage",
0d29de83 3310 .type = FIO_OPT_INT,
a609f12a 3311 .off1 = offsetof(struct thread_options, trim_percentage),
20eb06bd 3312 .minval = 0,
0d29de83 3313 .maxval = 100,
169c098d 3314 .help = "Number of verify blocks to trim (i.e., discard)",
0d29de83
JA
3315 .parent = "verify",
3316 .def = "0",
20eb06bd 3317 .interval = 1,
d71c154c 3318 .hide = 1,
e8b0e958
JA
3319 .category = FIO_OPT_C_IO,
3320 .group = FIO_OPT_G_TRIM,
0d29de83
JA
3321 },
3322 {
3323 .name = "trim_verify_zero",
e8b0e958 3324 .lname = "Verify trim zero",
20eb06bd 3325 .type = FIO_OPT_BOOL,
169c098d 3326 .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes",
a609f12a 3327 .off1 = offsetof(struct thread_options, trim_zero),
0d29de83 3328 .parent = "trim_percentage",
d71c154c 3329 .hide = 1,
0d29de83 3330 .def = "1",
e8b0e958
JA
3331 .category = FIO_OPT_C_IO,
3332 .group = FIO_OPT_G_TRIM,
0d29de83
JA
3333 },
3334 {
3335 .name = "trim_backlog",
e8b0e958 3336 .lname = "Trim backlog",
0d29de83 3337 .type = FIO_OPT_STR_VAL,
a609f12a 3338 .off1 = offsetof(struct thread_options, trim_backlog),
0d29de83
JA
3339 .help = "Trim after this number of blocks are written",
3340 .parent = "trim_percentage",
d71c154c 3341 .hide = 1,
20eb06bd 3342 .interval = 1,
e8b0e958
JA
3343 .category = FIO_OPT_C_IO,
3344 .group = FIO_OPT_G_TRIM,
0d29de83
JA
3345 },
3346 {
3347 .name = "trim_backlog_batch",
e8b0e958 3348 .lname = "Trim backlog batch",
0d29de83 3349 .type = FIO_OPT_INT,
a609f12a 3350 .off1 = offsetof(struct thread_options, trim_batch),
0d29de83
JA
3351 .help = "Trim this number of IO blocks",
3352 .parent = "trim_percentage",
d71c154c 3353 .hide = 1,
20eb06bd 3354 .interval = 1,
e8b0e958
JA
3355 .category = FIO_OPT_C_IO,
3356 .group = FIO_OPT_G_TRIM,
0d29de83 3357 },
a275c37a
JA
3358#else
3359 {
3360 .name = "trim_percentage",
3361 .lname = "Trim percentage",
3362 .type = FIO_OPT_UNSUPPORTED,
3363 .help = "Fio does not support TRIM on your platform",
3364 },
3365 {
3366 .name = "trim_verify_zero",
3367 .lname = "Verify trim zero",
3368 .type = FIO_OPT_UNSUPPORTED,
3369 .help = "Fio does not support TRIM on your platform",
3370 },
3371 {
3372 .name = "trim_backlog",
3373 .lname = "Trim backlog",
3374 .type = FIO_OPT_UNSUPPORTED,
3375 .help = "Fio does not support TRIM on your platform",
3376 },
3377 {
3378 .name = "trim_backlog_batch",
3379 .lname = "Trim backlog batch",
3380 .type = FIO_OPT_UNSUPPORTED,
3381 .help = "Fio does not support TRIM on your platform",
3382 },
e8462bd8 3383#endif
214e1eca
JA
3384 {
3385 .name = "write_iolog",
e8b0e958 3386 .lname = "Write I/O log",
214e1eca 3387 .type = FIO_OPT_STR_STORE,
a609f12a 3388 .off1 = offsetof(struct thread_options, write_iolog_file),
214e1eca 3389 .help = "Store IO pattern to file",
e8b0e958
JA
3390 .category = FIO_OPT_C_IO,
3391 .group = FIO_OPT_G_IOLOG,
214e1eca
JA
3392 },
3393 {
3394 .name = "read_iolog",
e8b0e958 3395 .lname = "Read I/O log",
214e1eca 3396 .type = FIO_OPT_STR_STORE,
a609f12a 3397 .off1 = offsetof(struct thread_options, read_iolog_file),
214e1eca 3398 .help = "Playback IO pattern from file",
e8b0e958
JA
3399 .category = FIO_OPT_C_IO,
3400 .group = FIO_OPT_G_IOLOG,
214e1eca 3401 },
98e7161c
AK
3402 {
3403 .name = "read_iolog_chunked",
3404 .lname = "Read I/O log in parts",
3405 .type = FIO_OPT_BOOL,
3406 .off1 = offsetof(struct thread_options, read_iolog_chunked),
3407 .def = "0",
3408 .parent = "read_iolog",
3409 .help = "Parse IO pattern in chunks",
3410 .category = FIO_OPT_C_IO,
3411 .group = FIO_OPT_G_IOLOG,
3412 },
64bbb865
DN
3413 {
3414 .name = "replay_no_stall",
e8b0e958 3415 .lname = "Don't stall on replay",
20eb06bd 3416 .type = FIO_OPT_BOOL,
a609f12a 3417 .off1 = offsetof(struct thread_options, no_stall),
64bbb865 3418 .def = "0",
87e7a972 3419 .parent = "read_iolog",
d71c154c 3420 .hide = 1,
64bbb865 3421 .help = "Playback IO pattern file as fast as possible without stalls",
e8b0e958
JA
3422 .category = FIO_OPT_C_IO,
3423 .group = FIO_OPT_G_IOLOG,
64bbb865 3424 },
d1c46c04
DN
3425 {
3426 .name = "replay_redirect",
e8b0e958 3427 .lname = "Redirect device for replay",
d1c46c04 3428 .type = FIO_OPT_STR_STORE,
a609f12a 3429 .off1 = offsetof(struct thread_options, replay_redirect),
d1c46c04 3430 .parent = "read_iolog",
d71c154c 3431 .hide = 1,
d1c46c04 3432 .help = "Replay all I/O onto this device, regardless of trace device",
e8b0e958
JA
3433 .category = FIO_OPT_C_IO,
3434 .group = FIO_OPT_G_IOLOG,
d1c46c04 3435 },
0c63576e
JA
3436 {
3437 .name = "replay_scale",
3438 .lname = "Replace offset scale factor",
3439 .type = FIO_OPT_INT,
a609f12a 3440 .off1 = offsetof(struct thread_options, replay_scale),
0c63576e
JA
3441 .parent = "read_iolog",
3442 .def = "1",
3443 .help = "Align offsets to this blocksize",
3444 .category = FIO_OPT_C_IO,
3445 .group = FIO_OPT_G_IOLOG,
3446 },
3447 {
3448 .name = "replay_align",
3449 .lname = "Replace alignment",
3450 .type = FIO_OPT_INT,
a609f12a 3451 .off1 = offsetof(struct thread_options, replay_align),
0c63576e
JA
3452 .parent = "read_iolog",
3453 .help = "Scale offset down by this factor",
3454 .category = FIO_OPT_C_IO,
3455 .group = FIO_OPT_G_IOLOG,
3456 .pow2 = 1,
3457 },
6dd7fa77
JA
3458 {
3459 .name = "replay_time_scale",
3460 .lname = "Replay Time Scale",
3461 .type = FIO_OPT_INT,
3462 .off1 = offsetof(struct thread_options, replay_time_scale),
3463 .def = "100",
3464 .minval = 1,
3465 .parent = "read_iolog",
3466 .hide = 1,
3467 .help = "Scale time for replay events",
3468 .category = FIO_OPT_C_IO,
3469 .group = FIO_OPT_G_IOLOG,
3470 },
d7235efb
JA
3471 {
3472 .name = "replay_skip",
3473 .lname = "Replay Skip",
3474 .type = FIO_OPT_STR,
3475 .cb = str_replay_skip_cb,
3476 .off1 = offsetof(struct thread_options, replay_skip),
3477 .parent = "read_iolog",
3478 .help = "Skip certain IO types (read,write,trim,flush)",
3479 .category = FIO_OPT_C_IO,
3480 .group = FIO_OPT_G_IOLOG,
3481 },
b9921d1a
DZ
3482 {
3483 .name = "merge_blktrace_file",
3484 .lname = "Merged blktrace output filename",
3485 .type = FIO_OPT_STR_STORE,
3486 .off1 = offsetof(struct thread_options, merge_blktrace_file),
3487 .help = "Merged blktrace output filename",
3488 .category = FIO_OPT_C_IO,
3489 .group = FIO_OPT_G_IOLOG,
3490 },
87a48ada
DZ
3491 {
3492 .name = "merge_blktrace_scalars",
3493 .lname = "Percentage to scale each trace",
3494 .type = FIO_OPT_FLOAT_LIST,
3495 .off1 = offsetof(struct thread_options, merge_blktrace_scalars),
3496 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3497 .help = "Percentage to scale each trace",
3498 .category = FIO_OPT_C_IO,
3499 .group = FIO_OPT_G_IOLOG,
3500 },
55bfd8c8
DZ
3501 {
3502 .name = "merge_blktrace_iters",
3503 .lname = "Number of iterations to run per trace",
3504 .type = FIO_OPT_FLOAT_LIST,
3505 .off1 = offsetof(struct thread_options, merge_blktrace_iters),
3506 .maxlen = FIO_IO_U_LIST_MAX_LEN,
3507 .help = "Number of iterations to run per trace",
3508 .category = FIO_OPT_C_IO,
3509 .group = FIO_OPT_G_IOLOG,
3510 },
214e1eca
JA
3511 {
3512 .name = "exec_prerun",
e8b0e958 3513 .lname = "Pre-execute runnable",
214e1eca 3514 .type = FIO_OPT_STR_STORE,
a609f12a 3515 .off1 = offsetof(struct thread_options, exec_prerun),
214e1eca 3516 .help = "Execute this file prior to running job",
e8b0e958
JA
3517 .category = FIO_OPT_C_GENERAL,
3518 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3519 },
3520 {
3521 .name = "exec_postrun",
e8b0e958 3522 .lname = "Post-execute runnable",
214e1eca 3523 .type = FIO_OPT_STR_STORE,
a609f12a 3524 .off1 = offsetof(struct thread_options, exec_postrun),
214e1eca 3525 .help = "Execute this file after running job",
e8b0e958
JA
3526 .category = FIO_OPT_C_GENERAL,
3527 .group = FIO_OPT_G_INVALID,
214e1eca
JA
3528 },
3529#ifdef FIO_HAVE_IOSCHED_SWITCH
3530 {
3531 .name = "ioscheduler",
e8b0e958 3532 .lname = "I/O scheduler",
214e1eca 3533 .type = FIO_OPT_STR_STORE,
a609f12a 3534 .off1 = offsetof(struct thread_options, ioscheduler),
214e1eca 3535 .help = "Use this IO scheduler on the backing device",
e8b0e958
JA
3536 .category = FIO_OPT_C_FILE,
3537 .group = FIO_OPT_G_INVALID,
214e1eca 3538 },
a275c37a
JA
3539#else
3540 {
3541 .name = "ioscheduler",
3542 .lname = "I/O scheduler",
3543 .type = FIO_OPT_UNSUPPORTED,
3544 .help = "Your platform does not support IO scheduler switching",
3545 },
214e1eca 3546#endif
7b865a2f
BVA
3547 {
3548 .name = "zonemode",
3549 .lname = "Zone mode",
3550 .help = "Mode for the zonesize, zonerange and zoneskip parameters",
3551 .type = FIO_OPT_STR,
3552 .off1 = offsetof(struct thread_options, zone_mode),
3553 .def = "none",
3554 .category = FIO_OPT_C_IO,
3555 .group = FIO_OPT_G_ZONE,
3556 .posval = {
3557 { .ival = "none",
3558 .oval = ZONE_MODE_NONE,
3559 .help = "no zoning",
3560 },
3561 { .ival = "strided",
3562 .oval = ZONE_MODE_STRIDED,
3563 .help = "strided mode - random I/O is restricted to a single zone",
3564 },
3565 { .ival = "zbd",
3566 .oval = ZONE_MODE_ZBD,
3567 .help = "zoned block device mode - random I/O selects one of multiple zones randomly",
3568 },
3569 },
3570 },
214e1eca
JA
3571 {
3572 .name = "zonesize",
e8b0e958 3573 .lname = "Zone size",
214e1eca 3574 .type = FIO_OPT_STR_VAL,
a609f12a 3575 .off1 = offsetof(struct thread_options, zone_size),
ed335855
SN
3576 .help = "Amount of data to read per zone",
3577 .def = "0",
20eb06bd 3578 .interval = 1024 * 1024,
e8b0e958
JA
3579 .category = FIO_OPT_C_IO,
3580 .group = FIO_OPT_G_ZONE,
ed335855 3581 },
b8dd9750
HH
3582 {
3583 .name = "zonecapacity",
3584 .lname = "Zone capacity",
3585 .type = FIO_OPT_STR_VAL,
3586 .off1 = offsetof(struct thread_options, zone_capacity),
3587 .help = "Capacity per zone",
3588 .def = "0",
3589 .interval = 1024 * 1024,
3590 .category = FIO_OPT_C_IO,
3591 .group = FIO_OPT_G_ZONE,
3592 },
ed335855
SN
3593 {
3594 .name = "zonerange",
e8b0e958 3595 .lname = "Zone range",
ed335855 3596 .type = FIO_OPT_STR_VAL,
a609f12a 3597 .off1 = offsetof(struct thread_options, zone_range),
214e1eca
JA
3598 .help = "Give size of an IO zone",
3599 .def = "0",
20eb06bd 3600 .interval = 1024 * 1024,
e8b0e958
JA
3601 .category = FIO_OPT_C_IO,
3602 .group = FIO_OPT_G_ZONE,
214e1eca
JA
3603 },
3604 {
3605 .name = "zoneskip",
e8b0e958 3606 .lname = "Zone skip",
8f39afa7
AD
3607 .type = FIO_OPT_STR_VAL_ZONE,
3608 .cb = str_zoneskip_cb,
a609f12a 3609 .off1 = offsetof(struct thread_options, zone_skip),
214e1eca
JA
3610 .help = "Space between IO zones",
3611 .def = "0",
e8b0e958
JA
3612 .category = FIO_OPT_C_IO,
3613 .group = FIO_OPT_G_ZONE,
214e1eca 3614 },
bfbdd35b
BVA
3615 {
3616 .name = "read_beyond_wp",
3617 .lname = "Allow reads beyond the zone write pointer",
3618 .type = FIO_OPT_BOOL,
3619 .off1 = offsetof(struct thread_options, read_beyond_wp),
3620 .help = "Allow reads beyond the zone write pointer",
3621 .def = "0",
3622 .category = FIO_OPT_C_IO,
3623 .group = FIO_OPT_G_INVALID,
3624 },
59b07544
BVA
3625 {
3626 .name = "max_open_zones",
219c662d 3627 .lname = "Per device/file maximum number of open zones",
59b07544
BVA
3628 .type = FIO_OPT_INT,
3629 .off1 = offsetof(struct thread_options, max_open_zones),
b7694961 3630 .maxval = ZBD_MAX_OPEN_ZONES,
219c662d
AD
3631 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd",
3632 .def = "0",
3633 .category = FIO_OPT_C_IO,
3634 .group = FIO_OPT_G_INVALID,
3635 },
3636 {
3637 .name = "job_max_open_zones",
3638 .lname = "Job maximum number of open zones",
3639 .type = FIO_OPT_INT,
3640 .off1 = offsetof(struct thread_options, job_max_open_zones),
3641 .maxval = ZBD_MAX_OPEN_ZONES,
3642 .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process",
59b07544
BVA
3643 .def = "0",
3644 .category = FIO_OPT_C_IO,
3645 .group = FIO_OPT_G_INVALID,
3646 },
575686bb
NC
3647 {
3648 .name = "ignore_zone_limits",
3649 .lname = "Ignore zone resource limits",
3650 .type = FIO_OPT_BOOL,
3651 .off1 = offsetof(struct thread_options, ignore_zone_limits),
3652 .def = "0",
3653 .help = "Ignore the zone resource limits (max open/active zones) reported by the device",
3654 .category = FIO_OPT_C_IO,
3655 .group = FIO_OPT_G_INVALID,
3656 },
a7c2b6fc
BVA
3657 {
3658 .name = "zone_reset_threshold",
3659 .lname = "Zone reset threshold",
3660 .help = "Zoned block device reset threshold",
3661 .type = FIO_OPT_FLOAT_LIST,
3662 .maxlen = 1,
3663 .off1 = offsetof(struct thread_options, zrt),
3664 .minfp = 0,
3665 .maxfp = 1,
3666 .category = FIO_OPT_C_IO,
3667 .group = FIO_OPT_G_ZONE,
3668 },
3669 {
3670 .name = "zone_reset_frequency",
3671 .lname = "Zone reset frequency",
3672 .help = "Zoned block device zone reset frequency in HZ",
3673 .type = FIO_OPT_FLOAT_LIST,
3674 .maxlen = 1,
3675 .off1 = offsetof(struct thread_options, zrf),
3676 .minfp = 0,
3677 .maxfp = 1,
3678 .category = FIO_OPT_C_IO,
3679 .group = FIO_OPT_G_ZONE,
3680 },
a7e8aae0
KB
3681 {
3682 .name = "fdp",
3683 .lname = "Flexible data placement",
3684 .type = FIO_OPT_BOOL,
3685 .off1 = offsetof(struct thread_options, fdp),
3686 .help = "Use Data placement directive (FDP)",
3687 .def = "0",
3688 .category = FIO_OPT_C_IO,
3689 .group = FIO_OPT_G_INVALID,
3690 },
3691 {
3692 .name = "fdp_pli",
3693 .lname = "FDP Placement ID indicies",
3694 .type = FIO_OPT_STR,
3695 .cb = str_fdp_pli_cb,
3696 .off1 = offsetof(struct thread_options, fdp_plis),
3697 .help = "Sets which placement ids to use (defaults to all)",
3698 .hide = 1,
3699 .category = FIO_OPT_C_IO,
3700 .group = FIO_OPT_G_INVALID,
3701 },
214e1eca
JA
3702 {
3703 .name = "lockmem",
e8b0e958 3704 .lname = "Lock memory",
214e1eca 3705 .type = FIO_OPT_STR_VAL,
a609f12a 3706 .off1 = offsetof(struct thread_options, lockmem),
81c6b6cd 3707 .help = "Lock down this amount of memory (per worker)",
214e1eca 3708 .def = "0",
20eb06bd 3709 .interval = 1024 * 1024,
e8b0e958
JA
3710 .category = FIO_OPT_C_GENERAL,
3711 .group = FIO_OPT_G_INVALID,
214e1eca 3712 },
214e1eca
JA
3713 {
3714 .name = "rwmixread",
e8b0e958 3715 .lname = "Read/write mix read",
214e1eca 3716 .type = FIO_OPT_INT,
cb499fc4 3717 .cb = str_rwmix_read_cb,
a609f12a 3718 .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]),
214e1eca
JA
3719 .maxval = 100,
3720 .help = "Percentage of mixed workload that is reads",
3721 .def = "50",
20eb06bd 3722 .interval = 5,
90265353 3723 .inverse = "rwmixwrite",
e8b0e958
JA
3724 .category = FIO_OPT_C_IO,
3725 .group = FIO_OPT_G_RWMIX,
214e1eca
JA
3726 },
3727 {
3728 .name = "rwmixwrite",
e8b0e958 3729 .lname = "Read/write mix write",
214e1eca 3730 .type = FIO_OPT_INT,
cb499fc4 3731 .cb = str_rwmix_write_cb,
a609f12a 3732 .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]),
214e1eca
JA
3733 .maxval = 100,
3734 .help = "Percentage of mixed workload that is writes",
3735 .def = "50",
20eb06bd 3736 .interval = 5,
90265353 3737 .inverse = "rwmixread",
e8b0e958
JA
3738 .category = FIO_OPT_C_IO,
3739 .group = FIO_OPT_G_RWMIX,
214e1eca 3740 },
afdf9352
JA
3741 {
3742 .name = "rwmixcycle",
e8b0e958 3743 .lname = "Read/write mix cycle",
15ca150e 3744 .type = FIO_OPT_DEPRECATED,
e8b0e958
JA
3745 .category = FIO_OPT_C_IO,
3746 .group = FIO_OPT_G_RWMIX,
afdf9352 3747 },
214e1eca
JA
3748 {
3749 .name = "nice",
e8b0e958 3750 .lname = "Nice",
214e1eca 3751 .type = FIO_OPT_INT,
a609f12a 3752 .off1 = offsetof(struct thread_options, nice),
214e1eca 3753 .help = "Set job CPU nice value",
11fd6aa8
RC
3754 .minval = -20,
3755 .maxval = 19,
214e1eca 3756 .def = "0",
20eb06bd 3757 .interval = 1,
e8b0e958 3758 .category = FIO_OPT_C_GENERAL,
10860056 3759 .group = FIO_OPT_G_CRED,
214e1eca
JA
3760 },
3761#ifdef FIO_HAVE_IOPRIO
3762 {
3763 .name = "prio",
e8b0e958 3764 .lname = "I/O nice priority",
214e1eca 3765 .type = FIO_OPT_INT,
a609f12a 3766 .off1 = offsetof(struct thread_options, ioprio),
214e1eca 3767 .help = "Set job IO priority value",
1767bd34
TK
3768 .minval = IOPRIO_MIN_PRIO,
3769 .maxval = IOPRIO_MAX_PRIO,
20eb06bd 3770 .interval = 1,
e8b0e958 3771 .category = FIO_OPT_C_GENERAL,
10860056 3772 .group = FIO_OPT_G_CRED,
214e1eca 3773 },
32ef447a
TK
3774#else
3775 {
3776 .name = "prio",
3777 .lname = "I/O nice priority",
3778 .type = FIO_OPT_UNSUPPORTED,
3779 .help = "Your platform does not support IO priorities",
3780 },
3781#endif
3782#ifdef FIO_HAVE_IOPRIO_CLASS
3783#ifndef FIO_HAVE_IOPRIO
3784#error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO"
3785#endif
214e1eca
JA
3786 {
3787 .name = "prioclass",
e8b0e958 3788 .lname = "I/O nice priority class",
214e1eca 3789 .type = FIO_OPT_INT,
a609f12a 3790 .off1 = offsetof(struct thread_options, ioprio_class),
214e1eca 3791 .help = "Set job IO priority class",
1767bd34
TK
3792 .minval = IOPRIO_MIN_PRIO_CLASS,
3793 .maxval = IOPRIO_MAX_PRIO_CLASS,
20eb06bd 3794 .interval = 1,
e8b0e958 3795 .category = FIO_OPT_C_GENERAL,
10860056 3796 .group = FIO_OPT_G_CRED,
214e1eca 3797 },
a275c37a 3798#else
a275c37a
JA
3799 {
3800 .name = "prioclass",
3801 .lname = "I/O nice priority class",
3802 .type = FIO_OPT_UNSUPPORTED,
32ef447a 3803 .help = "Your platform does not support IO priority classes",
a275c37a 3804 },
214e1eca
JA
3805#endif
3806 {
3807 .name = "thinktime",
e8b0e958 3808 .lname = "Thinktime",
214e1eca 3809 .type = FIO_OPT_INT,
a609f12a 3810 .off1 = offsetof(struct thread_options, thinktime),
214e1eca
JA
3811 .help = "Idle time between IO buffers (usec)",
3812 .def = "0",
88038bc7 3813 .is_time = 1,
e8b0e958 3814 .category = FIO_OPT_C_IO,
3ceb458f 3815 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
3816 },
3817 {
3818 .name = "thinktime_spin",
e8b0e958 3819 .lname = "Thinktime spin",
214e1eca 3820 .type = FIO_OPT_INT,
a609f12a 3821 .off1 = offsetof(struct thread_options, thinktime_spin),
214e1eca
JA
3822 .help = "Start think time by spinning this amount (usec)",
3823 .def = "0",
88038bc7 3824 .is_time = 1,
afdf9352 3825 .parent = "thinktime",
d71c154c 3826 .hide = 1,
e8b0e958 3827 .category = FIO_OPT_C_IO,
3ceb458f 3828 .group = FIO_OPT_G_THINKTIME,
214e1eca
JA
3829 },
3830 {
3831 .name = "thinktime_blocks",
e8b0e958 3832 .lname = "Thinktime blocks",
214e1eca 3833 .type = FIO_OPT_INT,
a609f12a 3834 .off1 = offsetof(struct thread_options, thinktime_blocks),
214e1eca
JA
3835 .help = "IO buffer period between 'thinktime'",
3836 .def = "1",
afdf9352 3837 .parent = "thinktime",
d71c154c 3838 .hide = 1,
e8b0e958 3839 .category = FIO_OPT_C_IO,
3ceb458f 3840 .group = FIO_OPT_G_THINKTIME,
214e1eca 3841 },
33f42c20
HQ
3842 {
3843 .name = "thinktime_blocks_type",
3844 .lname = "Thinktime blocks type",
3845 .type = FIO_OPT_STR,
3846 .off1 = offsetof(struct thread_options, thinktime_blocks_type),
3847 .help = "How thinktime_blocks takes effect",
3848 .def = "complete",
3849 .category = FIO_OPT_C_IO,
3850 .group = FIO_OPT_G_THINKTIME,
3851 .posval = {
3852 { .ival = "complete",
3853 .oval = THINKTIME_BLOCKS_TYPE_COMPLETE,
3854 .help = "thinktime_blocks takes effect at the completion side",
3855 },
3856 {
3857 .ival = "issue",
3858 .oval = THINKTIME_BLOCKS_TYPE_ISSUE,
3859 .help = "thinktime_blocks takes effect at the issue side",
3860 },
3861 },
3862 .parent = "thinktime",
3863 },
f7942acd
SK
3864 {
3865 .name = "thinktime_iotime",
3866 .lname = "Thinktime interval",
3867 .type = FIO_OPT_INT,
3868 .off1 = offsetof(struct thread_options, thinktime_iotime),
3869 .help = "IO time interval between 'thinktime'",
3870 .def = "0",
3871 .parent = "thinktime",
3872 .hide = 1,
3873 .is_seconds = 1,
3874 .is_time = 1,
3875 .category = FIO_OPT_C_IO,
3876 .group = FIO_OPT_G_THINKTIME,
3877 },
214e1eca
JA
3878 {
3879 .name = "rate",
e8b0e958 3880 .lname = "I/O rate",
140a6888 3881 .type = FIO_OPT_ULL,
a609f12a
JA
3882 .off1 = offsetof(struct thread_options, rate[DDIR_READ]),
3883 .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]),
3884 .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]),
214e1eca 3885 .help = "Set bandwidth rate",
e8b0e958
JA
3886 .category = FIO_OPT_C_IO,
3887 .group = FIO_OPT_G_RATE,
214e1eca
JA
3888 },
3889 {
6d428bcd
JA
3890 .name = "rate_min",
3891 .alias = "ratemin",
e8b0e958 3892 .lname = "I/O min rate",
140a6888 3893 .type = FIO_OPT_ULL,
a609f12a
JA
3894 .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]),
3895 .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]),
3896 .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]),
4e991c23 3897 .help = "Job must meet this rate or it will be shutdown",
afdf9352 3898 .parent = "rate",
d71c154c 3899 .hide = 1,
e8b0e958
JA
3900 .category = FIO_OPT_C_IO,
3901 .group = FIO_OPT_G_RATE,
4e991c23
JA
3902 },
3903 {
3904 .name = "rate_iops",
e8b0e958 3905 .lname = "I/O rate IOPS",
e01b22b8 3906 .type = FIO_OPT_INT,
a609f12a
JA
3907 .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]),
3908 .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]),
3909 .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]),
4e991c23 3910 .help = "Limit IO used to this number of IO operations/sec",
d71c154c 3911 .hide = 1,
e8b0e958
JA
3912 .category = FIO_OPT_C_IO,
3913 .group = FIO_OPT_G_RATE,
4e991c23
JA
3914 },
3915 {
3916 .name = "rate_iops_min",
e8b0e958 3917 .lname = "I/O min rate IOPS",
e01b22b8 3918 .type = FIO_OPT_INT,
a609f12a
JA
3919 .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]),
3920 .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]),
3921 .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]),
03e20d68 3922 .help = "Job must meet this rate or it will be shut down",
afdf9352 3923 .parent = "rate_iops",
d71c154c 3924 .hide = 1,
e8b0e958
JA
3925 .category = FIO_OPT_C_IO,
3926 .group = FIO_OPT_G_RATE,
214e1eca 3927 },
ff6bb260 3928 {
6de65959
JA
3929 .name = "rate_process",
3930 .lname = "Rate Process",
3931 .type = FIO_OPT_STR,
a609f12a 3932 .off1 = offsetof(struct thread_options, rate_process),
6de65959
JA
3933 .help = "What process controls how rated IO is managed",
3934 .def = "linear",
ff6bb260
SL
3935 .category = FIO_OPT_C_IO,
3936 .group = FIO_OPT_G_RATE,
6de65959
JA
3937 .posval = {
3938 { .ival = "linear",
3939 .oval = RATE_PROCESS_LINEAR,
3940 .help = "Linear rate of IO",
3941 },
3942 {
3943 .ival = "poisson",
3944 .oval = RATE_PROCESS_POISSON,
3945 .help = "Rate follows Poisson process",
3946 },
3947 },
3948 .parent = "rate",
ff6bb260 3949 },
214e1eca 3950 {
6d428bcd
JA
3951 .name = "rate_cycle",
3952 .alias = "ratecycle",
e8b0e958 3953 .lname = "I/O rate cycle",
214e1eca 3954 .type = FIO_OPT_INT,
a609f12a 3955 .off1 = offsetof(struct thread_options, ratecycle),
214e1eca
JA
3956 .help = "Window average for rate limits (msec)",
3957 .def = "1000",
afdf9352 3958 .parent = "rate",
d71c154c 3959 .hide = 1,
e8b0e958
JA
3960 .category = FIO_OPT_C_IO,
3961 .group = FIO_OPT_G_RATE,
214e1eca 3962 },
1a9bf814
JA
3963 {
3964 .name = "rate_ignore_thinktime",
3965 .lname = "Rate ignore thinktime",
3966 .type = FIO_OPT_BOOL,
3967 .off1 = offsetof(struct thread_options, rate_ign_think),
3968 .help = "Rated IO ignores thinktime settings",
3969 .parent = "rate",
3970 .category = FIO_OPT_C_IO,
3971 .group = FIO_OPT_G_RATE,
3972 },
15501535
JA
3973 {
3974 .name = "max_latency",
dd97d866 3975 .lname = "Max Latency (usec)",
f7cf63bf
VR
3976 .type = FIO_OPT_ULL,
3977 .off1 = offsetof(struct thread_options, max_latency[DDIR_READ]),
3978 .off2 = offsetof(struct thread_options, max_latency[DDIR_WRITE]),
3979 .off3 = offsetof(struct thread_options, max_latency[DDIR_TRIM]),
15501535 3980 .help = "Maximum tolerated IO latency (usec)",
88038bc7 3981 .is_time = 1,
1e5324e7 3982 .category = FIO_OPT_C_IO,
3e260a46
JA
3983 .group = FIO_OPT_G_LATPROF,
3984 },
3985 {
3986 .name = "latency_target",
3987 .lname = "Latency Target (usec)",
3988 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 3989 .off1 = offsetof(struct thread_options, latency_target),
3e260a46 3990 .help = "Ramp to max queue depth supporting this latency",
88038bc7 3991 .is_time = 1,
3e260a46
JA
3992 .category = FIO_OPT_C_IO,
3993 .group = FIO_OPT_G_LATPROF,
3994 },
3995 {
3996 .name = "latency_window",
3997 .lname = "Latency Window (usec)",
3998 .type = FIO_OPT_STR_VAL_TIME,
a609f12a 3999 .off1 = offsetof(struct thread_options, latency_window),
3e260a46 4000 .help = "Time to sustain latency_target",
88038bc7 4001 .is_time = 1,
3e260a46
JA
4002 .category = FIO_OPT_C_IO,
4003 .group = FIO_OPT_G_LATPROF,
4004 },
4005 {
4006 .name = "latency_percentile",
4007 .lname = "Latency Percentile",
4008 .type = FIO_OPT_FLOAT_LIST,
a609f12a 4009 .off1 = offsetof(struct thread_options, latency_percentile),
3e260a46
JA
4010 .help = "Percentile of IOs must be below latency_target",
4011 .def = "100",
4012 .maxlen = 1,
4013 .minfp = 0.0,
4014 .maxfp = 100.0,
4015 .category = FIO_OPT_C_IO,
4016 .group = FIO_OPT_G_LATPROF,
15501535 4017 },
e1bcd541
SL
4018 {
4019 .name = "latency_run",
4020 .lname = "Latency Run",
4021 .type = FIO_OPT_BOOL,
4022 .off1 = offsetof(struct thread_options, latency_run),
4023 .help = "Keep adjusting queue depth to match latency_target",
4024 .def = "0",
4025 .category = FIO_OPT_C_IO,
4026 .group = FIO_OPT_G_LATPROF,
4027 },
214e1eca
JA
4028 {
4029 .name = "invalidate",
e8b0e958 4030 .lname = "Cache invalidate",
214e1eca 4031 .type = FIO_OPT_BOOL,
a609f12a 4032 .off1 = offsetof(struct thread_options, invalidate_cache),
214e1eca
JA
4033 .help = "Invalidate buffer/page cache prior to running job",
4034 .def = "1",
e8b0e958 4035 .category = FIO_OPT_C_IO,
3ceb458f 4036 .group = FIO_OPT_G_IO_TYPE,
214e1eca
JA
4037 },
4038 {
4039 .name = "sync",
e8b0e958 4040 .lname = "Synchronous I/O",
eb9f8d7f 4041 .type = FIO_OPT_STR,
a609f12a 4042 .off1 = offsetof(struct thread_options, sync_io),
eb9f8d7f
AF
4043 .help = "Use synchronous write IO",
4044 .def = "none",
d71c154c 4045 .hide = 1,
e8b0e958 4046 .category = FIO_OPT_C_IO,
3ceb458f 4047 .group = FIO_OPT_G_IO_TYPE,
eb9f8d7f
AF
4048 .posval = {
4049 { .ival = "none",
4050 .oval = 0,
4051 },
4052 { .ival = "0",
4053 .oval = 0,
4054 },
4055 { .ival = "sync",
4056 .oval = O_SYNC,
4057 },
4058 { .ival = "1",
4059 .oval = O_SYNC,
4060 },
4061#ifdef O_DSYNC
4062 { .ival = "dsync",
4063 .oval = O_DSYNC,
4064 },
4065#endif
4066 },
214e1eca 4067 },
ae8e559e
JA
4068#ifdef FIO_HAVE_WRITE_HINT
4069 {
4070 .name = "write_hint",
4071 .lname = "Write hint",
4072 .type = FIO_OPT_STR,
4073 .off1 = offsetof(struct thread_options, write_hint),
4074 .help = "Set expected write life time",
4075 .category = FIO_OPT_C_ENGINE,
4076 .group = FIO_OPT_G_INVALID,
4077 .posval = {
4078 { .ival = "none",
4079 .oval = RWH_WRITE_LIFE_NONE,
4080 },
4081 { .ival = "short",
4082 .oval = RWH_WRITE_LIFE_SHORT,
4083 },
4084 { .ival = "medium",
4085 .oval = RWH_WRITE_LIFE_MEDIUM,
4086 },
4087 { .ival = "long",
4088 .oval = RWH_WRITE_LIFE_LONG,
4089 },
4090 { .ival = "extreme",
4091 .oval = RWH_WRITE_LIFE_EXTREME,
4092 },
4093 },
4094 },
4095#endif
214e1eca
JA
4096 {
4097 .name = "create_serialize",
e8b0e958 4098 .lname = "Create serialize",
214e1eca 4099 .type = FIO_OPT_BOOL,
a609f12a 4100 .off1 = offsetof(struct thread_options, create_serialize),
c2b8035f 4101 .help = "Serialize creation of job files",
214e1eca 4102 .def = "1",
e8b0e958
JA
4103 .category = FIO_OPT_C_FILE,
4104 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4105 },
4106 {
4107 .name = "create_fsync",
e8b0e958 4108 .lname = "Create fsync",
214e1eca 4109 .type = FIO_OPT_BOOL,
a609f12a 4110 .off1 = offsetof(struct thread_options, create_fsync),
03e20d68 4111 .help = "fsync file after creation",
214e1eca 4112 .def = "1",
e8b0e958
JA
4113 .category = FIO_OPT_C_FILE,
4114 .group = FIO_OPT_G_INVALID,
214e1eca 4115 },
814452bd
JA
4116 {
4117 .name = "create_on_open",
e8b0e958 4118 .lname = "Create on open",
814452bd 4119 .type = FIO_OPT_BOOL,
a609f12a 4120 .off1 = offsetof(struct thread_options, create_on_open),
814452bd
JA
4121 .help = "Create files when they are opened for IO",
4122 .def = "0",
e8b0e958
JA
4123 .category = FIO_OPT_C_FILE,
4124 .group = FIO_OPT_G_INVALID,
814452bd 4125 },
25460cf6
JA
4126 {
4127 .name = "create_only",
cce2fdfe 4128 .lname = "Create Only",
25460cf6 4129 .type = FIO_OPT_BOOL,
a609f12a 4130 .off1 = offsetof(struct thread_options, create_only),
25460cf6 4131 .help = "Only perform file creation phase",
d17fda71 4132 .category = FIO_OPT_C_FILE,
25460cf6
JA
4133 .def = "0",
4134 },
2378826d
JA
4135 {
4136 .name = "allow_file_create",
e81ecca3 4137 .lname = "Allow file create",
2378826d 4138 .type = FIO_OPT_BOOL,
a609f12a 4139 .off1 = offsetof(struct thread_options, allow_create),
2378826d
JA
4140 .help = "Permit fio to create files, if they don't exist",
4141 .def = "1",
4142 .category = FIO_OPT_C_FILE,
4143 .group = FIO_OPT_G_FILENAME,
4144 },
e81ecca3
JA
4145 {
4146 .name = "allow_mounted_write",
4147 .lname = "Allow mounted write",
4148 .type = FIO_OPT_BOOL,
a609f12a 4149 .off1 = offsetof(struct thread_options, allow_mounted_write),
e81ecca3
JA
4150 .help = "Allow writes to a mounted partition",
4151 .def = "0",
4152 .category = FIO_OPT_C_FILE,
4153 .group = FIO_OPT_G_FILENAME,
4154 },
0b9d69ec 4155 {
afad68f7 4156 .name = "pre_read",
e8b0e958 4157 .lname = "Pre-read files",
afad68f7 4158 .type = FIO_OPT_BOOL,
a609f12a 4159 .off1 = offsetof(struct thread_options, pre_read),
03e20d68 4160 .help = "Pre-read files before starting official testing",
afad68f7 4161 .def = "0",
e8b0e958
JA
4162 .category = FIO_OPT_C_FILE,
4163 .group = FIO_OPT_G_INVALID,
afad68f7 4164 },
214e1eca
JA
4165#ifdef FIO_HAVE_CPU_AFFINITY
4166 {
4167 .name = "cpumask",
e8b0e958 4168 .lname = "CPU mask",
214e1eca
JA
4169 .type = FIO_OPT_INT,
4170 .cb = str_cpumask_cb,
a609f12a 4171 .off1 = offsetof(struct thread_options, cpumask),
214e1eca 4172 .help = "CPU affinity mask",
e8b0e958 4173 .category = FIO_OPT_C_GENERAL,
10860056 4174 .group = FIO_OPT_G_CRED,
214e1eca 4175 },
d2e268b0
JA
4176 {
4177 .name = "cpus_allowed",
e8b0e958 4178 .lname = "CPUs allowed",
d2e268b0
JA
4179 .type = FIO_OPT_STR,
4180 .cb = str_cpus_allowed_cb,
a609f12a 4181 .off1 = offsetof(struct thread_options, cpumask),
d2e268b0 4182 .help = "Set CPUs allowed",
e8b0e958 4183 .category = FIO_OPT_C_GENERAL,
10860056 4184 .group = FIO_OPT_G_CRED,
d2e268b0 4185 },
c2acfbac
JA
4186 {
4187 .name = "cpus_allowed_policy",
4188 .lname = "CPUs allowed distribution policy",
4189 .type = FIO_OPT_STR,
a609f12a 4190 .off1 = offsetof(struct thread_options, cpus_allowed_policy),
c2acfbac
JA
4191 .help = "Distribution policy for cpus_allowed",
4192 .parent = "cpus_allowed",
4193 .prio = 1,
4194 .posval = {
4195 { .ival = "shared",
4196 .oval = FIO_CPUS_SHARED,
4197 .help = "Mask shared between threads",
4198 },
4199 { .ival = "split",
4200 .oval = FIO_CPUS_SPLIT,
4201 .help = "Mask split between threads",
4202 },
4203 },
4204 .category = FIO_OPT_C_GENERAL,
4205 .group = FIO_OPT_G_CRED,
4206 },
a275c37a
JA
4207#else
4208 {
4209 .name = "cpumask",
4210 .lname = "CPU mask",
4211 .type = FIO_OPT_UNSUPPORTED,
4212 .help = "Your platform does not support CPU affinities",
4213 },
4214 {
4215 .name = "cpus_allowed",
4216 .lname = "CPUs allowed",
4217 .type = FIO_OPT_UNSUPPORTED,
4218 .help = "Your platform does not support CPU affinities",
4219 },
4220 {
4221 .name = "cpus_allowed_policy",
4222 .lname = "CPUs allowed distribution policy",
4223 .type = FIO_OPT_UNSUPPORTED,
4224 .help = "Your platform does not support CPU affinities",
4225 },
d0b937ed 4226#endif
67bf9823 4227#ifdef CONFIG_LIBNUMA
d0b937ed
YR
4228 {
4229 .name = "numa_cpu_nodes",
cce2fdfe 4230 .lname = "NUMA CPU Nodes",
d0b937ed
YR
4231 .type = FIO_OPT_STR,
4232 .cb = str_numa_cpunodes_cb,
a609f12a 4233 .off1 = offsetof(struct thread_options, numa_cpunodes),
d0b937ed 4234 .help = "NUMA CPU nodes bind",
6be54b2d
JA
4235 .category = FIO_OPT_C_GENERAL,
4236 .group = FIO_OPT_G_INVALID,
d0b937ed
YR
4237 },
4238 {
4239 .name = "numa_mem_policy",
cce2fdfe 4240 .lname = "NUMA Memory Policy",
d0b937ed
YR
4241 .type = FIO_OPT_STR,
4242 .cb = str_numa_mpol_cb,
a609f12a 4243 .off1 = offsetof(struct thread_options, numa_memnodes),
d0b937ed 4244 .help = "NUMA memory policy setup",
6be54b2d
JA
4245 .category = FIO_OPT_C_GENERAL,
4246 .group = FIO_OPT_G_INVALID,
d0b937ed 4247 },
a275c37a
JA
4248#else
4249 {
4250 .name = "numa_cpu_nodes",
4251 .lname = "NUMA CPU Nodes",
4252 .type = FIO_OPT_UNSUPPORTED,
4253 .help = "Build fio with libnuma-dev(el) to enable this option",
4254 },
4255 {
4256 .name = "numa_mem_policy",
4257 .lname = "NUMA Memory Policy",
4258 .type = FIO_OPT_UNSUPPORTED,
4259 .help = "Build fio with libnuma-dev(el) to enable this option",
4260 },
03553853
YR
4261#endif
4262#ifdef CONFIG_CUDA
4263 {
4264 .name = "gpu_dev_id",
4265 .lname = "GPU device ID",
4266 .type = FIO_OPT_INT,
4267 .off1 = offsetof(struct thread_options, gpu_dev_id),
4268 .help = "Set GPU device ID for GPUDirect RDMA",
4269 .def = "0",
4270 .category = FIO_OPT_C_GENERAL,
4271 .group = FIO_OPT_G_INVALID,
4272 },
214e1eca
JA
4273#endif
4274 {
4275 .name = "end_fsync",
e8b0e958 4276 .lname = "End fsync",
214e1eca 4277 .type = FIO_OPT_BOOL,
a609f12a 4278 .off1 = offsetof(struct thread_options, end_fsync),
214e1eca
JA
4279 .help = "Include fsync at the end of job",
4280 .def = "0",
e8b0e958
JA
4281 .category = FIO_OPT_C_FILE,
4282 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4283 },
4284 {
4285 .name = "fsync_on_close",
e8b0e958 4286 .lname = "Fsync on close",
214e1eca 4287 .type = FIO_OPT_BOOL,
a609f12a 4288 .off1 = offsetof(struct thread_options, fsync_on_close),
214e1eca
JA
4289 .help = "fsync files on close",
4290 .def = "0",
e8b0e958
JA
4291 .category = FIO_OPT_C_FILE,
4292 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4293 },
4294 {
4295 .name = "unlink",
e8b0e958 4296 .lname = "Unlink file",
214e1eca 4297 .type = FIO_OPT_BOOL,
a609f12a 4298 .off1 = offsetof(struct thread_options, unlink),
214e1eca
JA
4299 .help = "Unlink created files after job has completed",
4300 .def = "0",
e8b0e958
JA
4301 .category = FIO_OPT_C_FILE,
4302 .group = FIO_OPT_G_INVALID,
214e1eca 4303 },
39c1c323 4304 {
4305 .name = "unlink_each_loop",
4306 .lname = "Unlink file after each loop of a job",
4307 .type = FIO_OPT_BOOL,
a609f12a 4308 .off1 = offsetof(struct thread_options, unlink_each_loop),
39c1c323 4309 .help = "Unlink created files after each loop in a job has completed",
4310 .def = "0",
4311 .category = FIO_OPT_C_FILE,
4312 .group = FIO_OPT_G_INVALID,
4313 },
214e1eca
JA
4314 {
4315 .name = "exitall",
e8b0e958 4316 .lname = "Exit-all on terminate",
214e1eca
JA
4317 .type = FIO_OPT_STR_SET,
4318 .cb = str_exitall_cb,
4319 .help = "Terminate all jobs when one exits",
e8b0e958 4320 .category = FIO_OPT_C_GENERAL,
a1f6afec 4321 .group = FIO_OPT_G_PROCESS,
214e1eca 4322 },
64402a8a
HW
4323 {
4324 .name = "exit_what",
4325 .lname = "What jobs to quit on terminate",
4326 .type = FIO_OPT_STR,
4327 .off1 = offsetof(struct thread_options, exit_what),
4328 .help = "Fine-grained control for exitall",
4329 .def = "group",
4330 .category = FIO_OPT_C_GENERAL,
4331 .group = FIO_OPT_G_PROCESS,
4332 .posval = {
4333 { .ival = "group",
4334 .oval = TERMINATE_GROUP,
4335 .help = "exit_all=1 default behaviour",
4336 },
4337 { .ival = "stonewall",
4338 .oval = TERMINATE_STONEWALL,
4339 .help = "quit all currently running jobs; continue with next stonewall",
4340 },
4341 { .ival = "all",
4342 .oval = TERMINATE_ALL,
4343 .help = "Quit everything",
4344 },
4345 },
4346 },
f9cafb12
JA
4347 {
4348 .name = "exitall_on_error",
4349 .lname = "Exit-all on terminate in error",
78abcf9b 4350 .type = FIO_OPT_STR_SET,
a609f12a 4351 .off1 = offsetof(struct thread_options, exitall_error),
f9cafb12
JA
4352 .help = "Terminate all jobs when one exits in error",
4353 .category = FIO_OPT_C_GENERAL,
4354 .group = FIO_OPT_G_PROCESS,
4355 },
214e1eca
JA
4356 {
4357 .name = "stonewall",
e8b0e958 4358 .lname = "Wait for previous",
d392365e 4359 .alias = "wait_for_previous",
214e1eca 4360 .type = FIO_OPT_STR_SET,
a609f12a 4361 .off1 = offsetof(struct thread_options, stonewall),
214e1eca 4362 .help = "Insert a hard barrier between this job and previous",
e8b0e958 4363 .category = FIO_OPT_C_GENERAL,
a1f6afec 4364 .group = FIO_OPT_G_PROCESS,
214e1eca 4365 },
b3d62a75
JA
4366 {
4367 .name = "new_group",
e8b0e958 4368 .lname = "New group",
b3d62a75 4369 .type = FIO_OPT_STR_SET,
a609f12a 4370 .off1 = offsetof(struct thread_options, new_group),
b3d62a75 4371 .help = "Mark the start of a new group (for reporting)",
e8b0e958 4372 .category = FIO_OPT_C_GENERAL,
a1f6afec 4373 .group = FIO_OPT_G_PROCESS,
b3d62a75 4374 },
214e1eca
JA
4375 {
4376 .name = "thread",
e8b0e958 4377 .lname = "Thread",
214e1eca 4378 .type = FIO_OPT_STR_SET,
a609f12a 4379 .off1 = offsetof(struct thread_options, use_thread),
20eb06bd 4380 .help = "Use threads instead of processes",
c8931876
JA
4381#ifdef CONFIG_NO_SHM
4382 .def = "1",
4383 .no_warn_def = 1,
4384#endif
e8b0e958 4385 .category = FIO_OPT_C_GENERAL,
a1f6afec 4386 .group = FIO_OPT_G_PROCESS,
214e1eca 4387 },
3a5db920
JA
4388 {
4389 .name = "per_job_logs",
cce2fdfe 4390 .lname = "Per Job Logs",
3a5db920 4391 .type = FIO_OPT_BOOL,
a609f12a 4392 .off1 = offsetof(struct thread_options, per_job_logs),
3a5db920
JA
4393 .help = "Include job number in generated log files or not",
4394 .def = "1",
4395 .category = FIO_OPT_C_LOG,
4396 .group = FIO_OPT_G_INVALID,
4397 },
214e1eca
JA
4398 {
4399 .name = "write_bw_log",
e8b0e958 4400 .lname = "Write bandwidth log",
dded427c 4401 .type = FIO_OPT_STR,
a609f12a 4402 .off1 = offsetof(struct thread_options, bw_log_file),
dded427c 4403 .cb = str_write_bw_log_cb,
214e1eca 4404 .help = "Write log of bandwidth during run",
e8b0e958
JA
4405 .category = FIO_OPT_C_LOG,
4406 .group = FIO_OPT_G_INVALID,
214e1eca
JA
4407 },
4408 {
4409 .name = "write_lat_log",
e8b0e958 4410 .lname = "Write latency log",
dded427c 4411 .type = FIO_OPT_STR,
a609f12a 4412 .off1 = offsetof(struct thread_options, lat_log_file),
dded427c 4413 .cb = str_write_lat_log_cb,
214e1eca 4414 .help = "Write log of latency during run",
e8b0e958
JA
4415 .category = FIO_OPT_C_LOG,
4416 .group = FIO_OPT_G_INVALID,
214e1eca 4417 },
c8eeb9df
JA
4418 {
4419 .name = "write_iops_log",
e8b0e958 4420 .lname = "Write IOPS log",
dded427c 4421 .type = FIO_OPT_STR,
a609f12a 4422 .off1 = offsetof(struct thread_options, iops_log_file),
dded427c 4423 .cb = str_write_iops_log_cb,
c8eeb9df 4424 .help = "Write log of IOPS during run",
e8b0e958
JA
4425 .category = FIO_OPT_C_LOG,
4426 .group = FIO_OPT_G_INVALID,
c8eeb9df 4427 },
0a852a50
DLM
4428 {
4429 .name = "log_entries",
4430 .lname = "Log entries",
4431 .type = FIO_OPT_INT,
4432 .off1 = offsetof(struct thread_options, log_entries),
4433 .help = "Initial number of entries in a job IO log",
4434 .def = __fio_stringify(DEF_LOG_ENTRIES),
4435 .minval = DEF_LOG_ENTRIES,
4436 .maxval = MAX_LOG_ENTRIES,
4437 .category = FIO_OPT_C_LOG,
4438 .group = FIO_OPT_G_INVALID,
4439 },
b8bc8cba
JA
4440 {
4441 .name = "log_avg_msec",
e8b0e958 4442 .lname = "Log averaging (msec)",
b8bc8cba 4443 .type = FIO_OPT_INT,
a609f12a 4444 .off1 = offsetof(struct thread_options, log_avg_msec),
b8bc8cba
JA
4445 .help = "Average bw/iops/lat logs over this period of time",
4446 .def = "0",
e8b0e958 4447 .category = FIO_OPT_C_LOG,
1e613c9c
KC
4448 .group = FIO_OPT_G_INVALID,
4449 },
4450 {
4451 .name = "log_hist_msec",
4452 .lname = "Log histograms (msec)",
4453 .type = FIO_OPT_INT,
a609f12a 4454 .off1 = offsetof(struct thread_options, log_hist_msec),
1e613c9c
KC
4455 .help = "Dump completion latency histograms at frequency of this time value",
4456 .def = "0",
4457 .category = FIO_OPT_C_LOG,
4458 .group = FIO_OPT_G_INVALID,
4459 },
4460 {
4461 .name = "log_hist_coarseness",
4462 .lname = "Histogram logs coarseness",
4463 .type = FIO_OPT_INT,
a609f12a 4464 .off1 = offsetof(struct thread_options, log_hist_coarseness),
1e613c9c
KC
4465 .help = "Integer in range [0,6]. Higher coarseness outputs"
4466 " fewer histogram bins per sample. The number of bins for"
4467 " these are [1216, 608, 304, 152, 76, 38, 19] respectively.",
4468 .def = "0",
4469 .category = FIO_OPT_C_LOG,
4470 .group = FIO_OPT_G_INVALID,
4471 },
4472 {
4473 .name = "write_hist_log",
4474 .lname = "Write latency histogram logs",
dded427c 4475 .type = FIO_OPT_STR,
a609f12a 4476 .off1 = offsetof(struct thread_options, hist_log_file),
dded427c 4477 .cb = str_write_hist_log_cb,
1e613c9c
KC
4478 .help = "Write log of latency histograms during run",
4479 .category = FIO_OPT_C_LOG,
e8b0e958 4480 .group = FIO_OPT_G_INVALID,
b8bc8cba 4481 },
e6989e10
JA
4482 {
4483 .name = "log_max_value",
4484 .lname = "Log maximum instead of average",
4485 .type = FIO_OPT_BOOL,
a609f12a 4486 .off1 = offsetof(struct thread_options, log_max),
e6989e10
JA
4487 .help = "Log max sample in a window instead of average",
4488 .def = "0",
4489 .category = FIO_OPT_C_LOG,
4490 .group = FIO_OPT_G_INVALID,
4491 },
ae588852
JA
4492 {
4493 .name = "log_offset",
4494 .lname = "Log offset of IO",
4495 .type = FIO_OPT_BOOL,
a609f12a 4496 .off1 = offsetof(struct thread_options, log_offset),
ae588852
JA
4497 .help = "Include offset of IO for each log entry",
4498 .def = "0",
4499 .category = FIO_OPT_C_LOG,
4500 .group = FIO_OPT_G_INVALID,
4501 },
03ec570f
DLM
4502 {
4503 .name = "log_prio",
4504 .lname = "Log priority of IO",
4505 .type = FIO_OPT_BOOL,
4506 .off1 = offsetof(struct thread_options, log_prio),
4507 .help = "Include priority value of IO for each log entry",
4508 .def = "0",
4509 .category = FIO_OPT_C_LOG,
4510 .group = FIO_OPT_G_INVALID,
4511 },
aee2ab67
JA
4512#ifdef CONFIG_ZLIB
4513 {
4514 .name = "log_compression",
4515 .lname = "Log compression",
4516 .type = FIO_OPT_INT,
a609f12a 4517 .off1 = offsetof(struct thread_options, log_gz),
aee2ab67 4518 .help = "Log in compressed chunks of this size",
9919b27b 4519 .minval = 1024ULL,
aee2ab67
JA
4520 .maxval = 512 * 1024 * 1024ULL,
4521 .category = FIO_OPT_C_LOG,
4522 .group = FIO_OPT_G_INVALID,
4523 },
c08f9fe2
JA
4524#ifdef FIO_HAVE_CPU_AFFINITY
4525 {
4526 .name = "log_compression_cpus",
4527 .lname = "Log Compression CPUs",
4528 .type = FIO_OPT_STR,
4529 .cb = str_log_cpus_allowed_cb,
a609f12a 4530 .off1 = offsetof(struct thread_options, log_gz_cpumask),
c08f9fe2
JA
4531 .parent = "log_compression",
4532 .help = "Limit log compression to these CPUs",
4533 .category = FIO_OPT_C_LOG,
4534 .group = FIO_OPT_G_INVALID,
4535 },
a275c37a
JA
4536#else
4537 {
4538 .name = "log_compression_cpus",
4539 .lname = "Log Compression CPUs",
4540 .type = FIO_OPT_UNSUPPORTED,
4541 .help = "Your platform does not support CPU affinities",
4542 },
c08f9fe2 4543#endif
b26317c9
JA
4544 {
4545 .name = "log_store_compressed",
4546 .lname = "Log store compressed",
4547 .type = FIO_OPT_BOOL,
a609f12a 4548 .off1 = offsetof(struct thread_options, log_gz_store),
b26317c9
JA
4549 .help = "Store logs in a compressed format",
4550 .category = FIO_OPT_C_LOG,
4551 .group = FIO_OPT_G_INVALID,
4552 },
a275c37a
JA
4553#else
4554 {
4555 .name = "log_compression",
4556 .lname = "Log compression",
4557 .type = FIO_OPT_UNSUPPORTED,
4558 .help = "Install libz-dev(el) to get compression support",
4559 },
4560 {
4561 .name = "log_store_compressed",
4562 .lname = "Log store compressed",
4563 .type = FIO_OPT_UNSUPPORTED,
4564 .help = "Install libz-dev(el) to get compression support",
4565 },
aee2ab67 4566#endif
3aea75b1
KC
4567 {
4568 .name = "log_unix_epoch",
4569 .lname = "Log epoch unix",
4570 .type = FIO_OPT_BOOL,
4571 .off1 = offsetof(struct thread_options, log_unix_epoch),
4572 .help = "Use Unix time in log files",
4573 .category = FIO_OPT_C_LOG,
4574 .group = FIO_OPT_G_INVALID,
4575 },
d5b3cfd4 4576 {
4577 .name = "log_alternate_epoch",
4578 .lname = "Log epoch alternate",
4579 .type = FIO_OPT_BOOL,
4580 .off1 = offsetof(struct thread_options, log_alternate_epoch),
4581 .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.",
4582 .category = FIO_OPT_C_LOG,
4583 .group = FIO_OPT_G_INVALID,
4584 },
4585 {
4586 .name = "log_alternate_epoch_clock_id",
4587 .lname = "Log alternate epoch clock_id",
4588 .type = FIO_OPT_INT,
4589 .off1 = offsetof(struct thread_options, log_alternate_epoch_clock_id),
4590 .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",
4591 .category = FIO_OPT_C_LOG,
4592 .group = FIO_OPT_G_INVALID,
4593 },
66347cfa
DE
4594 {
4595 .name = "block_error_percentiles",
4596 .lname = "Block error percentiles",
4597 .type = FIO_OPT_BOOL,
a609f12a 4598 .off1 = offsetof(struct thread_options, block_error_hist),
66347cfa
DE
4599 .help = "Record trim block errors and make a histogram",
4600 .def = "0",
4601 .category = FIO_OPT_C_LOG,
4602 .group = FIO_OPT_G_INVALID,
4603 },
c504ee55
JA
4604 {
4605 .name = "bwavgtime",
4606 .lname = "Bandwidth average time",
4607 .type = FIO_OPT_INT,
a609f12a 4608 .off1 = offsetof(struct thread_options, bw_avg_time),
c504ee55
JA
4609 .help = "Time window over which to calculate bandwidth"
4610 " (msec)",
4611 .def = "500",
4612 .parent = "write_bw_log",
4613 .hide = 1,
4614 .interval = 100,
4615 .category = FIO_OPT_C_LOG,
4616 .group = FIO_OPT_G_INVALID,
4617 },
4618 {
4619 .name = "iopsavgtime",
4620 .lname = "IOPS average time",
4621 .type = FIO_OPT_INT,
a609f12a 4622 .off1 = offsetof(struct thread_options, iops_avg_time),
c504ee55
JA
4623 .help = "Time window over which to calculate IOPS (msec)",
4624 .def = "500",
4625 .parent = "write_iops_log",
4626 .hide = 1,
4627 .interval = 100,
4628 .category = FIO_OPT_C_LOG,
4629 .group = FIO_OPT_G_INVALID,
4630 },
214e1eca
JA
4631 {
4632 .name = "group_reporting",
e8b0e958 4633 .lname = "Group reporting",
d2507043 4634 .type = FIO_OPT_STR_SET,
a609f12a 4635 .off1 = offsetof(struct thread_options, group_reporting),
214e1eca 4636 .help = "Do reporting on a per-group basis",
10860056 4637 .category = FIO_OPT_C_STAT,
e8b0e958 4638 .group = FIO_OPT_G_INVALID,
214e1eca 4639 },
8243be59
JA
4640 {
4641 .name = "stats",
4642 .lname = "Stats",
4643 .type = FIO_OPT_BOOL,
4644 .off1 = offsetof(struct thread_options, stats),
4645 .help = "Enable collection of stats",
4646 .def = "1",
4647 .category = FIO_OPT_C_STAT,
4648 .group = FIO_OPT_G_INVALID,
4649 },
e9459e5a
JA
4650 {
4651 .name = "zero_buffers",
e8b0e958 4652 .lname = "Zero I/O buffers",
e9459e5a 4653 .type = FIO_OPT_STR_SET,
a609f12a 4654 .off1 = offsetof(struct thread_options, zero_buffers),
e9459e5a 4655 .help = "Init IO buffers to all zeroes",
e8b0e958 4656 .category = FIO_OPT_C_IO,
3ceb458f 4657 .group = FIO_OPT_G_IO_BUF,
e9459e5a 4658 },
5973cafb
JA
4659 {
4660 .name = "refill_buffers",
e8b0e958 4661 .lname = "Refill I/O buffers",
5973cafb 4662 .type = FIO_OPT_STR_SET,
a609f12a 4663 .off1 = offsetof(struct thread_options, refill_buffers),
5973cafb 4664 .help = "Refill IO buffers on every IO submit",
e8b0e958 4665 .category = FIO_OPT_C_IO,
3ceb458f 4666 .group = FIO_OPT_G_IO_BUF,
5973cafb 4667 },
fd68418e
JA
4668 {
4669 .name = "scramble_buffers",
e8b0e958 4670 .lname = "Scramble I/O buffers",
fd68418e 4671 .type = FIO_OPT_BOOL,
a609f12a 4672 .off1 = offsetof(struct thread_options, scramble_buffers),
fd68418e
JA
4673 .help = "Slightly scramble buffers on every IO submit",
4674 .def = "1",
e8b0e958 4675 .category = FIO_OPT_C_IO,
3ceb458f 4676 .group = FIO_OPT_G_IO_BUF,
fd68418e 4677 },
ce35b1ec
JA
4678 {
4679 .name = "buffer_pattern",
4680 .lname = "Buffer pattern",
4681 .type = FIO_OPT_STR,
4682 .cb = str_buffer_pattern_cb,
a609f12a 4683 .off1 = offsetof(struct thread_options, buffer_pattern),
ce35b1ec
JA
4684 .help = "Fill pattern for IO buffers",
4685 .category = FIO_OPT_C_IO,
4686 .group = FIO_OPT_G_IO_BUF,
4687 },
9c42684e
JA
4688 {
4689 .name = "buffer_compress_percentage",
e8b0e958 4690 .lname = "Buffer compression percentage",
9c42684e 4691 .type = FIO_OPT_INT,
bedc9dc2 4692 .cb = str_buffer_compress_cb,
a609f12a 4693 .off1 = offsetof(struct thread_options, compress_percentage),
9c42684e 4694 .maxval = 100,
e7f5de90 4695 .minval = 0,
9c42684e 4696 .help = "How compressible the buffer is (approximately)",
20eb06bd 4697 .interval = 5,
e8b0e958 4698 .category = FIO_OPT_C_IO,
3ceb458f 4699 .group = FIO_OPT_G_IO_BUF,
9c42684e 4700 },
f97a43a1
JA
4701 {
4702 .name = "buffer_compress_chunk",
e8b0e958 4703 .lname = "Buffer compression chunk size",
f97a43a1 4704 .type = FIO_OPT_INT,
a609f12a 4705 .off1 = offsetof(struct thread_options, compress_chunk),
207b18e4 4706 .parent = "buffer_compress_percentage",
d71c154c 4707 .hide = 1,
f97a43a1 4708 .help = "Size of compressible region in buffer",
1de80624 4709 .def = "512",
20eb06bd 4710 .interval = 256,
e8b0e958 4711 .category = FIO_OPT_C_IO,
3ceb458f 4712 .group = FIO_OPT_G_IO_BUF,
f97a43a1 4713 },
5c94b008
JA
4714 {
4715 .name = "dedupe_percentage",
4716 .lname = "Dedupe percentage",
4717 .type = FIO_OPT_INT,
4718 .cb = str_dedupe_cb,
a609f12a 4719 .off1 = offsetof(struct thread_options, dedupe_percentage),
5c94b008
JA
4720 .maxval = 100,
4721 .minval = 0,
4722 .help = "Percentage of buffers that are dedupable",
4723 .interval = 1,
4724 .category = FIO_OPT_C_IO,
4725 .group = FIO_OPT_G_IO_BUF,
4726 },
c49cfc76
BD
4727 {
4728 .name = "dedupe_global",
4729 .lname = "Global deduplication",
4730 .type = FIO_OPT_BOOL,
4731 .off1 = offsetof(struct thread_options, dedupe_global),
4732 .help = "Share deduplication buffers across jobs",
4733 .def = "0",
4734 .category = FIO_OPT_C_IO,
4735 .group = FIO_OPT_G_IO_BUF,
4736 },
0d71aa98
BD
4737 {
4738 .name = "dedupe_mode",
4739 .lname = "Dedupe mode",
4740 .help = "Mode for the deduplication buffer generation",
4741 .type = FIO_OPT_STR,
4742 .off1 = offsetof(struct thread_options, dedupe_mode),
4743 .parent = "dedupe_percentage",
4744 .def = "repeat",
4745 .category = FIO_OPT_C_IO,
4746 .group = FIO_OPT_G_IO_BUF,
4747 .posval = {
4748 { .ival = "repeat",
4749 .oval = DEDUPE_MODE_REPEAT,
4750 .help = "repeat previous page",
4751 },
4752 { .ival = "working_set",
4753 .oval = DEDUPE_MODE_WORKING_SET,
4754 .help = "choose a page randomly from limited working set defined in dedupe_working_set_percentage",
4755 },
4756 },
4757 },
4758 {
4759 .name = "dedupe_working_set_percentage",
4760 .lname = "Dedupe working set percentage",
4761 .help = "Dedupe working set size in percentages from file or device size used to generate dedupe patterns from",
4762 .type = FIO_OPT_INT,
4763 .off1 = offsetof(struct thread_options, dedupe_working_set_percentage),
4764 .parent = "dedupe_percentage",
4765 .def = "5",
4766 .maxval = 100,
4767 .minval = 0,
4768 .category = FIO_OPT_C_IO,
4769 .group = FIO_OPT_G_IO_BUF,
4770 },
83349190
YH
4771 {
4772 .name = "clat_percentiles",
e8b0e958 4773 .lname = "Completion latency percentiles",
83349190 4774 .type = FIO_OPT_BOOL,
a609f12a 4775 .off1 = offsetof(struct thread_options, clat_percentiles),
83349190 4776 .help = "Enable the reporting of completion latency percentiles",
467b35ed 4777 .def = "1",
b599759b
JA
4778 .category = FIO_OPT_C_STAT,
4779 .group = FIO_OPT_G_INVALID,
4780 },
4781 {
4782 .name = "lat_percentiles",
4783 .lname = "IO latency percentiles",
4784 .type = FIO_OPT_BOOL,
4785 .off1 = offsetof(struct thread_options, lat_percentiles),
4786 .help = "Enable the reporting of IO latency percentiles",
4787 .def = "0",
56440e63
VF
4788 .category = FIO_OPT_C_STAT,
4789 .group = FIO_OPT_G_INVALID,
4790 },
4791 {
4792 .name = "slat_percentiles",
4793 .lname = "Submission latency percentiles",
4794 .type = FIO_OPT_BOOL,
4795 .off1 = offsetof(struct thread_options, slat_percentiles),
4796 .help = "Enable the reporting of submission latency percentiles",
4797 .def = "0",
e8b0e958
JA
4798 .category = FIO_OPT_C_STAT,
4799 .group = FIO_OPT_G_INVALID,
83349190
YH
4800 },
4801 {
4802 .name = "percentile_list",
66347cfa 4803 .lname = "Percentile list",
83349190 4804 .type = FIO_OPT_FLOAT_LIST,
a609f12a
JA
4805 .off1 = offsetof(struct thread_options, percentile_list),
4806 .off2 = offsetof(struct thread_options, percentile_precision),
66347cfa
DE
4807 .help = "Specify a custom list of percentiles to report for "
4808 "completion latency and block errors",
fd112d34 4809 .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
83349190
YH
4810 .maxlen = FIO_IO_U_LIST_MAX_LEN,
4811 .minfp = 0.0,
4812 .maxfp = 100.0,
e8b0e958
JA
4813 .category = FIO_OPT_C_STAT,
4814 .group = FIO_OPT_G_INVALID,
e883cb35
JF
4815 },
4816 {
4817 .name = "significant_figures",
4818 .lname = "Significant figures",
4819 .type = FIO_OPT_INT,
4820 .off1 = offsetof(struct thread_options, sig_figs),
4821 .maxval = 10,
4822 .minval = 1,
4823 .help = "Significant figures for output-format set to normal",
4824 .def = "4",
4825 .interval = 1,
4826 .category = FIO_OPT_C_STAT,
4827 .group = FIO_OPT_G_INVALID,
83349190
YH
4828 },
4829
0a839f30
JA
4830#ifdef FIO_HAVE_DISK_UTIL
4831 {
4832 .name = "disk_util",
e8b0e958 4833 .lname = "Disk utilization",
0a839f30 4834 .type = FIO_OPT_BOOL,
a609f12a 4835 .off1 = offsetof(struct thread_options, do_disk_util),
f66ab3c8 4836 .help = "Log disk utilization statistics",
0a839f30 4837 .def = "1",
e8b0e958
JA
4838 .category = FIO_OPT_C_STAT,
4839 .group = FIO_OPT_G_INVALID,
0a839f30 4840 },
a275c37a
JA
4841#else
4842 {
4843 .name = "disk_util",
4844 .lname = "Disk utilization",
4845 .type = FIO_OPT_UNSUPPORTED,
4846 .help = "Your platform does not support disk utilization",
4847 },
0a839f30 4848#endif
993bf48b
JA
4849 {
4850 .name = "gtod_reduce",
e8b0e958 4851 .lname = "Reduce gettimeofday() calls",
993bf48b
JA
4852 .type = FIO_OPT_BOOL,
4853 .help = "Greatly reduce number of gettimeofday() calls",
4854 .cb = str_gtod_reduce_cb,
4855 .def = "0",
a4ed77fe 4856 .hide_on_set = 1,
e8b0e958
JA
4857 .category = FIO_OPT_C_STAT,
4858 .group = FIO_OPT_G_INVALID,
993bf48b 4859 },
02af0988
JA
4860 {
4861 .name = "disable_lat",
e8b0e958 4862 .lname = "Disable all latency stats",
02af0988 4863 .type = FIO_OPT_BOOL,
a609f12a 4864 .off1 = offsetof(struct thread_options, disable_lat),
02af0988
JA
4865 .help = "Disable latency numbers",
4866 .parent = "gtod_reduce",
d71c154c 4867 .hide = 1,
02af0988 4868 .def = "0",
e8b0e958
JA
4869 .category = FIO_OPT_C_STAT,
4870 .group = FIO_OPT_G_INVALID,
02af0988 4871 },
9520ebb9
JA
4872 {
4873 .name = "disable_clat",
e8b0e958 4874 .lname = "Disable completion latency stats",
9520ebb9 4875 .type = FIO_OPT_BOOL,
a609f12a 4876 .off1 = offsetof(struct thread_options, disable_clat),
9520ebb9 4877 .help = "Disable completion latency numbers",
993bf48b 4878 .parent = "gtod_reduce",
d71c154c 4879 .hide = 1,
9520ebb9 4880 .def = "0",
e8b0e958
JA
4881 .category = FIO_OPT_C_STAT,
4882 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
4883 },
4884 {
4885 .name = "disable_slat",
e8b0e958 4886 .lname = "Disable submission latency stats",
9520ebb9 4887 .type = FIO_OPT_BOOL,
a609f12a 4888 .off1 = offsetof(struct thread_options, disable_slat),
03e20d68 4889 .help = "Disable submission latency numbers",
993bf48b 4890 .parent = "gtod_reduce",
d71c154c 4891 .hide = 1,
9520ebb9 4892 .def = "0",
e8b0e958
JA
4893 .category = FIO_OPT_C_STAT,
4894 .group = FIO_OPT_G_INVALID,
9520ebb9
JA
4895 },
4896 {
4897 .name = "disable_bw_measurement",
afd2ceff 4898 .alias = "disable_bw",
e8b0e958 4899 .lname = "Disable bandwidth stats",
9520ebb9 4900 .type = FIO_OPT_BOOL,
a609f12a 4901 .off1 = offsetof(struct thread_options, disable_bw),
9520ebb9 4902 .help = "Disable bandwidth logging",
993bf48b 4903 .parent = "gtod_reduce",
d71c154c 4904 .hide = 1,
9520ebb9 4905 .def = "0",
e8b0e958
JA
4906 .category = FIO_OPT_C_STAT,
4907 .group = FIO_OPT_G_INVALID,
9520ebb9 4908 },
be4ecfdf
JA
4909 {
4910 .name = "gtod_cpu",
e8b0e958 4911 .lname = "Dedicated gettimeofday() CPU",
be4ecfdf 4912 .type = FIO_OPT_INT,
a609f12a 4913 .off1 = offsetof(struct thread_options, gtod_cpu),
03e20d68 4914 .help = "Set up dedicated gettimeofday() thread on this CPU",
29d43ff9 4915 .verify = gtod_cpu_verify,
e8b0e958 4916 .category = FIO_OPT_C_GENERAL,
10860056 4917 .group = FIO_OPT_G_CLOCK,
be4ecfdf 4918 },
771e58be
JA
4919 {
4920 .name = "unified_rw_reporting",
cce2fdfe 4921 .lname = "Unified RW Reporting",
5cb8a8cd 4922 .type = FIO_OPT_STR,
a609f12a 4923 .off1 = offsetof(struct thread_options, unified_rw_rep),
771e58be 4924 .help = "Unify reporting across data direction",
5cb8a8cd 4925 .def = "none",
90b7a96d
JA
4926 .category = FIO_OPT_C_GENERAL,
4927 .group = FIO_OPT_G_INVALID,
5cb8a8cd
BP
4928 .posval = {
4929 { .ival = "none",
4930 .oval = UNIFIED_SPLIT,
4931 .help = "Normal statistics reporting",
4932 },
4933 { .ival = "mixed",
4934 .oval = UNIFIED_MIXED,
4935 .help = "Statistics are summed per data direction and reported together",
4936 },
4937 { .ival = "both",
4938 .oval = UNIFIED_BOTH,
4939 .help = "Statistics are reported normally, followed by the mixed statistics"
4940 },
4941 /* Compatibility with former boolean values */
4942 { .ival = "0",
4943 .oval = UNIFIED_SPLIT,
4944 .help = "Alias for 'none'",
4945 },
4946 { .ival = "1",
4947 .oval = UNIFIED_MIXED,
4948 .help = "Alias for 'mixed'",
4949 },
4950 { .ival = "2",
4951 .oval = UNIFIED_BOTH,
4952 .help = "Alias for 'both'",
4953 },
4954 },
771e58be 4955 },
f2bba182
RR
4956 {
4957 .name = "continue_on_error",
e8b0e958 4958 .lname = "Continue on error",
06842027 4959 .type = FIO_OPT_STR,
a609f12a 4960 .off1 = offsetof(struct thread_options, continue_on_error),
03e20d68 4961 .help = "Continue on non-fatal errors during IO",
06842027 4962 .def = "none",
e8b0e958 4963 .category = FIO_OPT_C_GENERAL,
bc3f552f 4964 .group = FIO_OPT_G_ERR,
06842027
SL
4965 .posval = {
4966 { .ival = "none",
4967 .oval = ERROR_TYPE_NONE,
4968 .help = "Exit when an error is encountered",
4969 },
4970 { .ival = "read",
4971 .oval = ERROR_TYPE_READ,
4972 .help = "Continue on read errors only",
4973 },
4974 { .ival = "write",
4975 .oval = ERROR_TYPE_WRITE,
4976 .help = "Continue on write errors only",
4977 },
4978 { .ival = "io",
4979 .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE,
4980 .help = "Continue on any IO errors",
4981 },
4982 { .ival = "verify",
4983 .oval = ERROR_TYPE_VERIFY,
4984 .help = "Continue on verify errors only",
4985 },
4986 { .ival = "all",
4987 .oval = ERROR_TYPE_ANY,
4988 .help = "Continue on all io and verify errors",
4989 },
4990 { .ival = "0",
4991 .oval = ERROR_TYPE_NONE,
4992 .help = "Alias for 'none'",
4993 },
4994 { .ival = "1",
4995 .oval = ERROR_TYPE_ANY,
4996 .help = "Alias for 'all'",
4997 },
4998 },
f2bba182 4999 },
8b28bd41
DM
5000 {
5001 .name = "ignore_error",
cce2fdfe 5002 .lname = "Ignore Error",
8b28bd41
DM
5003 .type = FIO_OPT_STR,
5004 .cb = str_ignore_error_cb,
a609f12a 5005 .off1 = offsetof(struct thread_options, ignore_error_nr),
8b28bd41
DM
5006 .help = "Set a specific list of errors to ignore",
5007 .parent = "rw",
a94eb99a 5008 .category = FIO_OPT_C_GENERAL,
bc3f552f 5009 .group = FIO_OPT_G_ERR,
8b28bd41
DM
5010 },
5011 {
5012 .name = "error_dump",
cce2fdfe 5013 .lname = "Error Dump",
8b28bd41 5014 .type = FIO_OPT_BOOL,
a609f12a 5015 .off1 = offsetof(struct thread_options, error_dump),
8b28bd41
DM
5016 .def = "0",
5017 .help = "Dump info on each error",
a94eb99a 5018 .category = FIO_OPT_C_GENERAL,
bc3f552f 5019 .group = FIO_OPT_G_ERR,
8b28bd41 5020 },
9ac8a797
JA
5021 {
5022 .name = "profile",
e8b0e958 5023 .lname = "Profile",
79d16311 5024 .type = FIO_OPT_STR_STORE,
a609f12a 5025 .off1 = offsetof(struct thread_options, profile),
9ac8a797 5026 .help = "Select a specific builtin performance test",
13fca827 5027 .category = FIO_OPT_C_PROFILE,
e8b0e958 5028 .group = FIO_OPT_G_INVALID,
9ac8a797 5029 },
a696fa2a
JA
5030 {
5031 .name = "cgroup",
e8b0e958 5032 .lname = "Cgroup",
a696fa2a 5033 .type = FIO_OPT_STR_STORE,
a609f12a 5034 .off1 = offsetof(struct thread_options, cgroup),
a696fa2a 5035 .help = "Add job to cgroup of this name",
e8b0e958 5036 .category = FIO_OPT_C_GENERAL,
a1f6afec
JA
5037 .group = FIO_OPT_G_CGROUP,
5038 },
5039 {
5040 .name = "cgroup_nodelete",
5041 .lname = "Cgroup no-delete",
5042 .type = FIO_OPT_BOOL,
a609f12a 5043 .off1 = offsetof(struct thread_options, cgroup_nodelete),
a1f6afec
JA
5044 .help = "Do not delete cgroups after job completion",
5045 .def = "0",
5046 .parent = "cgroup",
5047 .category = FIO_OPT_C_GENERAL,
5048 .group = FIO_OPT_G_CGROUP,
a696fa2a
JA
5049 },
5050 {
5051 .name = "cgroup_weight",
e8b0e958 5052 .lname = "Cgroup weight",
a696fa2a 5053 .type = FIO_OPT_INT,
a609f12a 5054 .off1 = offsetof(struct thread_options, cgroup_weight),
a696fa2a
JA
5055 .help = "Use given weight for cgroup",
5056 .minval = 100,
5057 .maxval = 1000,
a1f6afec 5058 .parent = "cgroup",
e8b0e958 5059 .category = FIO_OPT_C_GENERAL,
a1f6afec 5060 .group = FIO_OPT_G_CGROUP,
7de87099 5061 },
e0b0d892
JA
5062 {
5063 .name = "uid",
e8b0e958 5064 .lname = "User ID",
e0b0d892 5065 .type = FIO_OPT_INT,
a609f12a 5066 .off1 = offsetof(struct thread_options, uid),
e0b0d892 5067 .help = "Run job with this user ID",
e8b0e958 5068 .category = FIO_OPT_C_GENERAL,
10860056 5069 .group = FIO_OPT_G_CRED,
e0b0d892
JA
5070 },
5071 {
5072 .name = "gid",
e8b0e958 5073 .lname = "Group ID",
e0b0d892 5074 .type = FIO_OPT_INT,
a609f12a 5075 .off1 = offsetof(struct thread_options, gid),
e0b0d892 5076 .help = "Run job with this group ID",
e8b0e958 5077 .category = FIO_OPT_C_GENERAL,
10860056 5078 .group = FIO_OPT_G_CRED,
e0b0d892 5079 },
a1f6afec
JA
5080 {
5081 .name = "kb_base",
5082 .lname = "KB Base",
41dd12d6 5083 .type = FIO_OPT_STR,
a609f12a 5084 .off1 = offsetof(struct thread_options, kb_base),
a1f6afec
JA
5085 .prio = 1,
5086 .def = "1024",
ba9c7219
JA
5087 .posval = {
5088 { .ival = "1024",
5089 .oval = 1024,
d694a6a7 5090 .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary",
ba9c7219
JA
5091 },
5092 { .ival = "1000",
5093 .oval = 1000,
d694a6a7 5094 .help = "Inputs use IEC and SI prefixes; outputs prefer SI",
ba9c7219
JA
5095 },
5096 },
d694a6a7 5097 .help = "Unit prefix interpretation for quantities of data (IEC and SI)",
a1f6afec
JA
5098 .category = FIO_OPT_C_GENERAL,
5099 .group = FIO_OPT_G_INVALID,
5100 },
cf3a0518
JA
5101 {
5102 .name = "unit_base",
d694a6a7 5103 .lname = "Unit for quantities of data (Bits or Bytes)",
92a1a1d7 5104 .type = FIO_OPT_STR,
a609f12a 5105 .off1 = offsetof(struct thread_options, unit_base),
cf3a0518 5106 .prio = 1,
71a08258
JA
5107 .posval = {
5108 { .ival = "0",
41a87019 5109 .oval = N2S_NONE,
71a08258
JA
5110 .help = "Auto-detect",
5111 },
5112 { .ival = "8",
41a87019 5113 .oval = N2S_BYTEPERSEC,
71a08258
JA
5114 .help = "Normal (byte based)",
5115 },
5116 { .ival = "1",
41a87019 5117 .oval = N2S_BITPERSEC,
71a08258
JA
5118 .help = "Bit based",
5119 },
5120 },
cf3a0518
JA
5121 .help = "Bit multiple of result summary data (8 for byte, 1 for bit)",
5122 .category = FIO_OPT_C_GENERAL,
5123 .group = FIO_OPT_G_INVALID,
5124 },
3ceb458f
JA
5125 {
5126 .name = "hugepage-size",
5127 .lname = "Hugepage size",
5128 .type = FIO_OPT_INT,
a609f12a 5129 .off1 = offsetof(struct thread_options, hugepage_size),
3ceb458f
JA
5130 .help = "When using hugepages, specify size of each page",
5131 .def = __fio_stringify(FIO_HUGE_PAGE),
5132 .interval = 1024 * 1024,
5133 .category = FIO_OPT_C_GENERAL,
5134 .group = FIO_OPT_G_INVALID,
5135 },
9e684a49
DE
5136 {
5137 .name = "flow_id",
e8b0e958 5138 .lname = "I/O flow ID",
9e684a49 5139 .type = FIO_OPT_INT,
a609f12a 5140 .off1 = offsetof(struct thread_options, flow_id),
9e684a49
DE
5141 .help = "The flow index ID to use",
5142 .def = "0",
e8b0e958
JA
5143 .category = FIO_OPT_C_IO,
5144 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
5145 },
5146 {
5147 .name = "flow",
e8b0e958 5148 .lname = "I/O flow weight",
20c7a244 5149 .type = FIO_OPT_INT,
a609f12a 5150 .off1 = offsetof(struct thread_options, flow),
9e684a49
DE
5151 .help = "Weight for flow control of this job",
5152 .parent = "flow_id",
d71c154c 5153 .hide = 1,
9e684a49 5154 .def = "0",
d4e74fda 5155 .maxval = FLOW_MAX_WEIGHT,
e8b0e958
JA
5156 .category = FIO_OPT_C_IO,
5157 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
5158 },
5159 {
5160 .name = "flow_watermark",
e8b0e958 5161 .lname = "I/O flow watermark",
d4e74fda 5162 .type = FIO_OPT_SOFT_DEPRECATED,
e8b0e958
JA
5163 .category = FIO_OPT_C_IO,
5164 .group = FIO_OPT_G_IO_FLOW,
9e684a49
DE
5165 },
5166 {
5167 .name = "flow_sleep",
e8b0e958 5168 .lname = "I/O flow sleep",
9e684a49 5169 .type = FIO_OPT_INT,
a609f12a 5170 .off1 = offsetof(struct thread_options, flow_sleep),
9e684a49
DE
5171 .help = "How many microseconds to sleep after being held"
5172 " back by the flow control mechanism",
5173 .parent = "flow_id",
d71c154c 5174 .hide = 1,
9e684a49 5175 .def = "0",
e8b0e958
JA
5176 .category = FIO_OPT_C_IO,
5177 .group = FIO_OPT_G_IO_FLOW,
9e684a49 5178 },
16e56d25
VF
5179 {
5180 .name = "steadystate",
5181 .lname = "Steady state threshold",
5182 .alias = "ss",
5183 .type = FIO_OPT_STR,
2c5d94bc 5184 .off1 = offsetof(struct thread_options, ss_state),
16e56d25
VF
5185 .cb = str_steadystate_cb,
5186 .help = "Define the criterion and limit to judge when a job has reached steady state",
5187 .def = "iops_slope:0.01%",
5188 .posval = {
5189 { .ival = "iops",
f0c50c66 5190 .oval = FIO_SS_IOPS,
16e56d25
VF
5191 .help = "maximum mean deviation of IOPS measurements",
5192 },
5193 { .ival = "iops_slope",
f0c50c66 5194 .oval = FIO_SS_IOPS_SLOPE,
16e56d25
VF
5195 .help = "slope calculated from IOPS measurements",
5196 },
5197 { .ival = "bw",
f0c50c66 5198 .oval = FIO_SS_BW,
16e56d25
VF
5199 .help = "maximum mean deviation of bandwidth measurements",
5200 },
5201 {
5202 .ival = "bw_slope",
f0c50c66 5203 .oval = FIO_SS_BW_SLOPE,
16e56d25
VF
5204 .help = "slope calculated from bandwidth measurements",
5205 },
5206 },
5207 .category = FIO_OPT_C_GENERAL,
5208 .group = FIO_OPT_G_RUNTIME,
5209 },
5210 {
5211 .name = "steadystate_duration",
5212 .lname = "Steady state duration",
5213 .alias = "ss_dur",
915ca980 5214 .parent = "steadystate",
16e56d25
VF
5215 .type = FIO_OPT_STR_VAL_TIME,
5216 .off1 = offsetof(struct thread_options, ss_dur),
5217 .help = "Stop workload upon attaining steady state for specified duration",
5218 .def = "0",
5219 .is_seconds = 1,
5220 .is_time = 1,
5221 .category = FIO_OPT_C_GENERAL,
5222 .group = FIO_OPT_G_RUNTIME,
5223 },
5224 {
5225 .name = "steadystate_ramp_time",
5226 .lname = "Steady state ramp time",
5227 .alias = "ss_ramp",
915ca980 5228 .parent = "steadystate",
16e56d25
VF
5229 .type = FIO_OPT_STR_VAL_TIME,
5230 .off1 = offsetof(struct thread_options, ss_ramp_time),
5231 .help = "Delay before initiation of data collection for steady state job termination testing",
5232 .def = "0",
5233 .is_seconds = 1,
5234 .is_time = 1,
5235 .category = FIO_OPT_C_GENERAL,
5236 .group = FIO_OPT_G_RUNTIME,
5237 },
90e678ba
CL
5238 {
5239 .name = "steadystate_check_interval",
5240 .lname = "Steady state check interval",
5241 .alias = "ss_interval",
5242 .parent = "steadystate",
5243 .type = FIO_OPT_STR_VAL_TIME,
5244 .off1 = offsetof(struct thread_options, ss_check_interval),
5245 .help = "Polling interval for the steady state check (too low means steadystate will not converge)",
5246 .def = "1",
5247 .is_seconds = 1,
5248 .is_time = 1,
5249 .category = FIO_OPT_C_GENERAL,
5250 .group = FIO_OPT_G_RUNTIME,
5251 },
214e1eca
JA
5252 {
5253 .name = NULL,
5254 },
5255};
5256
17af15d4 5257static void add_to_lopt(struct option *lopt, struct fio_option *o,
de890a1e 5258 const char *name, int val)
9f81736c 5259{
17af15d4 5260 lopt->name = (char *) name;
de890a1e 5261 lopt->val = val;
9f81736c 5262 if (o->type == FIO_OPT_STR_SET)
ff52be3d 5263 lopt->has_arg = optional_argument;
9f81736c
JA
5264 else
5265 lopt->has_arg = required_argument;
5266}
5267
de890a1e
SL
5268static void options_to_lopts(struct fio_option *opts,
5269 struct option *long_options,
5270 int i, int option_type)
214e1eca 5271{
de890a1e 5272 struct fio_option *o = &opts[0];
214e1eca 5273 while (o->name) {
de890a1e 5274 add_to_lopt(&long_options[i], o, o->name, option_type);
17af15d4
JA
5275 if (o->alias) {
5276 i++;
de890a1e 5277 add_to_lopt(&long_options[i], o, o->alias, option_type);
17af15d4 5278 }
214e1eca
JA
5279
5280 i++;
5281 o++;
5282 assert(i < FIO_NR_OPTIONS);
5283 }
5284}
5285
de890a1e
SL
5286void fio_options_set_ioengine_opts(struct option *long_options,
5287 struct thread_data *td)
5288{
5289 unsigned int i;
5290
5291 i = 0;
5292 while (long_options[i].name) {
5293 if (long_options[i].val == FIO_GETOPT_IOENGINE) {
5294 memset(&long_options[i], 0, sizeof(*long_options));
5295 break;
5296 }
5297 i++;
5298 }
5299
5300 /*
5301 * Just clear out the prior ioengine options.
5302 */
5303 if (!td || !td->eo)
5304 return;
5305
5306 options_to_lopts(td->io_ops->options, long_options, i,
5307 FIO_GETOPT_IOENGINE);
5308}
5309
5310void fio_options_dup_and_init(struct option *long_options)
5311{
5312 unsigned int i;
5313
9af4a244 5314 options_init(fio_options);
de890a1e
SL
5315
5316 i = 0;
5317 while (long_options[i].name)
5318 i++;
5319
9af4a244 5320 options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB);
de890a1e
SL
5321}
5322
74929ac2
JA
5323struct fio_keyword {
5324 const char *word;
5325 const char *desc;
5326 char *replace;
5327};
5328
5329static struct fio_keyword fio_keywords[] = {
5330 {
5331 .word = "$pagesize",
5332 .desc = "Page size in the system",
5333 },
5334 {
5335 .word = "$mb_memory",
5336 .desc = "Megabytes of memory online",
5337 },
5338 {
5339 .word = "$ncpus",
5340 .desc = "Number of CPUs online in the system",
5341 },
5342 {
5343 .word = NULL,
5344 },
5345};
5346
af1dc266
JA
5347void fio_keywords_exit(void)
5348{
5349 struct fio_keyword *kw;
5350
5351 kw = &fio_keywords[0];
5352 while (kw->word) {
5353 free(kw->replace);
5354 kw->replace = NULL;
5355 kw++;
5356 }
5357}
5358
74929ac2
JA
5359void fio_keywords_init(void)
5360{
3b2e1464 5361 unsigned long long mb_memory;
74929ac2
JA
5362 char buf[128];
5363 long l;
5364
a4cfc477 5365 sprintf(buf, "%lu", (unsigned long) page_size);
74929ac2
JA
5366 fio_keywords[0].replace = strdup(buf);
5367
8eb016d3 5368 mb_memory = os_phys_mem() / (1024 * 1024);
3b2e1464 5369 sprintf(buf, "%llu", mb_memory);
74929ac2
JA
5370 fio_keywords[1].replace = strdup(buf);
5371
40f61ec7 5372 l = cpus_configured();
74929ac2
JA
5373 sprintf(buf, "%lu", l);
5374 fio_keywords[2].replace = strdup(buf);
5375}
5376
892a6ffc
JA
5377#define BC_APP "bc"
5378
5379static char *bc_calc(char *str)
5380{
d0c814ec 5381 char buf[128], *tmp;
892a6ffc
JA
5382 FILE *f;
5383 int ret;
5384
5385 /*
5386 * No math, just return string
5387 */
d0c814ec
SL
5388 if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') &&
5389 !strchr(str, '/')) || strchr(str, '\''))
892a6ffc
JA
5390 return str;
5391
5392 /*
5393 * Split option from value, we only need to calculate the value
5394 */
5395 tmp = strchr(str, '=');
5396 if (!tmp)
5397 return str;
5398
5399 tmp++;
892a6ffc 5400
d0c814ec
SL
5401 /*
5402 * Prevent buffer overflows; such a case isn't reasonable anyway
5403 */
5404 if (strlen(str) >= 128 || strlen(tmp) > 100)
5405 return str;
892a6ffc
JA
5406
5407 sprintf(buf, "which %s > /dev/null", BC_APP);
5408 if (system(buf)) {
5409 log_err("fio: bc is needed for performing math\n");
892a6ffc
JA
5410 return NULL;
5411 }
5412
d0c814ec 5413 sprintf(buf, "echo '%s' | %s", tmp, BC_APP);
892a6ffc 5414 f = popen(buf, "r");
3c3ed070 5415 if (!f)
892a6ffc 5416 return NULL;
892a6ffc 5417
d0c814ec 5418 ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f);
1d824f37
JA
5419 if (ret <= 0) {
5420 pclose(f);
892a6ffc 5421 return NULL;
1d824f37 5422 }
892a6ffc 5423
892a6ffc 5424 pclose(f);
d0c814ec
SL
5425 buf[(tmp - str) + ret - 1] = '\0';
5426 memcpy(buf, str, tmp - str);
892a6ffc 5427 free(str);
d0c814ec
SL
5428 return strdup(buf);
5429}
5430
5431/*
5432 * Return a copy of the input string with substrings of the form ${VARNAME}
5433 * substituted with the value of the environment variable VARNAME. The
5434 * substitution always occurs, even if VARNAME is empty or the corresponding
5435 * environment variable undefined.
5436 */
b4f5e72f 5437char *fio_option_dup_subs(const char *opt)
d0c814ec
SL
5438{
5439 char out[OPT_LEN_MAX+1];
5440 char in[OPT_LEN_MAX+1];
5441 char *outptr = out;
5442 char *inptr = in;
5443 char *ch1, *ch2, *env;
5444 ssize_t nchr = OPT_LEN_MAX;
5445 size_t envlen;
5446
5447 if (strlen(opt) + 1 > OPT_LEN_MAX) {
5448 log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX);
5449 return NULL;
5450 }
5451
36833fb0 5452 snprintf(in, sizeof(in), "%s", opt);
d0c814ec
SL
5453
5454 while (*inptr && nchr > 0) {
5455 if (inptr[0] == '$' && inptr[1] == '{') {
5456 ch2 = strchr(inptr, '}');
5457 if (ch2 && inptr+1 < ch2) {
5458 ch1 = inptr+2;
5459 inptr = ch2+1;
5460 *ch2 = '\0';
5461
5462 env = getenv(ch1);
5463 if (env) {
5464 envlen = strlen(env);
5465 if (envlen <= nchr) {
5466 memcpy(outptr, env, envlen);
5467 outptr += envlen;
5468 nchr -= envlen;
5469 }
5470 }
5471
5472 continue;
5473 }
5474 }
5475
5476 *outptr++ = *inptr++;
5477 --nchr;
5478 }
5479
5480 *outptr = '\0';
5481 return strdup(out);
892a6ffc
JA
5482}
5483
74929ac2
JA
5484/*
5485 * Look for reserved variable names and replace them with real values
5486 */
5487static char *fio_keyword_replace(char *opt)
5488{
5489 char *s;
5490 int i;
d0c814ec 5491 int docalc = 0;
74929ac2
JA
5492
5493 for (i = 0; fio_keywords[i].word != NULL; i++) {
5494 struct fio_keyword *kw = &fio_keywords[i];
5495
5496 while ((s = strstr(opt, kw->word)) != NULL) {
33153428 5497 char *new = calloc(strlen(opt) + 1, 1);
74929ac2
JA
5498 char *o_org = opt;
5499 int olen = s - opt;
5500 int len;
5501
5502 /*
5503 * Copy part of the string before the keyword and
5504 * sprintf() the replacement after it.
5505 */
5506 memcpy(new, opt, olen);
5507 len = sprintf(new + olen, "%s", kw->replace);
5508
5509 /*
5510 * If there's more in the original string, copy that
5511 * in too
5512 */
85b9ee7e 5513 opt += olen + strlen(kw->word);
33153428 5514 /* keeps final zero thanks to calloc */
74929ac2 5515 if (strlen(opt))
85b9ee7e 5516 memcpy(new + olen + len, opt, strlen(opt));
74929ac2
JA
5517
5518 /*
5519 * replace opt and free the old opt
5520 */
5521 opt = new;
d0c814ec 5522 free(o_org);
7a958bd5 5523
d0c814ec 5524 docalc = 1;
74929ac2
JA
5525 }
5526 }
5527
d0c814ec
SL
5528 /*
5529 * Check for potential math and invoke bc, if possible
5530 */
5531 if (docalc)
5532 opt = bc_calc(opt);
5533
7a958bd5 5534 return opt;
74929ac2
JA
5535}
5536
d0c814ec
SL
5537static char **dup_and_sub_options(char **opts, int num_opts)
5538{
5539 int i;
5540 char **opts_copy = malloc(num_opts * sizeof(*opts));
5541 for (i = 0; i < num_opts; i++) {
b4f5e72f 5542 opts_copy[i] = fio_option_dup_subs(opts[i]);
d0c814ec
SL
5543 if (!opts_copy[i])
5544 continue;
5545 opts_copy[i] = fio_keyword_replace(opts_copy[i]);
5546 }
5547 return opts_copy;
5548}
5549
e15b023b 5550static void show_closest_option(const char *opt)
a2d027b9
JA
5551{
5552 int best_option, best_distance;
5553 int i, distance;
e15b023b
JA
5554 char *name;
5555
5556 if (!strlen(opt))
5557 return;
5558
5559 name = strdup(opt);
5560 i = 0;
5561 while (name[i] != '\0' && name[i] != '=')
5562 i++;
5563 name[i] = '\0';
a2d027b9
JA
5564
5565 best_option = -1;
5566 best_distance = INT_MAX;
5567 i = 0;
5568 while (fio_options[i].name) {
5569 distance = string_distance(name, fio_options[i].name);
5570 if (distance < best_distance) {
5571 best_distance = distance;
5572 best_option = i;
5573 }
5574 i++;
5575 }
5576
75e6bcba
JA
5577 if (best_option != -1 && string_distance_ok(name, best_distance) &&
5578 fio_options[best_option].type != FIO_OPT_UNSUPPORTED)
a2d027b9 5579 log_err("Did you mean %s?\n", fio_options[best_option].name);
e15b023b
JA
5580
5581 free(name);
a2d027b9
JA
5582}
5583
c2292325 5584int fio_options_parse(struct thread_data *td, char **opts, int num_opts)
214e1eca 5585{
de890a1e 5586 int i, ret, unknown;
d0c814ec 5587 char **opts_copy;
3b8b7135 5588
9af4a244 5589 sort_options(opts, fio_options, num_opts);
d0c814ec 5590 opts_copy = dup_and_sub_options(opts, num_opts);
3b8b7135 5591
de890a1e 5592 for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) {
9109883a 5593 const struct fio_option *o;
9af4a244 5594 int newret = parse_option(opts_copy[i], opts[i], fio_options,
a609f12a 5595 &o, &td->o, &td->opt_list);
d0c814ec 5596
a8523a6a
JA
5597 if (!newret && o)
5598 fio_option_mark_set(&td->o, o);
5599
de890a1e
SL
5600 if (opts_copy[i]) {
5601 if (newret && !o) {
5602 unknown++;
5603 continue;
5604 }
d0c814ec 5605 free(opts_copy[i]);
de890a1e
SL
5606 opts_copy[i] = NULL;
5607 }
5608
5609 ret |= newret;
5610 }
5611
5612 if (unknown) {
5613 ret |= ioengine_load(td);
5614 if (td->eo) {
5615 sort_options(opts_copy, td->io_ops->options, num_opts);
5616 opts = opts_copy;
5617 }
5618 for (i = 0; i < num_opts; i++) {
9109883a 5619 const struct fio_option *o = NULL;
de890a1e 5620 int newret = 1;
a2d027b9 5621
de890a1e
SL
5622 if (!opts_copy[i])
5623 continue;
5624
5625 if (td->eo)
5626 newret = parse_option(opts_copy[i], opts[i],
5627 td->io_ops->options, &o,
66e19a38 5628 td->eo, &td->opt_list);
de890a1e
SL
5629
5630 ret |= newret;
a2d027b9 5631 if (!o) {
de890a1e 5632 log_err("Bad option <%s>\n", opts[i]);
a2d027b9
JA
5633 show_closest_option(opts[i]);
5634 }
de890a1e
SL
5635 free(opts_copy[i]);
5636 opts_copy[i] = NULL;
5637 }
74929ac2 5638 }
3b8b7135 5639
d0c814ec 5640 free(opts_copy);
3b8b7135 5641 return ret;
214e1eca
JA
5642}
5643
5644int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val)
5645{
a8523a6a
JA
5646 int ret;
5647
a609f12a 5648 ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list);
a8523a6a 5649 if (!ret) {
9109883a 5650 const struct fio_option *o;
a8523a6a 5651
9109883a 5652 o = find_option_c(fio_options, opt);
a8523a6a
JA
5653 if (o)
5654 fio_option_mark_set(&td->o, o);
5655 }
5656
5657 return ret;
214e1eca
JA
5658}
5659
de890a1e
SL
5660int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt,
5661 char *val)
5662{
d8b4f395
JA
5663 return parse_cmd_option(opt, val, td->io_ops->options, td->eo,
5664 &td->opt_list);
de890a1e
SL
5665}
5666
214e1eca
JA
5667void fio_fill_default_options(struct thread_data *td)
5668{
cb1402d6 5669 td->o.magic = OPT_MAGIC;
a609f12a 5670 fill_default_options(&td->o, fio_options);
214e1eca
JA
5671}
5672
5673int fio_show_option_help(const char *opt)
5674{
9af4a244 5675 return show_cmd_help(fio_options, opt);
214e1eca 5676}
d23bb327 5677
de890a1e
SL
5678/*
5679 * dupe FIO_OPT_STR_STORE options
5680 */
5681void fio_options_mem_dupe(struct thread_data *td)
5682{
53b5693d 5683 options_mem_dupe(fio_options, &td->o);
1647f592
JA
5684
5685 if (td->eo && td->io_ops) {
de890a1e 5686 void *oldeo = td->eo;
1647f592 5687
de890a1e
SL
5688 td->eo = malloc(td->io_ops->option_struct_size);
5689 memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
53b5693d 5690 options_mem_dupe(td->io_ops->options, td->eo);
de890a1e
SL
5691 }
5692}
5693
d6978a32
JA
5694unsigned int fio_get_kb_base(void *data)
5695{
a609f12a
JA
5696 struct thread_data *td = cb_data_to_td(data);
5697 struct thread_options *o = &td->o;
d6978a32
JA
5698 unsigned int kb_base = 0;
5699
cb1402d6
JA
5700 /*
5701 * This is a hack... For private options, *data is not holding
5702 * a pointer to the thread_options, but to private data. This means
5703 * we can't safely dereference it, but magic is first so mem wise
5704 * it is valid. But this also means that if the job first sets
5705 * kb_base and expects that to be honored by private options,
5706 * it will be disappointed. We will return the global default
5707 * for this.
5708 */
5709 if (o && o->magic == OPT_MAGIC)
83ea422a 5710 kb_base = o->kb_base;
d6978a32
JA
5711 if (!kb_base)
5712 kb_base = 1024;
5713
5714 return kb_base;
5715}
9f988e2e 5716
9109883a 5717int add_option(const struct fio_option *o)
9f988e2e 5718{
07b3232d
JA
5719 struct fio_option *__o;
5720 int opt_index = 0;
5721
9af4a244 5722 __o = fio_options;
07b3232d
JA
5723 while (__o->name) {
5724 opt_index++;
5725 __o++;
5726 }
5727
7b504edd
JA
5728 if (opt_index + 1 == FIO_MAX_OPTS) {
5729 log_err("fio: FIO_MAX_OPTS is too small\n");
5730 return 1;
5731 }
5732
9af4a244 5733 memcpy(&fio_options[opt_index], o, sizeof(*o));
7b504edd 5734 fio_options[opt_index + 1].name = NULL;
07b3232d 5735 return 0;
9f988e2e 5736}
e2de69da 5737
07b3232d 5738void invalidate_profile_options(const char *prof_name)
e2de69da 5739{
07b3232d 5740 struct fio_option *o;
e2de69da 5741
9af4a244 5742 o = fio_options;
07b3232d
JA
5743 while (o->name) {
5744 if (o->prof_name && !strcmp(o->prof_name, prof_name)) {
5745 o->type = FIO_OPT_INVALID;
5746 o->prof_name = NULL;
5747 }
5748 o++;
e2de69da
JA
5749 }
5750}
f5b6bb85
JA
5751
5752void add_opt_posval(const char *optname, const char *ival, const char *help)
5753{
5754 struct fio_option *o;
5755 unsigned int i;
5756
9af4a244 5757 o = find_option(fio_options, optname);
f5b6bb85
JA
5758 if (!o)
5759 return;
5760
5761 for (i = 0; i < PARSE_MAX_VP; i++) {
5762 if (o->posval[i].ival)
5763 continue;
5764
5765 o->posval[i].ival = ival;
5766 o->posval[i].help = help;
5767 break;
5768 }
5769}
5770
5771void del_opt_posval(const char *optname, const char *ival)
5772{
5773 struct fio_option *o;
5774 unsigned int i;
5775
9af4a244 5776 o = find_option(fio_options, optname);
f5b6bb85
JA
5777 if (!o)
5778 return;
5779
5780 for (i = 0; i < PARSE_MAX_VP; i++) {
5781 if (!o->posval[i].ival)
5782 continue;
5783 if (strcmp(o->posval[i].ival, ival))
5784 continue;
5785
5786 o->posval[i].ival = NULL;
5787 o->posval[i].help = NULL;
5788 }
5789}
7e356b2d
JA
5790
5791void fio_options_free(struct thread_data *td)
5792{
ca6336a8 5793 options_free(fio_options, &td->o);
de890a1e
SL
5794 if (td->eo && td->io_ops && td->io_ops->options) {
5795 options_free(td->io_ops->options, td->eo);
5796 free(td->eo);
5797 td->eo = NULL;
5798 }
7e356b2d 5799}
c504ee55 5800
8009f543
NC
5801void fio_dump_options_free(struct thread_data *td)
5802{
5803 while (!flist_empty(&td->opt_list)) {
5804 struct print_option *p;
5805
5806 p = flist_first_entry(&td->opt_list, struct print_option, list);
5807 flist_del_init(&p->list);
5808 free(p->name);
5809 free(p->value);
5810 free(p);
5811 }
5812}
5813
c504ee55
JA
5814struct fio_option *fio_option_find(const char *name)
5815{
5816 return find_option(fio_options, name);
5817}
5818
517c9c72 5819static struct fio_option *find_next_opt(struct fio_option *from,
f0e7f45a 5820 unsigned int off1)
a8523a6a 5821{
f0e7f45a 5822 struct fio_option *opt;
a8523a6a 5823
f0e7f45a
JA
5824 if (!from)
5825 from = &fio_options[0];
5826 else
5827 from++;
5828
5829 opt = NULL;
5830 do {
5831 if (off1 == from->off1) {
5832 opt = from;
a8523a6a
JA
5833 break;
5834 }
f0e7f45a
JA
5835 from++;
5836 } while (from->name);
a8523a6a 5837
f0e7f45a
JA
5838 return opt;
5839}
5840
5841static int opt_is_set(struct thread_options *o, struct fio_option *opt)
5842{
5843 unsigned int opt_off, index, offset;
a8523a6a
JA
5844
5845 opt_off = opt - &fio_options[0];
5846 index = opt_off / (8 * sizeof(uint64_t));
5847 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
e9d686d6 5848 return (o->set_options[index] & ((uint64_t)1 << offset)) != 0;
a8523a6a
JA
5849}
5850
72f39748 5851bool __fio_option_is_set(struct thread_options *o, unsigned int off1)
f0e7f45a
JA
5852{
5853 struct fio_option *opt, *next;
5854
5855 next = NULL;
517c9c72 5856 while ((opt = find_next_opt(next, off1)) != NULL) {
f0e7f45a 5857 if (opt_is_set(o, opt))
72f39748 5858 return true;
f0e7f45a
JA
5859
5860 next = opt;
5861 }
5862
72f39748 5863 return false;
f0e7f45a
JA
5864}
5865
9109883a 5866void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt)
a8523a6a
JA
5867{
5868 unsigned int opt_off, index, offset;
5869
5870 opt_off = opt - &fio_options[0];
5871 index = opt_off / (8 * sizeof(uint64_t));
5872 offset = opt_off & ((8 * sizeof(uint64_t)) - 1);
e9d686d6 5873 o->set_options[index] |= (uint64_t)1 << offset;
a8523a6a 5874}