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