blktrace: add 'reply_skip' option
[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 {