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