Commit | Line | Data |
---|---|---|
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> |
921c766f | 7 | #include <libgen.h> |
5921e80c JA |
8 | #include <fcntl.h> |
9 | #include <sys/types.h> | |
10 | #include <sys/stat.h> | |
214e1eca JA |
11 | |
12 | #include "fio.h" | |
4f5af7b2 | 13 | #include "verify.h" |
214e1eca | 14 | #include "parse.h" |
eef32359 | 15 | #include "lib/fls.h" |
9f988e2e | 16 | #include "options.h" |
214e1eca | 17 | |
5d7c5d34 JA |
18 | #include "crc/crc32c.h" |
19 | ||
214e1eca JA |
20 | /* |
21 | * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. | |
22 | */ | |
23 | static char *get_opt_postfix(const char *str) | |
24 | { | |
25 | char *p = strstr(str, ":"); | |
26 | ||
27 | if (!p) | |
28 | return NULL; | |
29 | ||
30 | p++; | |
31 | strip_blank_front(&p); | |
32 | strip_blank_end(p); | |
33 | return strdup(p); | |
34 | } | |
35 | ||
0e92f873 RR |
36 | static int converthexchartoint(char a) |
37 | { | |
38 | int base; | |
39 | ||
3c3ed070 | 40 | switch (a) { |
0e92f873 RR |
41 | case '0'...'9': |
42 | base = '0'; | |
43 | break; | |
44 | case 'A'...'F': | |
45 | base = 'A' - 10; | |
46 | break; | |
47 | case 'a'...'f': | |
48 | base = 'a' - 10; | |
49 | break; | |
50 | default: | |
51 | base = 0; | |
52 | } | |
3c3ed070 | 53 | return a - base; |
0e92f873 RR |
54 | } |
55 | ||
564ca972 JA |
56 | static int bs_cmp(const void *p1, const void *p2) |
57 | { | |
58 | const struct bssplit *bsp1 = p1; | |
59 | const struct bssplit *bsp2 = p2; | |
60 | ||
61 | return bsp1->perc < bsp2->perc; | |
62 | } | |
63 | ||
83ea422a | 64 | static int bssplit_ddir(struct thread_options *o, int ddir, char *str) |
564ca972 | 65 | { |
720e84ad | 66 | struct bssplit *bssplit; |
564ca972 JA |
67 | unsigned int i, perc, perc_missing; |
68 | unsigned int max_bs, min_bs; | |
69 | long long val; | |
720e84ad | 70 | char *fname; |
564ca972 | 71 | |
83ea422a | 72 | o->bssplit_nr[ddir] = 4; |
720e84ad | 73 | bssplit = malloc(4 * sizeof(struct bssplit)); |
564ca972 JA |
74 | |
75 | i = 0; | |
76 | max_bs = 0; | |
77 | min_bs = -1; | |
78 | while ((fname = strsep(&str, ":")) != NULL) { | |
79 | char *perc_str; | |
80 | ||
81 | if (!strlen(fname)) | |
82 | break; | |
83 | ||
84 | /* | |
85 | * grow struct buffer, if needed | |
86 | */ | |
83ea422a JA |
87 | if (i == o->bssplit_nr[ddir]) { |
88 | o->bssplit_nr[ddir] <<= 1; | |
89 | bssplit = realloc(bssplit, o->bssplit_nr[ddir] | |
5ec10eaa | 90 | * sizeof(struct bssplit)); |
564ca972 JA |
91 | } |
92 | ||
93 | perc_str = strstr(fname, "/"); | |
94 | if (perc_str) { | |
95 | *perc_str = '\0'; | |
96 | perc_str++; | |
97 | perc = atoi(perc_str); | |
98 | if (perc > 100) | |
99 | perc = 100; | |
100 | else if (!perc) | |
101 | perc = -1; | |
102 | } else | |
103 | perc = -1; | |
104 | ||
83ea422a | 105 | if (str_to_decimal(fname, &val, 1, o)) { |
564ca972 | 106 | log_err("fio: bssplit conversion failed\n"); |
83ea422a | 107 | free(o->bssplit); |
564ca972 JA |
108 | return 1; |
109 | } | |
110 | ||
111 | if (val > max_bs) | |
112 | max_bs = val; | |
113 | if (val < min_bs) | |
114 | min_bs = val; | |
115 | ||
720e84ad JA |
116 | bssplit[i].bs = val; |
117 | bssplit[i].perc = perc; | |
564ca972 JA |
118 | i++; |
119 | } | |
120 | ||
83ea422a | 121 | o->bssplit_nr[ddir] = i; |
564ca972 JA |
122 | |
123 | /* | |
124 | * Now check if the percentages add up, and how much is missing | |
125 | */ | |
126 | perc = perc_missing = 0; | |
83ea422a | 127 | for (i = 0; i < o->bssplit_nr[ddir]; i++) { |
720e84ad | 128 | struct bssplit *bsp = &bssplit[i]; |
564ca972 JA |
129 | |
130 | if (bsp->perc == (unsigned char) -1) | |
131 | perc_missing++; | |
132 | else | |
133 | perc += bsp->perc; | |
134 | } | |
135 | ||
136 | if (perc > 100) { | |
137 | log_err("fio: bssplit percentages add to more than 100%%\n"); | |
720e84ad | 138 | free(bssplit); |
564ca972 JA |
139 | return 1; |
140 | } | |
141 | /* | |
142 | * If values didn't have a percentage set, divide the remains between | |
143 | * them. | |
144 | */ | |
145 | if (perc_missing) { | |
83ea422a | 146 | for (i = 0; i < o->bssplit_nr[ddir]; i++) { |
720e84ad | 147 | struct bssplit *bsp = &bssplit[i]; |
564ca972 JA |
148 | |
149 | if (bsp->perc == (unsigned char) -1) | |
150 | bsp->perc = (100 - perc) / perc_missing; | |
151 | } | |
152 | } | |
153 | ||
83ea422a JA |
154 | o->min_bs[ddir] = min_bs; |
155 | o->max_bs[ddir] = max_bs; | |
564ca972 JA |
156 | |
157 | /* | |
158 | * now sort based on percentages, for ease of lookup | |
159 | */ | |
83ea422a JA |
160 | qsort(bssplit, o->bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp); |
161 | o->bssplit[ddir] = bssplit; | |
720e84ad | 162 | return 0; |
720e84ad JA |
163 | } |
164 | ||
165 | static int str_bssplit_cb(void *data, const char *input) | |
166 | { | |
167 | struct thread_data *td = data; | |
168 | char *str, *p, *odir; | |
169 | int ret = 0; | |
170 | ||
171 | p = str = strdup(input); | |
172 | ||
173 | strip_blank_front(&str); | |
174 | strip_blank_end(str); | |
175 | ||
176 | odir = strchr(str, ','); | |
177 | if (odir) { | |
83ea422a | 178 | ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1); |
720e84ad JA |
179 | if (!ret) { |
180 | *odir = '\0'; | |
83ea422a | 181 | ret = bssplit_ddir(&td->o, DDIR_READ, str); |
720e84ad JA |
182 | } |
183 | } else { | |
184 | char *op; | |
185 | ||
186 | op = strdup(str); | |
187 | ||
83ea422a | 188 | ret = bssplit_ddir(&td->o, DDIR_READ, str); |
720e84ad | 189 | if (!ret) |
83ea422a | 190 | ret = bssplit_ddir(&td->o, DDIR_WRITE, op); |
720e84ad JA |
191 | |
192 | free(op); | |
193 | } | |
564ca972 JA |
194 | |
195 | free(p); | |
720e84ad | 196 | return ret; |
564ca972 JA |
197 | } |
198 | ||
211097b2 JA |
199 | static int str_rw_cb(void *data, const char *str) |
200 | { | |
201 | struct thread_data *td = data; | |
83ea422a | 202 | struct thread_options *o = &td->o; |
211097b2 JA |
203 | char *nr = get_opt_postfix(str); |
204 | ||
83ea422a JA |
205 | o->ddir_seq_nr = 1; |
206 | o->ddir_seq_add = 0; | |
059b0802 JA |
207 | |
208 | if (!nr) | |
209 | return 0; | |
210 | ||
211 | if (td_random(td)) | |
83ea422a | 212 | o->ddir_seq_nr = atoi(nr); |
059b0802 JA |
213 | else { |
214 | long long val; | |
215 | ||
83ea422a | 216 | if (str_to_decimal(nr, &val, 1, o)) { |
059b0802 JA |
217 | log_err("fio: rw postfix parsing failed\n"); |
218 | free(nr); | |
219 | return 1; | |
220 | } | |
221 | ||
83ea422a | 222 | o->ddir_seq_add = val; |
182ec6ee | 223 | } |
211097b2 | 224 | |
059b0802 | 225 | free(nr); |
211097b2 JA |
226 | return 0; |
227 | } | |
228 | ||
214e1eca JA |
229 | static int str_mem_cb(void *data, const char *mem) |
230 | { | |
231 | struct thread_data *td = data; | |
83ea422a | 232 | struct thread_options *o = &td->o; |
214e1eca | 233 | |
83ea422a JA |
234 | if (o->mem_type == MEM_MMAPHUGE || o->mem_type == MEM_MMAP) { |
235 | o->mmapfile = get_opt_postfix(mem); | |
236 | if (o->mem_type == MEM_MMAPHUGE && !o->mmapfile) { | |
214e1eca JA |
237 | log_err("fio: mmaphuge:/path/to/file\n"); |
238 | return 1; | |
239 | } | |
240 | } | |
241 | ||
242 | return 0; | |
243 | } | |
244 | ||
c223da83 JA |
245 | static int fio_clock_source_cb(void *data, const char *str) |
246 | { | |
247 | struct thread_data *td = data; | |
248 | ||
249 | fio_clock_source = td->o.clocksource; | |
250 | fio_time_init(); | |
251 | return 0; | |
252 | } | |
253 | ||
85bc833b | 254 | static int str_rwmix_read_cb(void *data, unsigned long long *val) |
cb499fc4 JA |
255 | { |
256 | struct thread_data *td = data; | |
257 | ||
258 | td->o.rwmix[DDIR_READ] = *val; | |
259 | td->o.rwmix[DDIR_WRITE] = 100 - *val; | |
260 | return 0; | |
261 | } | |
262 | ||
85bc833b | 263 | static int str_rwmix_write_cb(void *data, unsigned long long *val) |
cb499fc4 JA |
264 | { |
265 | struct thread_data *td = data; | |
266 | ||
267 | td->o.rwmix[DDIR_WRITE] = *val; | |
268 | td->o.rwmix[DDIR_READ] = 100 - *val; | |
269 | return 0; | |
270 | } | |
271 | ||
214e1eca JA |
272 | static int str_exitall_cb(void) |
273 | { | |
274 | exitall_on_terminate = 1; | |
275 | return 0; | |
276 | } | |
277 | ||
214e1eca | 278 | #ifdef FIO_HAVE_CPU_AFFINITY |
85bc833b | 279 | static int str_cpumask_cb(void *data, unsigned long long *val) |
d2e268b0 JA |
280 | { |
281 | struct thread_data *td = data; | |
214e1eca | 282 | unsigned int i; |
b03daafb | 283 | long max_cpu; |
d2ce18b5 JA |
284 | int ret; |
285 | ||
286 | ret = fio_cpuset_init(&td->o.cpumask); | |
287 | if (ret < 0) { | |
288 | log_err("fio: cpuset_init failed\n"); | |
289 | td_verror(td, ret, "fio_cpuset_init"); | |
290 | return 1; | |
291 | } | |
214e1eca | 292 | |
c00a2289 | 293 | max_cpu = cpus_online(); |
214e1eca | 294 | |
62a7273d JA |
295 | for (i = 0; i < sizeof(int) * 8; i++) { |
296 | if ((1 << i) & *val) { | |
b03daafb JA |
297 | if (i > max_cpu) { |
298 | log_err("fio: CPU %d too large (max=%ld)\n", i, | |
299 | max_cpu); | |
300 | return 1; | |
301 | } | |
62a7273d | 302 | dprint(FD_PARSE, "set cpu allowed %d\n", i); |
6d459ee7 | 303 | fio_cpu_set(&td->o.cpumask, i); |
62a7273d JA |
304 | } |
305 | } | |
d2e268b0 JA |
306 | |
307 | td->o.cpumask_set = 1; | |
308 | return 0; | |
214e1eca JA |
309 | } |
310 | ||
e8462bd8 JA |
311 | static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask, |
312 | const char *input) | |
214e1eca | 313 | { |
d2e268b0 | 314 | char *cpu, *str, *p; |
b03daafb | 315 | long max_cpu; |
19608d6c | 316 | int ret = 0; |
d2e268b0 | 317 | |
e8462bd8 | 318 | ret = fio_cpuset_init(mask); |
d2ce18b5 JA |
319 | if (ret < 0) { |
320 | log_err("fio: cpuset_init failed\n"); | |
321 | td_verror(td, ret, "fio_cpuset_init"); | |
322 | return 1; | |
323 | } | |
d2e268b0 JA |
324 | |
325 | p = str = strdup(input); | |
214e1eca | 326 | |
d2e268b0 JA |
327 | strip_blank_front(&str); |
328 | strip_blank_end(str); | |
329 | ||
c00a2289 | 330 | max_cpu = cpus_online(); |
b03daafb | 331 | |
d2e268b0 | 332 | while ((cpu = strsep(&str, ",")) != NULL) { |
62a7273d JA |
333 | char *str2, *cpu2; |
334 | int icpu, icpu2; | |
335 | ||
d2e268b0 JA |
336 | if (!strlen(cpu)) |
337 | break; | |
62a7273d JA |
338 | |
339 | str2 = cpu; | |
340 | icpu2 = -1; | |
341 | while ((cpu2 = strsep(&str2, "-")) != NULL) { | |
342 | if (!strlen(cpu2)) | |
343 | break; | |
344 | ||
345 | icpu2 = atoi(cpu2); | |
346 | } | |
347 | ||
348 | icpu = atoi(cpu); | |
349 | if (icpu2 == -1) | |
350 | icpu2 = icpu; | |
351 | while (icpu <= icpu2) { | |
6d459ee7 | 352 | if (icpu >= FIO_MAX_CPUS) { |
19608d6c | 353 | log_err("fio: your OS only supports up to" |
6d459ee7 | 354 | " %d CPUs\n", (int) FIO_MAX_CPUS); |
19608d6c JA |
355 | ret = 1; |
356 | break; | |
357 | } | |
b03daafb JA |
358 | if (icpu > max_cpu) { |
359 | log_err("fio: CPU %d too large (max=%ld)\n", | |
360 | icpu, max_cpu); | |
361 | ret = 1; | |
362 | break; | |
363 | } | |
0b9d69ec | 364 | |
62a7273d | 365 | dprint(FD_PARSE, "set cpu allowed %d\n", icpu); |
e8462bd8 | 366 | fio_cpu_set(mask, icpu); |
62a7273d JA |
367 | icpu++; |
368 | } | |
19608d6c JA |
369 | if (ret) |
370 | break; | |
d2e268b0 JA |
371 | } |
372 | ||
373 | free(p); | |
19608d6c JA |
374 | if (!ret) |
375 | td->o.cpumask_set = 1; | |
376 | return ret; | |
214e1eca | 377 | } |
e8462bd8 JA |
378 | |
379 | static int str_cpus_allowed_cb(void *data, const char *input) | |
380 | { | |
381 | struct thread_data *td = data; | |
382 | int ret; | |
383 | ||
384 | ret = set_cpus_allowed(td, &td->o.cpumask, input); | |
385 | if (!ret) | |
386 | td->o.cpumask_set = 1; | |
387 | ||
388 | return ret; | |
389 | } | |
390 | ||
391 | static int str_verify_cpus_allowed_cb(void *data, const char *input) | |
392 | { | |
393 | struct thread_data *td = data; | |
394 | int ret; | |
395 | ||
396 | ret = set_cpus_allowed(td, &td->o.verify_cpumask, input); | |
397 | if (!ret) | |
398 | td->o.verify_cpumask_set = 1; | |
399 | ||
400 | return ret; | |
401 | } | |
d2e268b0 | 402 | #endif |
214e1eca JA |
403 | |
404 | static int str_fst_cb(void *data, const char *str) | |
405 | { | |
406 | struct thread_data *td = data; | |
407 | char *nr = get_opt_postfix(str); | |
408 | ||
409 | td->file_service_nr = 1; | |
182ec6ee | 410 | if (nr) { |
214e1eca | 411 | td->file_service_nr = atoi(nr); |
182ec6ee JA |
412 | free(nr); |
413 | } | |
214e1eca JA |
414 | |
415 | return 0; | |
416 | } | |
417 | ||
3ae06371 | 418 | #ifdef FIO_HAVE_SYNC_FILE_RANGE |
44f29692 JA |
419 | static int str_sfr_cb(void *data, const char *str) |
420 | { | |
421 | struct thread_data *td = data; | |
422 | char *nr = get_opt_postfix(str); | |
423 | ||
424 | td->sync_file_range_nr = 1; | |
425 | if (nr) { | |
426 | td->sync_file_range_nr = atoi(nr); | |
427 | free(nr); | |
428 | } | |
429 | ||
430 | return 0; | |
431 | } | |
3ae06371 | 432 | #endif |
44f29692 | 433 | |
8e827d35 JA |
434 | /* |
435 | * Return next file in the string. Files are separated with ':'. If the ':' | |
436 | * is escaped with a '\', then that ':' is part of the filename and does not | |
437 | * indicate a new file. | |
438 | */ | |
439 | static char *get_next_file_name(char **ptr) | |
440 | { | |
441 | char *str = *ptr; | |
442 | char *p, *start; | |
443 | ||
444 | if (!str || !strlen(str)) | |
445 | return NULL; | |
446 | ||
447 | start = str; | |
448 | do { | |
449 | /* | |
450 | * No colon, we are done | |
451 | */ | |
452 | p = strchr(str, ':'); | |
453 | if (!p) { | |
454 | *ptr = NULL; | |
455 | break; | |
456 | } | |
457 | ||
458 | /* | |
459 | * We got a colon, but it's the first character. Skip and | |
460 | * continue | |
461 | */ | |
462 | if (p == start) { | |
463 | str = ++start; | |
464 | continue; | |
465 | } | |
466 | ||
467 | if (*(p - 1) != '\\') { | |
468 | *p = '\0'; | |
469 | *ptr = p + 1; | |
470 | break; | |
471 | } | |
472 | ||
473 | memmove(p - 1, p, strlen(p) + 1); | |
474 | str = p; | |
475 | } while (1); | |
476 | ||
477 | return start; | |
478 | } | |
479 | ||
214e1eca JA |
480 | static int str_filename_cb(void *data, const char *input) |
481 | { | |
482 | struct thread_data *td = data; | |
483 | char *fname, *str, *p; | |
484 | ||
485 | p = str = strdup(input); | |
486 | ||
487 | strip_blank_front(&str); | |
488 | strip_blank_end(str); | |
489 | ||
490 | if (!td->files_index) | |
2dc1bbeb | 491 | td->o.nr_files = 0; |
214e1eca | 492 | |
8e827d35 | 493 | while ((fname = get_next_file_name(&str)) != NULL) { |
214e1eca JA |
494 | if (!strlen(fname)) |
495 | break; | |
496 | add_file(td, fname); | |
2dc1bbeb | 497 | td->o.nr_files++; |
214e1eca JA |
498 | } |
499 | ||
500 | free(p); | |
501 | return 0; | |
502 | } | |
503 | ||
504 | static int str_directory_cb(void *data, const char fio_unused *str) | |
505 | { | |
506 | struct thread_data *td = data; | |
507 | struct stat sb; | |
508 | ||
2dc1bbeb | 509 | if (lstat(td->o.directory, &sb) < 0) { |
921c766f JA |
510 | int ret = errno; |
511 | ||
2dc1bbeb | 512 | log_err("fio: %s is not a directory\n", td->o.directory); |
921c766f | 513 | td_verror(td, ret, "lstat"); |
214e1eca JA |
514 | return 1; |
515 | } | |
516 | if (!S_ISDIR(sb.st_mode)) { | |
2dc1bbeb | 517 | log_err("fio: %s is not a directory\n", td->o.directory); |
214e1eca JA |
518 | return 1; |
519 | } | |
520 | ||
521 | return 0; | |
522 | } | |
523 | ||
524 | static int str_opendir_cb(void *data, const char fio_unused *str) | |
525 | { | |
526 | struct thread_data *td = data; | |
527 | ||
528 | if (!td->files_index) | |
2dc1bbeb | 529 | td->o.nr_files = 0; |
214e1eca | 530 | |
2dc1bbeb | 531 | return add_dir_files(td, td->o.opendir); |
214e1eca JA |
532 | } |
533 | ||
0e92f873 | 534 | static int str_verify_pattern_cb(void *data, const char *input) |
90059d65 JA |
535 | { |
536 | struct thread_data *td = data; | |
0e92f873 RR |
537 | long off; |
538 | int i = 0, j = 0, len, k, base = 10; | |
3c3ed070 | 539 | char *loc1, *loc2; |
0e92f873 RR |
540 | |
541 | loc1 = strstr(input, "0x"); | |
542 | loc2 = strstr(input, "0X"); | |
543 | if (loc1 || loc2) | |
544 | base = 16; | |
545 | off = strtol(input, NULL, base); | |
546 | if (off != LONG_MAX || errno != ERANGE) { | |
547 | while (off) { | |
548 | td->o.verify_pattern[i] = off & 0xff; | |
549 | off >>= 8; | |
550 | i++; | |
551 | } | |
552 | } else { | |
553 | len = strlen(input); | |
554 | k = len - 1; | |
555 | if (base == 16) { | |
556 | if (loc1) | |
557 | j = loc1 - input + 2; | |
558 | else | |
559 | j = loc2 - input + 2; | |
560 | } else | |
561 | return 1; | |
562 | if (len - j < MAX_PATTERN_SIZE * 2) { | |
563 | while (k >= j) { | |
564 | off = converthexchartoint(input[k--]); | |
565 | if (k >= j) | |
566 | off += (converthexchartoint(input[k--]) | |
567 | * 16); | |
568 | td->o.verify_pattern[i++] = (char) off; | |
569 | } | |
570 | } | |
571 | } | |
efcd9dcc SL |
572 | |
573 | /* | |
574 | * Fill the pattern all the way to the end. This greatly reduces | |
575 | * the number of memcpy's we have to do when verifying the IO. | |
576 | */ | |
577 | while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) { | |
578 | memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i); | |
579 | i *= 2; | |
580 | } | |
9a2a86d0 SL |
581 | if (i == 1) { |
582 | /* | |
583 | * The code in verify_io_u_pattern assumes a single byte pattern | |
584 | * fills the whole verify pattern buffer. | |
585 | */ | |
586 | memset(td->o.verify_pattern, td->o.verify_pattern[0], | |
587 | MAX_PATTERN_SIZE); | |
588 | } | |
efcd9dcc | 589 | |
0e92f873 | 590 | td->o.verify_pattern_bytes = i; |
efcd9dcc | 591 | |
92bf48d5 JA |
592 | /* |
593 | * VERIFY_META could already be set | |
594 | */ | |
595 | if (td->o.verify == VERIFY_NONE) | |
596 | td->o.verify = VERIFY_PATTERN; | |
efcd9dcc | 597 | |
90059d65 JA |
598 | return 0; |
599 | } | |
214e1eca | 600 | |
4d4e80f2 JA |
601 | static int str_lockfile_cb(void *data, const char *str) |
602 | { | |
603 | struct thread_data *td = data; | |
604 | char *nr = get_opt_postfix(str); | |
605 | ||
606 | td->o.lockfile_batch = 1; | |
182ec6ee | 607 | if (nr) { |
4d4e80f2 | 608 | td->o.lockfile_batch = atoi(nr); |
182ec6ee JA |
609 | free(nr); |
610 | } | |
4d4e80f2 JA |
611 | |
612 | return 0; | |
613 | } | |
614 | ||
993bf48b JA |
615 | static int str_gtod_reduce_cb(void *data, int *il) |
616 | { | |
617 | struct thread_data *td = data; | |
618 | int val = *il; | |
619 | ||
02af0988 | 620 | td->o.disable_lat = !!val; |
993bf48b JA |
621 | td->o.disable_clat = !!val; |
622 | td->o.disable_slat = !!val; | |
623 | td->o.disable_bw = !!val; | |
0dc1bc03 | 624 | td->o.clat_percentiles = !val; |
993bf48b JA |
625 | if (val) |
626 | td->tv_cache_mask = 63; | |
627 | ||
628 | return 0; | |
629 | } | |
630 | ||
85bc833b | 631 | static int str_gtod_cpu_cb(void *data, long long *il) |
be4ecfdf JA |
632 | { |
633 | struct thread_data *td = data; | |
634 | int val = *il; | |
635 | ||
636 | td->o.gtod_cpu = val; | |
637 | td->o.gtod_offload = 1; | |
638 | return 0; | |
639 | } | |
640 | ||
7bb59102 JA |
641 | static int str_size_cb(void *data, unsigned long long *__val) |
642 | { | |
643 | struct thread_data *td = data; | |
644 | unsigned long long v = *__val; | |
645 | ||
646 | if (parse_is_percent(v)) { | |
647 | td->o.size = 0; | |
648 | td->o.size_percent = -1ULL - v; | |
649 | } else | |
650 | td->o.size = v; | |
651 | ||
652 | return 0; | |
653 | } | |
654 | ||
896cac2a JA |
655 | static int rw_verify(struct fio_option *o, void *data) |
656 | { | |
657 | struct thread_data *td = data; | |
658 | ||
659 | if (read_only && td_write(td)) { | |
660 | log_err("fio: job <%s> has write bit set, but fio is in" | |
661 | " read-only mode\n", td->o.name); | |
662 | return 1; | |
663 | } | |
664 | ||
665 | return 0; | |
666 | } | |
667 | ||
276ca4f7 | 668 | static int gtod_cpu_verify(struct fio_option *o, void *data) |
29d43ff9 | 669 | { |
276ca4f7 | 670 | #ifndef FIO_HAVE_CPU_AFFINITY |
29d43ff9 JA |
671 | struct thread_data *td = data; |
672 | ||
29d43ff9 JA |
673 | if (td->o.gtod_cpu) { |
674 | log_err("fio: platform must support CPU affinity for" | |
675 | "gettimeofday() offloading\n"); | |
676 | return 1; | |
677 | } | |
678 | #endif | |
679 | ||
680 | return 0; | |
681 | } | |
682 | ||
90fef2d1 JA |
683 | static int kb_base_verify(struct fio_option *o, void *data) |
684 | { | |
685 | struct thread_data *td = data; | |
686 | ||
687 | if (td->o.kb_base != 1024 && td->o.kb_base != 1000) { | |
688 | log_err("fio: kb_base set to nonsensical value: %u\n", | |
689 | td->o.kb_base); | |
690 | return 1; | |
691 | } | |
692 | ||
693 | return 0; | |
694 | } | |
695 | ||
9af4a244 JA |
696 | /* |
697 | * Option grouping | |
698 | */ | |
699 | static struct opt_group fio_opt_groups[] = { | |
700 | { | |
e8b0e958 JA |
701 | .name = "General", |
702 | .mask = FIO_OPT_C_GENERAL, | |
9af4a244 JA |
703 | }, |
704 | { | |
e8b0e958 JA |
705 | .name = "I/O", |
706 | .mask = FIO_OPT_C_IO, | |
9af4a244 JA |
707 | }, |
708 | { | |
e8b0e958 JA |
709 | .name = "File", |
710 | .mask = FIO_OPT_C_FILE, | |
9af4a244 JA |
711 | }, |
712 | { | |
e8b0e958 JA |
713 | .name = "Statistics", |
714 | .mask = FIO_OPT_C_STAT, | |
9af4a244 JA |
715 | }, |
716 | { | |
e8b0e958 JA |
717 | .name = "Logging", |
718 | .mask = FIO_OPT_C_LOG, | |
9af4a244 | 719 | }, |
e231bbe6 | 720 | { |
e8b0e958 | 721 | .name = NULL, |
e231bbe6 | 722 | }, |
e8b0e958 JA |
723 | }; |
724 | ||
725 | static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask, | |
726 | unsigned int inv_mask) | |
727 | { | |
728 | struct opt_group *og; | |
729 | int i; | |
730 | ||
731 | if (*mask == inv_mask || !*mask) | |
732 | return NULL; | |
733 | ||
734 | for (i = 0; ogs[i].name; i++) { | |
735 | og = &ogs[i]; | |
736 | ||
737 | if (*mask & og->mask) { | |
738 | *mask &= ~(og->mask); | |
739 | return og; | |
740 | } | |
741 | } | |
742 | ||
743 | return NULL; | |
744 | } | |
745 | ||
746 | struct opt_group *opt_group_from_mask(unsigned int *mask) | |
747 | { | |
748 | return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID); | |
749 | } | |
750 | ||
751 | static struct opt_group fio_opt_cat_groups[] = { | |
9af4a244 | 752 | { |
e8b0e958 JA |
753 | .name = "Rate", |
754 | .mask = FIO_OPT_G_RATE, | |
9af4a244 JA |
755 | }, |
756 | { | |
e8b0e958 JA |
757 | .name = "Zone", |
758 | .mask = FIO_OPT_G_ZONE, | |
9af4a244 JA |
759 | }, |
760 | { | |
e8b0e958 JA |
761 | .name = "Read/write mix", |
762 | .mask = FIO_OPT_G_RWMIX, | |
9af4a244 JA |
763 | }, |
764 | { | |
765 | .name = "Verify", | |
766 | .mask = FIO_OPT_G_VERIFY, | |
767 | }, | |
768 | { | |
e8b0e958 JA |
769 | .name = "Trim", |
770 | .mask = FIO_OPT_G_TRIM, | |
9af4a244 JA |
771 | }, |
772 | { | |
e8b0e958 JA |
773 | .name = "I/O Logging", |
774 | .mask = FIO_OPT_G_IOLOG, | |
9af4a244 JA |
775 | }, |
776 | { | |
e8b0e958 JA |
777 | .name = "I/O Depth", |
778 | .mask = FIO_OPT_G_IO_DEPTH, | |
9af4a244 JA |
779 | }, |
780 | { | |
e8b0e958 JA |
781 | .name = "I/O Flow", |
782 | .mask = FIO_OPT_G_IO_FLOW, | |
9af4a244 | 783 | }, |
0626037e JA |
784 | { |
785 | .name = "Description", | |
786 | .mask = FIO_OPT_G_DESC, | |
787 | }, | |
788 | { | |
789 | .name = "Filename", | |
790 | .mask = FIO_OPT_G_FILENAME, | |
791 | }, | |
792 | { | |
793 | .name = "General I/O", | |
794 | .mask = FIO_OPT_G_IO_BASIC, | |
795 | }, | |
a1f6afec JA |
796 | { |
797 | .name = "Cgroups", | |
798 | .mask = FIO_OPT_G_CGROUP, | |
799 | }, | |
800 | { | |
801 | .name = "Runtime", | |
802 | .mask = FIO_OPT_G_RUNTIME, | |
803 | }, | |
10860056 JA |
804 | { |
805 | .name = "Process", | |
806 | .mask = FIO_OPT_G_PROCESS, | |
807 | }, | |
808 | { | |
809 | .name = "Job credentials / priority", | |
810 | .mask = FIO_OPT_G_CRED, | |
811 | }, | |
812 | { | |
813 | .name = "Clock settings", | |
814 | .mask = FIO_OPT_G_CLOCK, | |
815 | }, | |
3ceb458f JA |
816 | { |
817 | .name = "I/O Type", | |
818 | .mask = FIO_OPT_G_IO_TYPE, | |
819 | }, | |
820 | { | |
821 | .name = "I/O Thinktime", | |
822 | .mask = FIO_OPT_G_THINKTIME, | |
823 | }, | |
824 | { | |
825 | .name = "Randomizations", | |
826 | .mask = FIO_OPT_G_RANDOM, | |
827 | }, | |
828 | { | |
829 | .name = "I/O buffers", | |
830 | .mask = FIO_OPT_G_IO_BUF, | |
831 | }, | |
9af4a244 JA |
832 | { |
833 | .name = NULL, | |
e8b0e958 | 834 | } |
9af4a244 JA |
835 | }; |
836 | ||
e8b0e958 | 837 | struct opt_group *opt_group_cat_from_mask(unsigned int *mask) |
9af4a244 | 838 | { |
e8b0e958 | 839 | return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID); |
9af4a244 JA |
840 | } |
841 | ||
214e1eca JA |
842 | /* |
843 | * Map of job/command line options | |
844 | */ | |
9af4a244 | 845 | struct fio_option fio_options[FIO_MAX_OPTS] = { |
214e1eca JA |
846 | { |
847 | .name = "description", | |
e8b0e958 | 848 | .lname = "Description of job", |
214e1eca JA |
849 | .type = FIO_OPT_STR_STORE, |
850 | .off1 = td_var_offset(description), | |
851 | .help = "Text job description", | |
e8b0e958 | 852 | .category = FIO_OPT_C_GENERAL, |
0626037e | 853 | .group = FIO_OPT_G_DESC, |
214e1eca JA |
854 | }, |
855 | { | |
856 | .name = "name", | |
e8b0e958 | 857 | .lname = "Job name", |
214e1eca JA |
858 | .type = FIO_OPT_STR_STORE, |
859 | .off1 = td_var_offset(name), | |
860 | .help = "Name of this job", | |
e8b0e958 | 861 | .category = FIO_OPT_C_GENERAL, |
0626037e | 862 | .group = FIO_OPT_G_DESC, |
214e1eca | 863 | }, |
214e1eca JA |
864 | { |
865 | .name = "filename", | |
e8b0e958 | 866 | .lname = "Filename(s)", |
214e1eca JA |
867 | .type = FIO_OPT_STR_STORE, |
868 | .off1 = td_var_offset(filename), | |
869 | .cb = str_filename_cb, | |
f0d524b0 | 870 | .prio = -1, /* must come after "directory" */ |
214e1eca | 871 | .help = "File(s) to use for the workload", |
e8b0e958 | 872 | .category = FIO_OPT_C_FILE, |
0626037e | 873 | .group = FIO_OPT_G_FILENAME, |
214e1eca | 874 | }, |
90fef2d1 | 875 | { |
e8b0e958 JA |
876 | .name = "directory", |
877 | .lname = "Directory", | |
878 | .type = FIO_OPT_STR_STORE, | |
879 | .off1 = td_var_offset(directory), | |
880 | .cb = str_directory_cb, | |
881 | .help = "Directory to store files in", | |
882 | .category = FIO_OPT_C_FILE, | |
0626037e | 883 | .group = FIO_OPT_G_FILENAME, |
90fef2d1 | 884 | }, |
29c1349f JA |
885 | { |
886 | .name = "lockfile", | |
e8b0e958 | 887 | .lname = "Lockfile", |
4d4e80f2 JA |
888 | .type = FIO_OPT_STR, |
889 | .cb = str_lockfile_cb, | |
890 | .off1 = td_var_offset(file_lock_mode), | |
29c1349f JA |
891 | .help = "Lock file when doing IO to it", |
892 | .parent = "filename", | |
d71c154c | 893 | .hide = 0, |
4d4e80f2 | 894 | .def = "none", |
e8b0e958 | 895 | .category = FIO_OPT_C_FILE, |
0626037e | 896 | .group = FIO_OPT_G_FILENAME, |
4d4e80f2 JA |
897 | .posval = { |
898 | { .ival = "none", | |
899 | .oval = FILE_LOCK_NONE, | |
900 | .help = "No file locking", | |
901 | }, | |
902 | { .ival = "exclusive", | |
903 | .oval = FILE_LOCK_EXCLUSIVE, | |
904 | .help = "Exclusive file lock", | |
905 | }, | |
906 | { | |
907 | .ival = "readwrite", | |
908 | .oval = FILE_LOCK_READWRITE, | |
909 | .help = "Read vs write lock", | |
910 | }, | |
911 | }, | |
29c1349f | 912 | }, |
214e1eca JA |
913 | { |
914 | .name = "opendir", | |
e8b0e958 | 915 | .lname = "Open directory", |
214e1eca JA |
916 | .type = FIO_OPT_STR_STORE, |
917 | .off1 = td_var_offset(opendir), | |
918 | .cb = str_opendir_cb, | |
919 | .help = "Recursively add files from this directory and down", | |
e8b0e958 | 920 | .category = FIO_OPT_C_FILE, |
0626037e | 921 | .group = FIO_OPT_G_FILENAME, |
214e1eca JA |
922 | }, |
923 | { | |
924 | .name = "rw", | |
e8b0e958 | 925 | .lname = "Read/write", |
d3aad8f2 | 926 | .alias = "readwrite", |
214e1eca | 927 | .type = FIO_OPT_STR, |
211097b2 | 928 | .cb = str_rw_cb, |
214e1eca JA |
929 | .off1 = td_var_offset(td_ddir), |
930 | .help = "IO direction", | |
931 | .def = "read", | |
896cac2a | 932 | .verify = rw_verify, |
e8b0e958 | 933 | .category = FIO_OPT_C_IO, |
0626037e | 934 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
935 | .posval = { |
936 | { .ival = "read", | |
937 | .oval = TD_DDIR_READ, | |
938 | .help = "Sequential read", | |
939 | }, | |
940 | { .ival = "write", | |
941 | .oval = TD_DDIR_WRITE, | |
942 | .help = "Sequential write", | |
943 | }, | |
944 | { .ival = "randread", | |
945 | .oval = TD_DDIR_RANDREAD, | |
946 | .help = "Random read", | |
947 | }, | |
948 | { .ival = "randwrite", | |
949 | .oval = TD_DDIR_RANDWRITE, | |
950 | .help = "Random write", | |
951 | }, | |
952 | { .ival = "rw", | |
953 | .oval = TD_DDIR_RW, | |
954 | .help = "Sequential read and write mix", | |
955 | }, | |
956 | { .ival = "randrw", | |
957 | .oval = TD_DDIR_RANDRW, | |
958 | .help = "Random read and write mix" | |
959 | }, | |
960 | }, | |
961 | }, | |
38dad62d JA |
962 | { |
963 | .name = "rw_sequencer", | |
e8b0e958 | 964 | .lname = "RW Sequencer", |
38dad62d JA |
965 | .type = FIO_OPT_STR, |
966 | .off1 = td_var_offset(rw_seq), | |
967 | .help = "IO offset generator modifier", | |
968 | .def = "sequential", | |
e8b0e958 | 969 | .category = FIO_OPT_C_IO, |
0626037e | 970 | .group = FIO_OPT_G_IO_BASIC, |
38dad62d JA |
971 | .posval = { |
972 | { .ival = "sequential", | |
973 | .oval = RW_SEQ_SEQ, | |
974 | .help = "Generate sequential offsets", | |
975 | }, | |
976 | { .ival = "identical", | |
977 | .oval = RW_SEQ_IDENT, | |
978 | .help = "Generate identical offsets", | |
979 | }, | |
980 | }, | |
981 | }, | |
982 | ||
214e1eca JA |
983 | { |
984 | .name = "ioengine", | |
e8b0e958 | 985 | .lname = "IO Engine", |
214e1eca JA |
986 | .type = FIO_OPT_STR_STORE, |
987 | .off1 = td_var_offset(ioengine), | |
988 | .help = "IO engine to use", | |
58483fa4 | 989 | .def = FIO_PREFERRED_ENGINE, |
e8b0e958 | 990 | .category = FIO_OPT_C_IO, |
0626037e | 991 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
992 | .posval = { |
993 | { .ival = "sync", | |
994 | .help = "Use read/write", | |
995 | }, | |
a31041ea | 996 | { .ival = "psync", |
997 | .help = "Use pread/pwrite", | |
998 | }, | |
1d2af02a | 999 | { .ival = "vsync", |
03e20d68 | 1000 | .help = "Use readv/writev", |
1d2af02a | 1001 | }, |
214e1eca JA |
1002 | #ifdef FIO_HAVE_LIBAIO |
1003 | { .ival = "libaio", | |
1004 | .help = "Linux native asynchronous IO", | |
1005 | }, | |
1006 | #endif | |
1007 | #ifdef FIO_HAVE_POSIXAIO | |
1008 | { .ival = "posixaio", | |
1009 | .help = "POSIX asynchronous IO", | |
1010 | }, | |
417f0068 JA |
1011 | #endif |
1012 | #ifdef FIO_HAVE_SOLARISAIO | |
1013 | { .ival = "solarisaio", | |
1014 | .help = "Solaris native asynchronous IO", | |
1015 | }, | |
214e1eca | 1016 | #endif |
03e20d68 BC |
1017 | #ifdef FIO_HAVE_WINDOWSAIO |
1018 | { .ival = "windowsaio", | |
3be80071 | 1019 | .help = "Windows native asynchronous IO" |
de890a1e | 1020 | }, |
3be80071 | 1021 | #endif |
214e1eca | 1022 | { .ival = "mmap", |
03e20d68 | 1023 | .help = "Memory mapped IO" |
214e1eca JA |
1024 | }, |
1025 | #ifdef FIO_HAVE_SPLICE | |
1026 | { .ival = "splice", | |
1027 | .help = "splice/vmsplice based IO", | |
1028 | }, | |
9cce02e8 JA |
1029 | { .ival = "netsplice", |
1030 | .help = "splice/vmsplice to/from the network", | |
1031 | }, | |
214e1eca JA |
1032 | #endif |
1033 | #ifdef FIO_HAVE_SGIO | |
1034 | { .ival = "sg", | |
1035 | .help = "SCSI generic v3 IO", | |
1036 | }, | |
1037 | #endif | |
1038 | { .ival = "null", | |
1039 | .help = "Testing engine (no data transfer)", | |
1040 | }, | |
1041 | { .ival = "net", | |
1042 | .help = "Network IO", | |
1043 | }, | |
1044 | #ifdef FIO_HAVE_SYSLET | |
1045 | { .ival = "syslet-rw", | |
1046 | .help = "syslet enabled async pread/pwrite IO", | |
1047 | }, | |
1048 | #endif | |
1049 | { .ival = "cpuio", | |
03e20d68 | 1050 | .help = "CPU cycle burner engine", |
214e1eca | 1051 | }, |
b8c82a46 JA |
1052 | #ifdef FIO_HAVE_GUASI |
1053 | { .ival = "guasi", | |
1054 | .help = "GUASI IO engine", | |
1055 | }, | |
79a43187 JA |
1056 | #endif |
1057 | #ifdef FIO_HAVE_BINJECT | |
1058 | { .ival = "binject", | |
1059 | .help = "binject direct inject block engine", | |
1060 | }, | |
21b8aee8 | 1061 | #endif |
1062 | #ifdef FIO_HAVE_RDMA | |
1063 | { .ival = "rdma", | |
1064 | .help = "RDMA IO engine", | |
1065 | }, | |
b8c82a46 | 1066 | #endif |
214e1eca JA |
1067 | { .ival = "external", |
1068 | .help = "Load external engine (append name)", | |
1069 | }, | |
1070 | }, | |
1071 | }, | |
1072 | { | |
1073 | .name = "iodepth", | |
e8b0e958 | 1074 | .lname = "IO Depth", |
214e1eca JA |
1075 | .type = FIO_OPT_INT, |
1076 | .off1 = td_var_offset(iodepth), | |
03e20d68 | 1077 | .help = "Number of IO buffers to keep in flight", |
757aff4f | 1078 | .minval = 1, |
20eb06bd | 1079 | .interval = 1, |
214e1eca | 1080 | .def = "1", |
e8b0e958 | 1081 | .category = FIO_OPT_C_IO, |
0626037e | 1082 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1083 | }, |
1084 | { | |
1085 | .name = "iodepth_batch", | |
e8b0e958 | 1086 | .lname = "IO Depth batch", |
4950421a | 1087 | .alias = "iodepth_batch_submit", |
214e1eca JA |
1088 | .type = FIO_OPT_INT, |
1089 | .off1 = td_var_offset(iodepth_batch), | |
d65db441 | 1090 | .help = "Number of IO buffers to submit in one go", |
afdf9352 | 1091 | .parent = "iodepth", |
d71c154c | 1092 | .hide = 1, |
a2e6f8ac | 1093 | .minval = 1, |
20eb06bd | 1094 | .interval = 1, |
a2e6f8ac | 1095 | .def = "1", |
e8b0e958 | 1096 | .category = FIO_OPT_C_IO, |
0626037e | 1097 | .group = FIO_OPT_G_IO_BASIC, |
4950421a JA |
1098 | }, |
1099 | { | |
1100 | .name = "iodepth_batch_complete", | |
e8b0e958 | 1101 | .lname = "IO Depth batch complete", |
4950421a JA |
1102 | .type = FIO_OPT_INT, |
1103 | .off1 = td_var_offset(iodepth_batch_complete), | |
d65db441 | 1104 | .help = "Number of IO buffers to retrieve in one go", |
4950421a | 1105 | .parent = "iodepth", |
d71c154c | 1106 | .hide = 1, |
4950421a | 1107 | .minval = 0, |
20eb06bd | 1108 | .interval = 1, |
4950421a | 1109 | .def = "1", |
e8b0e958 | 1110 | .category = FIO_OPT_C_IO, |
0626037e | 1111 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1112 | }, |
1113 | { | |
1114 | .name = "iodepth_low", | |
e8b0e958 | 1115 | .lname = "IO Depth batch low", |
214e1eca JA |
1116 | .type = FIO_OPT_INT, |
1117 | .off1 = td_var_offset(iodepth_low), | |
1118 | .help = "Low water mark for queuing depth", | |
afdf9352 | 1119 | .parent = "iodepth", |
d71c154c | 1120 | .hide = 1, |
20eb06bd | 1121 | .interval = 1, |
e8b0e958 | 1122 | .category = FIO_OPT_C_IO, |
0626037e | 1123 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1124 | }, |
1125 | { | |
1126 | .name = "size", | |
e8b0e958 | 1127 | .lname = "Size", |
214e1eca | 1128 | .type = FIO_OPT_STR_VAL, |
7bb59102 | 1129 | .cb = str_size_cb, |
214e1eca | 1130 | .help = "Total size of device or files", |
20eb06bd | 1131 | .interval = 1024 * 1024, |
e8b0e958 JA |
1132 | .category = FIO_OPT_C_IO, |
1133 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1134 | }, |
aa31f1f1 SL |
1135 | { |
1136 | .name = "fill_device", | |
e8b0e958 | 1137 | .lname = "Fill device", |
74586c1e | 1138 | .alias = "fill_fs", |
aa31f1f1 SL |
1139 | .type = FIO_OPT_BOOL, |
1140 | .off1 = td_var_offset(fill_device), | |
1141 | .help = "Write until an ENOSPC error occurs", | |
1142 | .def = "0", | |
e8b0e958 JA |
1143 | .category = FIO_OPT_C_FILE, |
1144 | .group = FIO_OPT_G_INVALID, | |
aa31f1f1 | 1145 | }, |
214e1eca JA |
1146 | { |
1147 | .name = "filesize", | |
e8b0e958 | 1148 | .lname = "File size", |
214e1eca JA |
1149 | .type = FIO_OPT_STR_VAL, |
1150 | .off1 = td_var_offset(file_size_low), | |
1151 | .off2 = td_var_offset(file_size_high), | |
c3edbdba | 1152 | .minval = 1, |
214e1eca | 1153 | .help = "Size of individual files", |
20eb06bd | 1154 | .interval = 1024 * 1024, |
e8b0e958 JA |
1155 | .category = FIO_OPT_C_FILE, |
1156 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1157 | }, |
67a1000f JA |
1158 | { |
1159 | .name = "offset", | |
e8b0e958 | 1160 | .lname = "IO offset", |
67a1000f JA |
1161 | .alias = "fileoffset", |
1162 | .type = FIO_OPT_STR_VAL, | |
1163 | .off1 = td_var_offset(start_offset), | |
1164 | .help = "Start IO from this offset", | |
1165 | .def = "0", | |
20eb06bd | 1166 | .interval = 1024 * 1024, |
e8b0e958 JA |
1167 | .category = FIO_OPT_C_IO, |
1168 | .group = FIO_OPT_G_INVALID, | |
67a1000f | 1169 | }, |
2d7cd868 JA |
1170 | { |
1171 | .name = "offset_increment", | |
e8b0e958 | 1172 | .lname = "IO offset increment", |
2d7cd868 JA |
1173 | .type = FIO_OPT_STR_VAL, |
1174 | .off1 = td_var_offset(offset_increment), | |
1175 | .help = "What is the increment from one offset to the next", | |
1176 | .parent = "offset", | |
d71c154c | 1177 | .hide = 1, |
2d7cd868 | 1178 | .def = "0", |
20eb06bd | 1179 | .interval = 1024 * 1024, |
e8b0e958 JA |
1180 | .category = FIO_OPT_C_IO, |
1181 | .group = FIO_OPT_G_INVALID, | |
2d7cd868 | 1182 | }, |
214e1eca JA |
1183 | { |
1184 | .name = "bs", | |
e8b0e958 | 1185 | .lname = "Block size", |
d3aad8f2 | 1186 | .alias = "blocksize", |
e01b22b8 | 1187 | .type = FIO_OPT_INT, |
214e1eca JA |
1188 | .off1 = td_var_offset(bs[DDIR_READ]), |
1189 | .off2 = td_var_offset(bs[DDIR_WRITE]), | |
c3edbdba | 1190 | .minval = 1, |
214e1eca JA |
1191 | .help = "Block size unit", |
1192 | .def = "4k", | |
67a1000f | 1193 | .parent = "rw", |
d71c154c | 1194 | .hide = 1, |
20eb06bd | 1195 | .interval = 512, |
e8b0e958 JA |
1196 | .category = FIO_OPT_C_IO, |
1197 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1198 | }, |
2b7a01d0 JA |
1199 | { |
1200 | .name = "ba", | |
e8b0e958 | 1201 | .lname = "Block size align", |
2b7a01d0 | 1202 | .alias = "blockalign", |
e01b22b8 | 1203 | .type = FIO_OPT_INT, |
2b7a01d0 JA |
1204 | .off1 = td_var_offset(ba[DDIR_READ]), |
1205 | .off2 = td_var_offset(ba[DDIR_WRITE]), | |
1206 | .minval = 1, | |
1207 | .help = "IO block offset alignment", | |
1208 | .parent = "rw", | |
d71c154c | 1209 | .hide = 1, |
20eb06bd | 1210 | .interval = 512, |
e8b0e958 JA |
1211 | .category = FIO_OPT_C_IO, |
1212 | .group = FIO_OPT_G_INVALID, | |
2b7a01d0 | 1213 | }, |
214e1eca JA |
1214 | { |
1215 | .name = "bsrange", | |
e8b0e958 | 1216 | .lname = "Block size range", |
d3aad8f2 | 1217 | .alias = "blocksize_range", |
214e1eca JA |
1218 | .type = FIO_OPT_RANGE, |
1219 | .off1 = td_var_offset(min_bs[DDIR_READ]), | |
1220 | .off2 = td_var_offset(max_bs[DDIR_READ]), | |
1221 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), | |
1222 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), | |
c3edbdba | 1223 | .minval = 1, |
214e1eca | 1224 | .help = "Set block size range (in more detail than bs)", |
67a1000f | 1225 | .parent = "rw", |
d71c154c | 1226 | .hide = 1, |
20eb06bd | 1227 | .interval = 4096, |
e8b0e958 JA |
1228 | .category = FIO_OPT_C_IO, |
1229 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1230 | }, |
564ca972 JA |
1231 | { |
1232 | .name = "bssplit", | |
e8b0e958 | 1233 | .lname = "Block size split", |
564ca972 JA |
1234 | .type = FIO_OPT_STR, |
1235 | .cb = str_bssplit_cb, | |
1236 | .help = "Set a specific mix of block sizes", | |
1237 | .parent = "rw", | |
d71c154c | 1238 | .hide = 1, |
e8b0e958 JA |
1239 | .category = FIO_OPT_C_IO, |
1240 | .group = FIO_OPT_G_INVALID, | |
564ca972 | 1241 | }, |
214e1eca JA |
1242 | { |
1243 | .name = "bs_unaligned", | |
e8b0e958 | 1244 | .lname = "Block size unaligned", |
d3aad8f2 | 1245 | .alias = "blocksize_unaligned", |
214e1eca JA |
1246 | .type = FIO_OPT_STR_SET, |
1247 | .off1 = td_var_offset(bs_unaligned), | |
1248 | .help = "Don't sector align IO buffer sizes", | |
67a1000f | 1249 | .parent = "rw", |
d71c154c | 1250 | .hide = 1, |
e8b0e958 JA |
1251 | .category = FIO_OPT_C_IO, |
1252 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1253 | }, |
1254 | { | |
1255 | .name = "randrepeat", | |
e8b0e958 | 1256 | .lname = "Random repeatable", |
214e1eca JA |
1257 | .type = FIO_OPT_BOOL, |
1258 | .off1 = td_var_offset(rand_repeatable), | |
1259 | .help = "Use repeatable random IO pattern", | |
1260 | .def = "1", | |
67a1000f | 1261 | .parent = "rw", |
d71c154c | 1262 | .hide = 1, |
e8b0e958 | 1263 | .category = FIO_OPT_C_IO, |
3ceb458f | 1264 | .group = FIO_OPT_G_RANDOM, |
214e1eca | 1265 | }, |
2615cc4b JA |
1266 | { |
1267 | .name = "use_os_rand", | |
e8b0e958 | 1268 | .lname = "Use OS random", |
2615cc4b JA |
1269 | .type = FIO_OPT_BOOL, |
1270 | .off1 = td_var_offset(use_os_rand), | |
1271 | .help = "Set to use OS random generator", | |
1272 | .def = "0", | |
1273 | .parent = "rw", | |
d71c154c | 1274 | .hide = 1, |
e8b0e958 | 1275 | .category = FIO_OPT_C_IO, |
3ceb458f | 1276 | .group = FIO_OPT_G_RANDOM, |
2615cc4b | 1277 | }, |
214e1eca JA |
1278 | { |
1279 | .name = "norandommap", | |
e8b0e958 | 1280 | .lname = "No randommap", |
214e1eca JA |
1281 | .type = FIO_OPT_STR_SET, |
1282 | .off1 = td_var_offset(norandommap), | |
1283 | .help = "Accept potential duplicate random blocks", | |
67a1000f | 1284 | .parent = "rw", |
d71c154c | 1285 | .hide = 1, |
b2452a43 | 1286 | .hide_on_set = 1, |
e8b0e958 | 1287 | .category = FIO_OPT_C_IO, |
3ceb458f | 1288 | .group = FIO_OPT_G_RANDOM, |
214e1eca | 1289 | }, |
2b386d25 JA |
1290 | { |
1291 | .name = "softrandommap", | |
e8b0e958 | 1292 | .lname = "Soft randommap", |
2b386d25 JA |
1293 | .type = FIO_OPT_BOOL, |
1294 | .off1 = td_var_offset(softrandommap), | |
f66ab3c8 | 1295 | .help = "Set norandommap if randommap allocation fails", |
2b386d25 | 1296 | .parent = "norandommap", |
d71c154c | 1297 | .hide = 1, |
2b386d25 | 1298 | .def = "0", |
e8b0e958 | 1299 | .category = FIO_OPT_C_IO, |
3ceb458f | 1300 | .group = FIO_OPT_G_RANDOM, |
2b386d25 | 1301 | }, |
214e1eca JA |
1302 | { |
1303 | .name = "nrfiles", | |
e8b0e958 | 1304 | .lname = "Number of files", |
d7c8be03 | 1305 | .alias = "nr_files", |
214e1eca JA |
1306 | .type = FIO_OPT_INT, |
1307 | .off1 = td_var_offset(nr_files), | |
1308 | .help = "Split job workload between this number of files", | |
1309 | .def = "1", | |
20eb06bd | 1310 | .interval = 1, |
e8b0e958 JA |
1311 | .category = FIO_OPT_C_FILE, |
1312 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1313 | }, |
1314 | { | |
1315 | .name = "openfiles", | |
e8b0e958 | 1316 | .lname = "Number of open files", |
214e1eca JA |
1317 | .type = FIO_OPT_INT, |
1318 | .off1 = td_var_offset(open_files), | |
1319 | .help = "Number of files to keep open at the same time", | |
e8b0e958 JA |
1320 | .category = FIO_OPT_C_FILE, |
1321 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1322 | }, |
1323 | { | |
1324 | .name = "file_service_type", | |
e8b0e958 | 1325 | .lname = "File service type", |
214e1eca JA |
1326 | .type = FIO_OPT_STR, |
1327 | .cb = str_fst_cb, | |
1328 | .off1 = td_var_offset(file_service_type), | |
1329 | .help = "How to select which file to service next", | |
1330 | .def = "roundrobin", | |
e8b0e958 JA |
1331 | .category = FIO_OPT_C_FILE, |
1332 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1333 | .posval = { |
1334 | { .ival = "random", | |
1335 | .oval = FIO_FSERVICE_RANDOM, | |
1336 | .help = "Choose a file at random", | |
1337 | }, | |
1338 | { .ival = "roundrobin", | |
1339 | .oval = FIO_FSERVICE_RR, | |
1340 | .help = "Round robin select files", | |
1341 | }, | |
a086c257 JA |
1342 | { .ival = "sequential", |
1343 | .oval = FIO_FSERVICE_SEQ, | |
1344 | .help = "Finish one file before moving to the next", | |
1345 | }, | |
214e1eca | 1346 | }, |
67a1000f | 1347 | .parent = "nrfiles", |
d71c154c | 1348 | .hide = 1, |
67a1000f | 1349 | }, |
7bc8c2cf JA |
1350 | #ifdef FIO_HAVE_FALLOCATE |
1351 | { | |
1352 | .name = "fallocate", | |
e8b0e958 | 1353 | .lname = "Fallocate", |
a596f047 EG |
1354 | .type = FIO_OPT_STR, |
1355 | .off1 = td_var_offset(fallocate_mode), | |
1356 | .help = "Whether pre-allocation is performed when laying out files", | |
1357 | .def = "posix", | |
e8b0e958 JA |
1358 | .category = FIO_OPT_C_FILE, |
1359 | .group = FIO_OPT_G_INVALID, | |
a596f047 EG |
1360 | .posval = { |
1361 | { .ival = "none", | |
1362 | .oval = FIO_FALLOCATE_NONE, | |
1363 | .help = "Do not pre-allocate space", | |
1364 | }, | |
1365 | { .ival = "posix", | |
1366 | .oval = FIO_FALLOCATE_POSIX, | |
1367 | .help = "Use posix_fallocate()", | |
1368 | }, | |
1369 | #ifdef FIO_HAVE_LINUX_FALLOCATE | |
1370 | { .ival = "keep", | |
1371 | .oval = FIO_FALLOCATE_KEEP_SIZE, | |
1372 | .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)", | |
1373 | }, | |
7bc8c2cf | 1374 | #endif |
a596f047 EG |
1375 | /* Compatibility with former boolean values */ |
1376 | { .ival = "0", | |
1377 | .oval = FIO_FALLOCATE_NONE, | |
1378 | .help = "Alias for 'none'", | |
1379 | }, | |
1380 | { .ival = "1", | |
1381 | .oval = FIO_FALLOCATE_POSIX, | |
1382 | .help = "Alias for 'posix'", | |
1383 | }, | |
1384 | }, | |
1385 | }, | |
1386 | #endif /* FIO_HAVE_FALLOCATE */ | |
67a1000f JA |
1387 | { |
1388 | .name = "fadvise_hint", | |
e8b0e958 | 1389 | .lname = "Fadvise hint", |
67a1000f JA |
1390 | .type = FIO_OPT_BOOL, |
1391 | .off1 = td_var_offset(fadvise_hint), | |
1392 | .help = "Use fadvise() to advise the kernel on IO pattern", | |
1393 | .def = "1", | |
e8b0e958 JA |
1394 | .category = FIO_OPT_C_FILE, |
1395 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1396 | }, |
1397 | { | |
1398 | .name = "fsync", | |
e8b0e958 | 1399 | .lname = "Fsync", |
214e1eca JA |
1400 | .type = FIO_OPT_INT, |
1401 | .off1 = td_var_offset(fsync_blocks), | |
1402 | .help = "Issue fsync for writes every given number of blocks", | |
1403 | .def = "0", | |
20eb06bd | 1404 | .interval = 1, |
e8b0e958 JA |
1405 | .category = FIO_OPT_C_FILE, |
1406 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1407 | }, |
5f9099ea JA |
1408 | { |
1409 | .name = "fdatasync", | |
e8b0e958 | 1410 | .lname = "Fdatasync", |
5f9099ea JA |
1411 | .type = FIO_OPT_INT, |
1412 | .off1 = td_var_offset(fdatasync_blocks), | |
1413 | .help = "Issue fdatasync for writes every given number of blocks", | |
1414 | .def = "0", | |
20eb06bd | 1415 | .interval = 1, |
e8b0e958 JA |
1416 | .category = FIO_OPT_C_FILE, |
1417 | .group = FIO_OPT_G_INVALID, | |
5f9099ea | 1418 | }, |
1ef2b6be JA |
1419 | { |
1420 | .name = "write_barrier", | |
e8b0e958 | 1421 | .lname = "Write barrier", |
1ef2b6be JA |
1422 | .type = FIO_OPT_INT, |
1423 | .off1 = td_var_offset(barrier_blocks), | |
1424 | .help = "Make every Nth write a barrier write", | |
1425 | .def = "0", | |
20eb06bd | 1426 | .interval = 1, |
e8b0e958 JA |
1427 | .category = FIO_OPT_C_IO, |
1428 | .group = FIO_OPT_G_INVALID, | |
1ef2b6be | 1429 | }, |
44f29692 JA |
1430 | #ifdef FIO_HAVE_SYNC_FILE_RANGE |
1431 | { | |
1432 | .name = "sync_file_range", | |
e8b0e958 | 1433 | .lname = "Sync file range", |
44f29692 JA |
1434 | .posval = { |
1435 | { .ival = "wait_before", | |
1436 | .oval = SYNC_FILE_RANGE_WAIT_BEFORE, | |
1437 | .help = "SYNC_FILE_RANGE_WAIT_BEFORE", | |
3843deb3 | 1438 | .or = 1, |
44f29692 JA |
1439 | }, |
1440 | { .ival = "write", | |
1441 | .oval = SYNC_FILE_RANGE_WRITE, | |
1442 | .help = "SYNC_FILE_RANGE_WRITE", | |
3843deb3 | 1443 | .or = 1, |
44f29692 JA |
1444 | }, |
1445 | { | |
1446 | .ival = "wait_after", | |
1447 | .oval = SYNC_FILE_RANGE_WAIT_AFTER, | |
1448 | .help = "SYNC_FILE_RANGE_WAIT_AFTER", | |
3843deb3 | 1449 | .or = 1, |
44f29692 JA |
1450 | }, |
1451 | }, | |
3843deb3 | 1452 | .type = FIO_OPT_STR_MULTI, |
44f29692 JA |
1453 | .cb = str_sfr_cb, |
1454 | .off1 = td_var_offset(sync_file_range), | |
1455 | .help = "Use sync_file_range()", | |
e8b0e958 JA |
1456 | .category = FIO_OPT_C_FILE, |
1457 | .group = FIO_OPT_G_INVALID, | |
44f29692 JA |
1458 | }, |
1459 | #endif | |
214e1eca JA |
1460 | { |
1461 | .name = "direct", | |
e8b0e958 | 1462 | .lname = "Direct I/O", |
214e1eca JA |
1463 | .type = FIO_OPT_BOOL, |
1464 | .off1 = td_var_offset(odirect), | |
1465 | .help = "Use O_DIRECT IO (negates buffered)", | |
1466 | .def = "0", | |
a01a1bc5 | 1467 | .inverse = "buffered", |
e8b0e958 | 1468 | .category = FIO_OPT_C_IO, |
3ceb458f | 1469 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
1470 | }, |
1471 | { | |
1472 | .name = "buffered", | |
e8b0e958 | 1473 | .lname = "Buffered I/O", |
214e1eca JA |
1474 | .type = FIO_OPT_BOOL, |
1475 | .off1 = td_var_offset(odirect), | |
1476 | .neg = 1, | |
1477 | .help = "Use buffered IO (negates direct)", | |
1478 | .def = "1", | |
a01a1bc5 | 1479 | .inverse = "direct", |
e8b0e958 | 1480 | .category = FIO_OPT_C_IO, |
3ceb458f | 1481 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
1482 | }, |
1483 | { | |
1484 | .name = "overwrite", | |
e8b0e958 | 1485 | .lname = "Overwrite", |
214e1eca JA |
1486 | .type = FIO_OPT_BOOL, |
1487 | .off1 = td_var_offset(overwrite), | |
1488 | .help = "When writing, set whether to overwrite current data", | |
1489 | .def = "0", | |
e8b0e958 JA |
1490 | .category = FIO_OPT_C_FILE, |
1491 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1492 | }, |
1493 | { | |
1494 | .name = "loops", | |
e8b0e958 | 1495 | .lname = "Loops", |
214e1eca JA |
1496 | .type = FIO_OPT_INT, |
1497 | .off1 = td_var_offset(loops), | |
1498 | .help = "Number of times to run the job", | |
1499 | .def = "1", | |
20eb06bd | 1500 | .interval = 1, |
e8b0e958 | 1501 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 1502 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
1503 | }, |
1504 | { | |
1505 | .name = "numjobs", | |
e8b0e958 | 1506 | .lname = "Number of jobs", |
214e1eca JA |
1507 | .type = FIO_OPT_INT, |
1508 | .off1 = td_var_offset(numjobs), | |
1509 | .help = "Duplicate this job this many times", | |
1510 | .def = "1", | |
20eb06bd | 1511 | .interval = 1, |
e8b0e958 | 1512 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 1513 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
1514 | }, |
1515 | { | |
1516 | .name = "startdelay", | |
e8b0e958 | 1517 | .lname = "Start delay", |
a5737c93 | 1518 | .type = FIO_OPT_STR_VAL_TIME, |
214e1eca JA |
1519 | .off1 = td_var_offset(start_delay), |
1520 | .help = "Only start job when this period has passed", | |
1521 | .def = "0", | |
e8b0e958 | 1522 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 1523 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
1524 | }, |
1525 | { | |
1526 | .name = "runtime", | |
e8b0e958 | 1527 | .lname = "Runtime", |
214e1eca JA |
1528 | .alias = "timeout", |
1529 | .type = FIO_OPT_STR_VAL_TIME, | |
1530 | .off1 = td_var_offset(timeout), | |
1531 | .help = "Stop workload when this amount of time has passed", | |
1532 | .def = "0", | |
e8b0e958 | 1533 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 1534 | .group = FIO_OPT_G_RUNTIME, |
214e1eca | 1535 | }, |
cf4464ca JA |
1536 | { |
1537 | .name = "time_based", | |
e8b0e958 | 1538 | .lname = "Time based", |
cf4464ca JA |
1539 | .type = FIO_OPT_STR_SET, |
1540 | .off1 = td_var_offset(time_based), | |
1541 | .help = "Keep running until runtime/timeout is met", | |
e8b0e958 | 1542 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 1543 | .group = FIO_OPT_G_RUNTIME, |
cf4464ca | 1544 | }, |
721938ae JA |
1545 | { |
1546 | .name = "ramp_time", | |
e8b0e958 | 1547 | .lname = "Ramp time", |
721938ae JA |
1548 | .type = FIO_OPT_STR_VAL_TIME, |
1549 | .off1 = td_var_offset(ramp_time), | |
1550 | .help = "Ramp up time before measuring performance", | |
e8b0e958 | 1551 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 1552 | .group = FIO_OPT_G_RUNTIME, |
721938ae | 1553 | }, |
c223da83 JA |
1554 | { |
1555 | .name = "clocksource", | |
e8b0e958 | 1556 | .lname = "Clock source", |
c223da83 JA |
1557 | .type = FIO_OPT_STR, |
1558 | .cb = fio_clock_source_cb, | |
1559 | .off1 = td_var_offset(clocksource), | |
1560 | .help = "What type of timing source to use", | |
e8b0e958 | 1561 | .category = FIO_OPT_C_GENERAL, |
10860056 | 1562 | .group = FIO_OPT_G_CLOCK, |
c223da83 JA |
1563 | .posval = { |
1564 | { .ival = "gettimeofday", | |
1565 | .oval = CS_GTOD, | |
1566 | .help = "Use gettimeofday(2) for timing", | |
1567 | }, | |
1568 | { .ival = "clock_gettime", | |
1569 | .oval = CS_CGETTIME, | |
1570 | .help = "Use clock_gettime(2) for timing", | |
1571 | }, | |
1572 | #ifdef ARCH_HAVE_CPU_CLOCK | |
1573 | { .ival = "cpu", | |
1574 | .oval = CS_CPUCLOCK, | |
1575 | .help = "Use CPU private clock", | |
1576 | }, | |
1577 | #endif | |
1578 | }, | |
1579 | }, | |
214e1eca JA |
1580 | { |
1581 | .name = "mem", | |
d3aad8f2 | 1582 | .alias = "iomem", |
e8b0e958 | 1583 | .lname = "I/O Memory", |
214e1eca JA |
1584 | .type = FIO_OPT_STR, |
1585 | .cb = str_mem_cb, | |
1586 | .off1 = td_var_offset(mem_type), | |
1587 | .help = "Backing type for IO buffers", | |
1588 | .def = "malloc", | |
e8b0e958 JA |
1589 | .category = FIO_OPT_C_IO, |
1590 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1591 | .posval = { |
1592 | { .ival = "malloc", | |
1593 | .oval = MEM_MALLOC, | |
1594 | .help = "Use malloc(3) for IO buffers", | |
1595 | }, | |
37c8cdfe JA |
1596 | { .ival = "shm", |
1597 | .oval = MEM_SHM, | |
1598 | .help = "Use shared memory segments for IO buffers", | |
1599 | }, | |
214e1eca JA |
1600 | #ifdef FIO_HAVE_HUGETLB |
1601 | { .ival = "shmhuge", | |
1602 | .oval = MEM_SHMHUGE, | |
1603 | .help = "Like shm, but use huge pages", | |
1604 | }, | |
b370e46a | 1605 | #endif |
37c8cdfe JA |
1606 | { .ival = "mmap", |
1607 | .oval = MEM_MMAP, | |
1608 | .help = "Use mmap(2) (file or anon) for IO buffers", | |
1609 | }, | |
214e1eca JA |
1610 | #ifdef FIO_HAVE_HUGETLB |
1611 | { .ival = "mmaphuge", | |
1612 | .oval = MEM_MMAPHUGE, | |
1613 | .help = "Like mmap, but use huge pages", | |
1614 | }, | |
1615 | #endif | |
1616 | }, | |
1617 | }, | |
d529ee19 JA |
1618 | { |
1619 | .name = "iomem_align", | |
1620 | .alias = "mem_align", | |
e8b0e958 | 1621 | .lname = "I/O memory alignment", |
d529ee19 JA |
1622 | .type = FIO_OPT_INT, |
1623 | .off1 = td_var_offset(mem_align), | |
1624 | .minval = 0, | |
1625 | .help = "IO memory buffer offset alignment", | |
1626 | .def = "0", | |
1627 | .parent = "iomem", | |
d71c154c | 1628 | .hide = 1, |
e8b0e958 JA |
1629 | .category = FIO_OPT_C_IO, |
1630 | .group = FIO_OPT_G_INVALID, | |
d529ee19 | 1631 | }, |
214e1eca JA |
1632 | { |
1633 | .name = "verify", | |
e8b0e958 | 1634 | .lname = "Verify", |
214e1eca JA |
1635 | .type = FIO_OPT_STR, |
1636 | .off1 = td_var_offset(verify), | |
1637 | .help = "Verify data written", | |
1638 | .def = "0", | |
e8b0e958 | 1639 | .category = FIO_OPT_C_IO, |
3ceb458f | 1640 | .group = FIO_OPT_G_VERIFY, |
214e1eca JA |
1641 | .posval = { |
1642 | { .ival = "0", | |
1643 | .oval = VERIFY_NONE, | |
1644 | .help = "Don't do IO verification", | |
1645 | }, | |
fcca4b58 JA |
1646 | { .ival = "md5", |
1647 | .oval = VERIFY_MD5, | |
1648 | .help = "Use md5 checksums for verification", | |
1649 | }, | |
d77a7af3 JA |
1650 | { .ival = "crc64", |
1651 | .oval = VERIFY_CRC64, | |
1652 | .help = "Use crc64 checksums for verification", | |
1653 | }, | |
214e1eca JA |
1654 | { .ival = "crc32", |
1655 | .oval = VERIFY_CRC32, | |
1656 | .help = "Use crc32 checksums for verification", | |
1657 | }, | |
af497e6a | 1658 | { .ival = "crc32c-intel", |
e3aaafc4 JA |
1659 | .oval = VERIFY_CRC32C, |
1660 | .help = "Use crc32c checksums for verification (hw assisted, if available)", | |
af497e6a | 1661 | }, |
bac39e0e JA |
1662 | { .ival = "crc32c", |
1663 | .oval = VERIFY_CRC32C, | |
e3aaafc4 | 1664 | .help = "Use crc32c checksums for verification (hw assisted, if available)", |
bac39e0e | 1665 | }, |
969f7ed3 JA |
1666 | { .ival = "crc16", |
1667 | .oval = VERIFY_CRC16, | |
1668 | .help = "Use crc16 checksums for verification", | |
1669 | }, | |
1e154bdb JA |
1670 | { .ival = "crc7", |
1671 | .oval = VERIFY_CRC7, | |
1672 | .help = "Use crc7 checksums for verification", | |
1673 | }, | |
7c353ceb JA |
1674 | { .ival = "sha1", |
1675 | .oval = VERIFY_SHA1, | |
1676 | .help = "Use sha1 checksums for verification", | |
1677 | }, | |
cd14cc10 JA |
1678 | { .ival = "sha256", |
1679 | .oval = VERIFY_SHA256, | |
1680 | .help = "Use sha256 checksums for verification", | |
1681 | }, | |
1682 | { .ival = "sha512", | |
1683 | .oval = VERIFY_SHA512, | |
1684 | .help = "Use sha512 checksums for verification", | |
1685 | }, | |
7437ee87 SL |
1686 | { .ival = "meta", |
1687 | .oval = VERIFY_META, | |
1688 | .help = "Use io information", | |
1689 | }, | |
36690c9b JA |
1690 | { |
1691 | .ival = "null", | |
1692 | .oval = VERIFY_NULL, | |
1693 | .help = "Pretend to verify", | |
1694 | }, | |
214e1eca JA |
1695 | }, |
1696 | }, | |
005c565a JA |
1697 | { |
1698 | .name = "do_verify", | |
e8b0e958 | 1699 | .lname = "Perform verify step", |
68e1f29a | 1700 | .type = FIO_OPT_BOOL, |
005c565a JA |
1701 | .off1 = td_var_offset(do_verify), |
1702 | .help = "Run verification stage after write", | |
1703 | .def = "1", | |
1704 | .parent = "verify", | |
d71c154c | 1705 | .hide = 1, |
e8b0e958 JA |
1706 | .category = FIO_OPT_C_IO, |
1707 | .group = FIO_OPT_G_VERIFY, | |
005c565a | 1708 | }, |
160b966d JA |
1709 | { |
1710 | .name = "verifysort", | |
e8b0e958 | 1711 | .lname = "Verify sort", |
160b966d JA |
1712 | .type = FIO_OPT_BOOL, |
1713 | .off1 = td_var_offset(verifysort), | |
1714 | .help = "Sort written verify blocks for read back", | |
1715 | .def = "1", | |
c83f2df1 | 1716 | .parent = "verify", |
d71c154c | 1717 | .hide = 1, |
e8b0e958 JA |
1718 | .category = FIO_OPT_C_IO, |
1719 | .group = FIO_OPT_G_VERIFY, | |
160b966d | 1720 | }, |
3f9f4e26 | 1721 | { |
a59e170d | 1722 | .name = "verify_interval", |
e8b0e958 | 1723 | .lname = "Verify interval", |
e01b22b8 | 1724 | .type = FIO_OPT_INT, |
a59e170d | 1725 | .off1 = td_var_offset(verify_interval), |
819a9680 | 1726 | .minval = 2 * sizeof(struct verify_header), |
a59e170d | 1727 | .help = "Store verify buffer header every N bytes", |
afdf9352 | 1728 | .parent = "verify", |
d71c154c | 1729 | .hide = 1, |
20eb06bd | 1730 | .interval = 2 * sizeof(struct verify_header), |
e8b0e958 JA |
1731 | .category = FIO_OPT_C_IO, |
1732 | .group = FIO_OPT_G_VERIFY, | |
3f9f4e26 | 1733 | }, |
546a9142 | 1734 | { |
a59e170d | 1735 | .name = "verify_offset", |
e8b0e958 | 1736 | .lname = "Verify offset", |
e01b22b8 | 1737 | .type = FIO_OPT_INT, |
a59e170d | 1738 | .help = "Offset verify header location by N bytes", |
203160d5 JA |
1739 | .off1 = td_var_offset(verify_offset), |
1740 | .minval = sizeof(struct verify_header), | |
afdf9352 | 1741 | .parent = "verify", |
d71c154c | 1742 | .hide = 1, |
e8b0e958 JA |
1743 | .category = FIO_OPT_C_IO, |
1744 | .group = FIO_OPT_G_VERIFY, | |
546a9142 | 1745 | }, |
e28218f3 SL |
1746 | { |
1747 | .name = "verify_pattern", | |
e8b0e958 | 1748 | .lname = "Verify pattern", |
0e92f873 | 1749 | .type = FIO_OPT_STR, |
e28218f3 SL |
1750 | .cb = str_verify_pattern_cb, |
1751 | .help = "Fill pattern for IO buffers", | |
1752 | .parent = "verify", | |
d71c154c | 1753 | .hide = 1, |
e8b0e958 JA |
1754 | .category = FIO_OPT_C_IO, |
1755 | .group = FIO_OPT_G_VERIFY, | |
e28218f3 | 1756 | }, |
a12a3b4d JA |
1757 | { |
1758 | .name = "verify_fatal", | |
e8b0e958 | 1759 | .lname = "Verify fatal", |
68e1f29a | 1760 | .type = FIO_OPT_BOOL, |
a12a3b4d JA |
1761 | .off1 = td_var_offset(verify_fatal), |
1762 | .def = "0", | |
1763 | .help = "Exit on a single verify failure, don't continue", | |
1764 | .parent = "verify", | |
d71c154c | 1765 | .hide = 1, |
e8b0e958 JA |
1766 | .category = FIO_OPT_C_IO, |
1767 | .group = FIO_OPT_G_VERIFY, | |
a12a3b4d | 1768 | }, |
b463e936 JA |
1769 | { |
1770 | .name = "verify_dump", | |
e8b0e958 | 1771 | .lname = "Verify dump", |
b463e936 JA |
1772 | .type = FIO_OPT_BOOL, |
1773 | .off1 = td_var_offset(verify_dump), | |
ef71e317 | 1774 | .def = "0", |
b463e936 JA |
1775 | .help = "Dump contents of good and bad blocks on failure", |
1776 | .parent = "verify", | |
d71c154c | 1777 | .hide = 1, |
e8b0e958 JA |
1778 | .category = FIO_OPT_C_IO, |
1779 | .group = FIO_OPT_G_VERIFY, | |
b463e936 | 1780 | }, |
e8462bd8 JA |
1781 | { |
1782 | .name = "verify_async", | |
e8b0e958 | 1783 | .lname = "Verify asynchronously", |
e8462bd8 JA |
1784 | .type = FIO_OPT_INT, |
1785 | .off1 = td_var_offset(verify_async), | |
1786 | .def = "0", | |
1787 | .help = "Number of async verifier threads to use", | |
1788 | .parent = "verify", | |
d71c154c | 1789 | .hide = 1, |
e8b0e958 JA |
1790 | .category = FIO_OPT_C_IO, |
1791 | .group = FIO_OPT_G_VERIFY, | |
e8462bd8 | 1792 | }, |
9e144189 JA |
1793 | { |
1794 | .name = "verify_backlog", | |
e8b0e958 | 1795 | .lname = "Verify backlog", |
9e144189 JA |
1796 | .type = FIO_OPT_STR_VAL, |
1797 | .off1 = td_var_offset(verify_backlog), | |
1798 | .help = "Verify after this number of blocks are written", | |
1799 | .parent = "verify", | |
d71c154c | 1800 | .hide = 1, |
e8b0e958 JA |
1801 | .category = FIO_OPT_C_IO, |
1802 | .group = FIO_OPT_G_VERIFY, | |
9e144189 JA |
1803 | }, |
1804 | { | |
1805 | .name = "verify_backlog_batch", | |
e8b0e958 | 1806 | .lname = "Verify backlog batch", |
9e144189 JA |
1807 | .type = FIO_OPT_INT, |
1808 | .off1 = td_var_offset(verify_batch), | |
1809 | .help = "Verify this number of IO blocks", | |
0d29de83 | 1810 | .parent = "verify", |
d71c154c | 1811 | .hide = 1, |
e8b0e958 JA |
1812 | .category = FIO_OPT_C_IO, |
1813 | .group = FIO_OPT_G_VERIFY, | |
9e144189 | 1814 | }, |
e8462bd8 JA |
1815 | #ifdef FIO_HAVE_CPU_AFFINITY |
1816 | { | |
1817 | .name = "verify_async_cpus", | |
e8b0e958 | 1818 | .lname = "Async verify CPUs", |
e8462bd8 JA |
1819 | .type = FIO_OPT_STR, |
1820 | .cb = str_verify_cpus_allowed_cb, | |
1821 | .help = "Set CPUs allowed for async verify threads", | |
1822 | .parent = "verify_async", | |
d71c154c | 1823 | .hide = 1, |
e8b0e958 JA |
1824 | .category = FIO_OPT_C_IO, |
1825 | .group = FIO_OPT_G_VERIFY, | |
e8462bd8 | 1826 | }, |
0d29de83 JA |
1827 | #endif |
1828 | #ifdef FIO_HAVE_TRIM | |
1829 | { | |
1830 | .name = "trim_percentage", | |
e8b0e958 | 1831 | .lname = "Trim percentage", |
0d29de83 | 1832 | .type = FIO_OPT_INT, |
203160d5 | 1833 | .off1 = td_var_offset(trim_percentage), |
20eb06bd | 1834 | .minval = 0, |
0d29de83 JA |
1835 | .maxval = 100, |
1836 | .help = "Number of verify blocks to discard/trim", | |
1837 | .parent = "verify", | |
1838 | .def = "0", | |
20eb06bd | 1839 | .interval = 1, |
d71c154c | 1840 | .hide = 1, |
e8b0e958 JA |
1841 | .category = FIO_OPT_C_IO, |
1842 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
1843 | }, |
1844 | { | |
1845 | .name = "trim_verify_zero", | |
e8b0e958 | 1846 | .lname = "Verify trim zero", |
20eb06bd | 1847 | .type = FIO_OPT_BOOL, |
0d29de83 JA |
1848 | .help = "Verify that trim/discarded blocks are returned as zeroes", |
1849 | .off1 = td_var_offset(trim_zero), | |
1850 | .parent = "trim_percentage", | |
d71c154c | 1851 | .hide = 1, |
0d29de83 | 1852 | .def = "1", |
e8b0e958 JA |
1853 | .category = FIO_OPT_C_IO, |
1854 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
1855 | }, |
1856 | { | |
1857 | .name = "trim_backlog", | |
e8b0e958 | 1858 | .lname = "Trim backlog", |
0d29de83 JA |
1859 | .type = FIO_OPT_STR_VAL, |
1860 | .off1 = td_var_offset(trim_backlog), | |
1861 | .help = "Trim after this number of blocks are written", | |
1862 | .parent = "trim_percentage", | |
d71c154c | 1863 | .hide = 1, |
20eb06bd | 1864 | .interval = 1, |
e8b0e958 JA |
1865 | .category = FIO_OPT_C_IO, |
1866 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
1867 | }, |
1868 | { | |
1869 | .name = "trim_backlog_batch", | |
e8b0e958 | 1870 | .lname = "Trim backlog batch", |
0d29de83 JA |
1871 | .type = FIO_OPT_INT, |
1872 | .off1 = td_var_offset(trim_batch), | |
1873 | .help = "Trim this number of IO blocks", | |
1874 | .parent = "trim_percentage", | |
d71c154c | 1875 | .hide = 1, |
20eb06bd | 1876 | .interval = 1, |
e8b0e958 JA |
1877 | .category = FIO_OPT_C_IO, |
1878 | .group = FIO_OPT_G_TRIM, | |
0d29de83 | 1879 | }, |
e8462bd8 | 1880 | #endif |
214e1eca JA |
1881 | { |
1882 | .name = "write_iolog", | |
e8b0e958 | 1883 | .lname = "Write I/O log", |
214e1eca JA |
1884 | .type = FIO_OPT_STR_STORE, |
1885 | .off1 = td_var_offset(write_iolog_file), | |
1886 | .help = "Store IO pattern to file", | |
e8b0e958 JA |
1887 | .category = FIO_OPT_C_IO, |
1888 | .group = FIO_OPT_G_IOLOG, | |
214e1eca JA |
1889 | }, |
1890 | { | |
1891 | .name = "read_iolog", | |
e8b0e958 | 1892 | .lname = "Read I/O log", |
214e1eca JA |
1893 | .type = FIO_OPT_STR_STORE, |
1894 | .off1 = td_var_offset(read_iolog_file), | |
1895 | .help = "Playback IO pattern from file", | |
e8b0e958 JA |
1896 | .category = FIO_OPT_C_IO, |
1897 | .group = FIO_OPT_G_IOLOG, | |
214e1eca | 1898 | }, |
64bbb865 DN |
1899 | { |
1900 | .name = "replay_no_stall", | |
e8b0e958 | 1901 | .lname = "Don't stall on replay", |
20eb06bd | 1902 | .type = FIO_OPT_BOOL, |
64bbb865 DN |
1903 | .off1 = td_var_offset(no_stall), |
1904 | .def = "0", | |
87e7a972 | 1905 | .parent = "read_iolog", |
d71c154c | 1906 | .hide = 1, |
64bbb865 | 1907 | .help = "Playback IO pattern file as fast as possible without stalls", |
e8b0e958 JA |
1908 | .category = FIO_OPT_C_IO, |
1909 | .group = FIO_OPT_G_IOLOG, | |
64bbb865 | 1910 | }, |
d1c46c04 DN |
1911 | { |
1912 | .name = "replay_redirect", | |
e8b0e958 | 1913 | .lname = "Redirect device for replay", |
d1c46c04 DN |
1914 | .type = FIO_OPT_STR_STORE, |
1915 | .off1 = td_var_offset(replay_redirect), | |
1916 | .parent = "read_iolog", | |
d71c154c | 1917 | .hide = 1, |
d1c46c04 | 1918 | .help = "Replay all I/O onto this device, regardless of trace device", |
e8b0e958 JA |
1919 | .category = FIO_OPT_C_IO, |
1920 | .group = FIO_OPT_G_IOLOG, | |
d1c46c04 | 1921 | }, |
214e1eca JA |
1922 | { |
1923 | .name = "exec_prerun", | |
e8b0e958 | 1924 | .lname = "Pre-execute runnable", |
214e1eca JA |
1925 | .type = FIO_OPT_STR_STORE, |
1926 | .off1 = td_var_offset(exec_prerun), | |
1927 | .help = "Execute this file prior to running job", | |
e8b0e958 JA |
1928 | .category = FIO_OPT_C_GENERAL, |
1929 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1930 | }, |
1931 | { | |
1932 | .name = "exec_postrun", | |
e8b0e958 | 1933 | .lname = "Post-execute runnable", |
214e1eca JA |
1934 | .type = FIO_OPT_STR_STORE, |
1935 | .off1 = td_var_offset(exec_postrun), | |
1936 | .help = "Execute this file after running job", | |
e8b0e958 JA |
1937 | .category = FIO_OPT_C_GENERAL, |
1938 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1939 | }, |
1940 | #ifdef FIO_HAVE_IOSCHED_SWITCH | |
1941 | { | |
1942 | .name = "ioscheduler", | |
e8b0e958 | 1943 | .lname = "I/O scheduler", |
214e1eca JA |
1944 | .type = FIO_OPT_STR_STORE, |
1945 | .off1 = td_var_offset(ioscheduler), | |
1946 | .help = "Use this IO scheduler on the backing device", | |
e8b0e958 JA |
1947 | .category = FIO_OPT_C_FILE, |
1948 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1949 | }, |
1950 | #endif | |
1951 | { | |
1952 | .name = "zonesize", | |
e8b0e958 | 1953 | .lname = "Zone size", |
214e1eca JA |
1954 | .type = FIO_OPT_STR_VAL, |
1955 | .off1 = td_var_offset(zone_size), | |
ed335855 SN |
1956 | .help = "Amount of data to read per zone", |
1957 | .def = "0", | |
20eb06bd | 1958 | .interval = 1024 * 1024, |
e8b0e958 JA |
1959 | .category = FIO_OPT_C_IO, |
1960 | .group = FIO_OPT_G_ZONE, | |
ed335855 SN |
1961 | }, |
1962 | { | |
1963 | .name = "zonerange", | |
e8b0e958 | 1964 | .lname = "Zone range", |
ed335855 SN |
1965 | .type = FIO_OPT_STR_VAL, |
1966 | .off1 = td_var_offset(zone_range), | |
214e1eca JA |
1967 | .help = "Give size of an IO zone", |
1968 | .def = "0", | |
20eb06bd | 1969 | .interval = 1024 * 1024, |
e8b0e958 JA |
1970 | .category = FIO_OPT_C_IO, |
1971 | .group = FIO_OPT_G_ZONE, | |
214e1eca JA |
1972 | }, |
1973 | { | |
1974 | .name = "zoneskip", | |
e8b0e958 | 1975 | .lname = "Zone skip", |
214e1eca JA |
1976 | .type = FIO_OPT_STR_VAL, |
1977 | .off1 = td_var_offset(zone_skip), | |
1978 | .help = "Space between IO zones", | |
1979 | .def = "0", | |
20eb06bd | 1980 | .interval = 1024 * 1024, |
e8b0e958 JA |
1981 | .category = FIO_OPT_C_IO, |
1982 | .group = FIO_OPT_G_ZONE, | |
214e1eca JA |
1983 | }, |
1984 | { | |
1985 | .name = "lockmem", | |
e8b0e958 | 1986 | .lname = "Lock memory", |
214e1eca | 1987 | .type = FIO_OPT_STR_VAL, |
1b79a070 | 1988 | .off1 = td_var_offset(lockmem), |
214e1eca JA |
1989 | .help = "Lock down this amount of memory", |
1990 | .def = "0", | |
20eb06bd | 1991 | .interval = 1024 * 1024, |
e8b0e958 JA |
1992 | .category = FIO_OPT_C_GENERAL, |
1993 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1994 | }, |
214e1eca JA |
1995 | { |
1996 | .name = "rwmixread", | |
e8b0e958 | 1997 | .lname = "Read/write mix read", |
214e1eca | 1998 | .type = FIO_OPT_INT, |
cb499fc4 | 1999 | .cb = str_rwmix_read_cb, |
214e1eca JA |
2000 | .maxval = 100, |
2001 | .help = "Percentage of mixed workload that is reads", | |
2002 | .def = "50", | |
20eb06bd | 2003 | .interval = 5, |
90265353 | 2004 | .inverse = "rwmixwrite", |
e8b0e958 JA |
2005 | .category = FIO_OPT_C_IO, |
2006 | .group = FIO_OPT_G_RWMIX, | |
214e1eca JA |
2007 | }, |
2008 | { | |
2009 | .name = "rwmixwrite", | |
e8b0e958 | 2010 | .lname = "Read/write mix write", |
214e1eca | 2011 | .type = FIO_OPT_INT, |
cb499fc4 | 2012 | .cb = str_rwmix_write_cb, |
214e1eca JA |
2013 | .maxval = 100, |
2014 | .help = "Percentage of mixed workload that is writes", | |
2015 | .def = "50", | |
20eb06bd | 2016 | .interval = 5, |
90265353 | 2017 | .inverse = "rwmixread", |
e8b0e958 JA |
2018 | .category = FIO_OPT_C_IO, |
2019 | .group = FIO_OPT_G_RWMIX, | |
214e1eca | 2020 | }, |
afdf9352 JA |
2021 | { |
2022 | .name = "rwmixcycle", | |
e8b0e958 | 2023 | .lname = "Read/write mix cycle", |
15ca150e | 2024 | .type = FIO_OPT_DEPRECATED, |
e8b0e958 JA |
2025 | .category = FIO_OPT_C_IO, |
2026 | .group = FIO_OPT_G_RWMIX, | |
afdf9352 | 2027 | }, |
214e1eca JA |
2028 | { |
2029 | .name = "nice", | |
e8b0e958 | 2030 | .lname = "Nice", |
214e1eca JA |
2031 | .type = FIO_OPT_INT, |
2032 | .off1 = td_var_offset(nice), | |
2033 | .help = "Set job CPU nice value", | |
2034 | .minval = -19, | |
2035 | .maxval = 20, | |
2036 | .def = "0", | |
20eb06bd | 2037 | .interval = 1, |
e8b0e958 | 2038 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2039 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
2040 | }, |
2041 | #ifdef FIO_HAVE_IOPRIO | |
2042 | { | |
2043 | .name = "prio", | |
e8b0e958 | 2044 | .lname = "I/O nice priority", |
214e1eca | 2045 | .type = FIO_OPT_INT, |
28727df7 | 2046 | .off1 = td_var_offset(ioprio), |
214e1eca JA |
2047 | .help = "Set job IO priority value", |
2048 | .minval = 0, | |
2049 | .maxval = 7, | |
20eb06bd | 2050 | .interval = 1, |
e8b0e958 | 2051 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2052 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
2053 | }, |
2054 | { | |
2055 | .name = "prioclass", | |
e8b0e958 | 2056 | .lname = "I/O nice priority class", |
214e1eca | 2057 | .type = FIO_OPT_INT, |
28727df7 | 2058 | .off1 = td_var_offset(ioprio_class), |
214e1eca JA |
2059 | .help = "Set job IO priority class", |
2060 | .minval = 0, | |
2061 | .maxval = 3, | |
20eb06bd | 2062 | .interval = 1, |
e8b0e958 | 2063 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2064 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
2065 | }, |
2066 | #endif | |
2067 | { | |
2068 | .name = "thinktime", | |
e8b0e958 | 2069 | .lname = "Thinktime", |
214e1eca JA |
2070 | .type = FIO_OPT_INT, |
2071 | .off1 = td_var_offset(thinktime), | |
2072 | .help = "Idle time between IO buffers (usec)", | |
2073 | .def = "0", | |
e8b0e958 | 2074 | .category = FIO_OPT_C_IO, |
3ceb458f | 2075 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
2076 | }, |
2077 | { | |
2078 | .name = "thinktime_spin", | |
e8b0e958 | 2079 | .lname = "Thinktime spin", |
214e1eca JA |
2080 | .type = FIO_OPT_INT, |
2081 | .off1 = td_var_offset(thinktime_spin), | |
2082 | .help = "Start think time by spinning this amount (usec)", | |
2083 | .def = "0", | |
afdf9352 | 2084 | .parent = "thinktime", |
d71c154c | 2085 | .hide = 1, |
e8b0e958 | 2086 | .category = FIO_OPT_C_IO, |
3ceb458f | 2087 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
2088 | }, |
2089 | { | |
2090 | .name = "thinktime_blocks", | |
e8b0e958 | 2091 | .lname = "Thinktime blocks", |
214e1eca JA |
2092 | .type = FIO_OPT_INT, |
2093 | .off1 = td_var_offset(thinktime_blocks), | |
2094 | .help = "IO buffer period between 'thinktime'", | |
2095 | .def = "1", | |
afdf9352 | 2096 | .parent = "thinktime", |
d71c154c | 2097 | .hide = 1, |
e8b0e958 | 2098 | .category = FIO_OPT_C_IO, |
3ceb458f | 2099 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
2100 | }, |
2101 | { | |
2102 | .name = "rate", | |
e8b0e958 | 2103 | .lname = "I/O rate", |
e01b22b8 | 2104 | .type = FIO_OPT_INT, |
581e7141 JA |
2105 | .off1 = td_var_offset(rate[0]), |
2106 | .off2 = td_var_offset(rate[1]), | |
214e1eca | 2107 | .help = "Set bandwidth rate", |
e8b0e958 JA |
2108 | .category = FIO_OPT_C_IO, |
2109 | .group = FIO_OPT_G_RATE, | |
214e1eca JA |
2110 | }, |
2111 | { | |
2112 | .name = "ratemin", | |
e8b0e958 | 2113 | .lname = "I/O min rate", |
e01b22b8 | 2114 | .type = FIO_OPT_INT, |
581e7141 JA |
2115 | .off1 = td_var_offset(ratemin[0]), |
2116 | .off2 = td_var_offset(ratemin[1]), | |
4e991c23 | 2117 | .help = "Job must meet this rate or it will be shutdown", |
afdf9352 | 2118 | .parent = "rate", |
d71c154c | 2119 | .hide = 1, |
e8b0e958 JA |
2120 | .category = FIO_OPT_C_IO, |
2121 | .group = FIO_OPT_G_RATE, | |
4e991c23 JA |
2122 | }, |
2123 | { | |
2124 | .name = "rate_iops", | |
e8b0e958 | 2125 | .lname = "I/O rate IOPS", |
e01b22b8 | 2126 | .type = FIO_OPT_INT, |
581e7141 JA |
2127 | .off1 = td_var_offset(rate_iops[0]), |
2128 | .off2 = td_var_offset(rate_iops[1]), | |
4e991c23 | 2129 | .help = "Limit IO used to this number of IO operations/sec", |
d71c154c | 2130 | .hide = 1, |
e8b0e958 JA |
2131 | .category = FIO_OPT_C_IO, |
2132 | .group = FIO_OPT_G_RATE, | |
4e991c23 JA |
2133 | }, |
2134 | { | |
2135 | .name = "rate_iops_min", | |
e8b0e958 | 2136 | .lname = "I/O min rate IOPS", |
e01b22b8 | 2137 | .type = FIO_OPT_INT, |
581e7141 JA |
2138 | .off1 = td_var_offset(rate_iops_min[0]), |
2139 | .off2 = td_var_offset(rate_iops_min[1]), | |
03e20d68 | 2140 | .help = "Job must meet this rate or it will be shut down", |
afdf9352 | 2141 | .parent = "rate_iops", |
d71c154c | 2142 | .hide = 1, |
e8b0e958 JA |
2143 | .category = FIO_OPT_C_IO, |
2144 | .group = FIO_OPT_G_RATE, | |
214e1eca JA |
2145 | }, |
2146 | { | |
2147 | .name = "ratecycle", | |
e8b0e958 | 2148 | .lname = "I/O rate cycle", |
214e1eca JA |
2149 | .type = FIO_OPT_INT, |
2150 | .off1 = td_var_offset(ratecycle), | |
2151 | .help = "Window average for rate limits (msec)", | |
2152 | .def = "1000", | |
afdf9352 | 2153 | .parent = "rate", |
d71c154c | 2154 | .hide = 1, |
e8b0e958 JA |
2155 | .category = FIO_OPT_C_IO, |
2156 | .group = FIO_OPT_G_RATE, | |
214e1eca JA |
2157 | }, |
2158 | { | |
2159 | .name = "invalidate", | |
e8b0e958 | 2160 | .lname = "Cache invalidate", |
214e1eca JA |
2161 | .type = FIO_OPT_BOOL, |
2162 | .off1 = td_var_offset(invalidate_cache), | |
2163 | .help = "Invalidate buffer/page cache prior to running job", | |
2164 | .def = "1", | |
e8b0e958 | 2165 | .category = FIO_OPT_C_IO, |
3ceb458f | 2166 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
2167 | }, |
2168 | { | |
2169 | .name = "sync", | |
e8b0e958 | 2170 | .lname = "Synchronous I/O", |
214e1eca JA |
2171 | .type = FIO_OPT_BOOL, |
2172 | .off1 = td_var_offset(sync_io), | |
2173 | .help = "Use O_SYNC for buffered writes", | |
2174 | .def = "0", | |
67a1000f | 2175 | .parent = "buffered", |
d71c154c | 2176 | .hide = 1, |
e8b0e958 | 2177 | .category = FIO_OPT_C_IO, |
3ceb458f | 2178 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca | 2179 | }, |
214e1eca JA |
2180 | { |
2181 | .name = "create_serialize", | |
e8b0e958 | 2182 | .lname = "Create serialize", |
214e1eca JA |
2183 | .type = FIO_OPT_BOOL, |
2184 | .off1 = td_var_offset(create_serialize), | |
2185 | .help = "Serialize creating of job files", | |
2186 | .def = "1", | |
e8b0e958 JA |
2187 | .category = FIO_OPT_C_FILE, |
2188 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2189 | }, |
2190 | { | |
2191 | .name = "create_fsync", | |
e8b0e958 | 2192 | .lname = "Create fsync", |
214e1eca JA |
2193 | .type = FIO_OPT_BOOL, |
2194 | .off1 = td_var_offset(create_fsync), | |
03e20d68 | 2195 | .help = "fsync file after creation", |
214e1eca | 2196 | .def = "1", |
e8b0e958 JA |
2197 | .category = FIO_OPT_C_FILE, |
2198 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2199 | }, |
814452bd JA |
2200 | { |
2201 | .name = "create_on_open", | |
e8b0e958 | 2202 | .lname = "Create on open", |
814452bd JA |
2203 | .type = FIO_OPT_BOOL, |
2204 | .off1 = td_var_offset(create_on_open), | |
2205 | .help = "Create files when they are opened for IO", | |
2206 | .def = "0", | |
e8b0e958 JA |
2207 | .category = FIO_OPT_C_FILE, |
2208 | .group = FIO_OPT_G_INVALID, | |
814452bd | 2209 | }, |
0b9d69ec | 2210 | { |
afad68f7 | 2211 | .name = "pre_read", |
e8b0e958 | 2212 | .lname = "Pre-read files", |
afad68f7 ZY |
2213 | .type = FIO_OPT_BOOL, |
2214 | .off1 = td_var_offset(pre_read), | |
03e20d68 | 2215 | .help = "Pre-read files before starting official testing", |
afad68f7 | 2216 | .def = "0", |
e8b0e958 JA |
2217 | .category = FIO_OPT_C_FILE, |
2218 | .group = FIO_OPT_G_INVALID, | |
afad68f7 | 2219 | }, |
214e1eca JA |
2220 | #ifdef FIO_HAVE_CPU_AFFINITY |
2221 | { | |
2222 | .name = "cpumask", | |
e8b0e958 | 2223 | .lname = "CPU mask", |
214e1eca JA |
2224 | .type = FIO_OPT_INT, |
2225 | .cb = str_cpumask_cb, | |
2226 | .help = "CPU affinity mask", | |
e8b0e958 | 2227 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2228 | .group = FIO_OPT_G_CRED, |
214e1eca | 2229 | }, |
d2e268b0 JA |
2230 | { |
2231 | .name = "cpus_allowed", | |
e8b0e958 | 2232 | .lname = "CPUs allowed", |
d2e268b0 JA |
2233 | .type = FIO_OPT_STR, |
2234 | .cb = str_cpus_allowed_cb, | |
2235 | .help = "Set CPUs allowed", | |
e8b0e958 | 2236 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2237 | .group = FIO_OPT_G_CRED, |
d2e268b0 | 2238 | }, |
214e1eca JA |
2239 | #endif |
2240 | { | |
2241 | .name = "end_fsync", | |
e8b0e958 | 2242 | .lname = "End fsync", |
214e1eca JA |
2243 | .type = FIO_OPT_BOOL, |
2244 | .off1 = td_var_offset(end_fsync), | |
2245 | .help = "Include fsync at the end of job", | |
2246 | .def = "0", | |
e8b0e958 JA |
2247 | .category = FIO_OPT_C_FILE, |
2248 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2249 | }, |
2250 | { | |
2251 | .name = "fsync_on_close", | |
e8b0e958 | 2252 | .lname = "Fsync on close", |
214e1eca JA |
2253 | .type = FIO_OPT_BOOL, |
2254 | .off1 = td_var_offset(fsync_on_close), | |
2255 | .help = "fsync files on close", | |
2256 | .def = "0", | |
e8b0e958 JA |
2257 | .category = FIO_OPT_C_FILE, |
2258 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2259 | }, |
2260 | { | |
2261 | .name = "unlink", | |
e8b0e958 | 2262 | .lname = "Unlink file", |
214e1eca JA |
2263 | .type = FIO_OPT_BOOL, |
2264 | .off1 = td_var_offset(unlink), | |
2265 | .help = "Unlink created files after job has completed", | |
2266 | .def = "0", | |
e8b0e958 JA |
2267 | .category = FIO_OPT_C_FILE, |
2268 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2269 | }, |
2270 | { | |
2271 | .name = "exitall", | |
e8b0e958 | 2272 | .lname = "Exit-all on terminate", |
214e1eca JA |
2273 | .type = FIO_OPT_STR_SET, |
2274 | .cb = str_exitall_cb, | |
2275 | .help = "Terminate all jobs when one exits", | |
e8b0e958 | 2276 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2277 | .group = FIO_OPT_G_PROCESS, |
214e1eca JA |
2278 | }, |
2279 | { | |
2280 | .name = "stonewall", | |
e8b0e958 | 2281 | .lname = "Wait for previous", |
d392365e | 2282 | .alias = "wait_for_previous", |
214e1eca JA |
2283 | .type = FIO_OPT_STR_SET, |
2284 | .off1 = td_var_offset(stonewall), | |
2285 | .help = "Insert a hard barrier between this job and previous", | |
e8b0e958 | 2286 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2287 | .group = FIO_OPT_G_PROCESS, |
214e1eca | 2288 | }, |
b3d62a75 JA |
2289 | { |
2290 | .name = "new_group", | |
e8b0e958 | 2291 | .lname = "New group", |
b3d62a75 JA |
2292 | .type = FIO_OPT_STR_SET, |
2293 | .off1 = td_var_offset(new_group), | |
2294 | .help = "Mark the start of a new group (for reporting)", | |
e8b0e958 | 2295 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2296 | .group = FIO_OPT_G_PROCESS, |
b3d62a75 | 2297 | }, |
214e1eca JA |
2298 | { |
2299 | .name = "thread", | |
e8b0e958 | 2300 | .lname = "Thread", |
214e1eca JA |
2301 | .type = FIO_OPT_STR_SET, |
2302 | .off1 = td_var_offset(use_thread), | |
20eb06bd | 2303 | .help = "Use threads instead of processes", |
e8b0e958 | 2304 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2305 | .group = FIO_OPT_G_PROCESS, |
214e1eca JA |
2306 | }, |
2307 | { | |
2308 | .name = "write_bw_log", | |
e8b0e958 | 2309 | .lname = "Write bandwidth log", |
203160d5 JA |
2310 | .type = FIO_OPT_STR_STORE, |
2311 | .off1 = td_var_offset(bw_log_file), | |
214e1eca | 2312 | .help = "Write log of bandwidth during run", |
e8b0e958 JA |
2313 | .category = FIO_OPT_C_LOG, |
2314 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2315 | }, |
2316 | { | |
2317 | .name = "write_lat_log", | |
e8b0e958 | 2318 | .lname = "Write latency log", |
203160d5 JA |
2319 | .type = FIO_OPT_STR_STORE, |
2320 | .off1 = td_var_offset(lat_log_file), | |
214e1eca | 2321 | .help = "Write log of latency during run", |
e8b0e958 JA |
2322 | .category = FIO_OPT_C_LOG, |
2323 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2324 | }, |
c8eeb9df JA |
2325 | { |
2326 | .name = "write_iops_log", | |
e8b0e958 | 2327 | .lname = "Write IOPS log", |
c8eeb9df | 2328 | .type = FIO_OPT_STR, |
203160d5 | 2329 | .off1 = td_var_offset(iops_log_file), |
c8eeb9df | 2330 | .help = "Write log of IOPS during run", |
e8b0e958 JA |
2331 | .category = FIO_OPT_C_LOG, |
2332 | .group = FIO_OPT_G_INVALID, | |
c8eeb9df | 2333 | }, |
b8bc8cba JA |
2334 | { |
2335 | .name = "log_avg_msec", | |
e8b0e958 | 2336 | .lname = "Log averaging (msec)", |
b8bc8cba JA |
2337 | .type = FIO_OPT_INT, |
2338 | .off1 = td_var_offset(log_avg_msec), | |
2339 | .help = "Average bw/iops/lat logs over this period of time", | |
2340 | .def = "0", | |
e8b0e958 JA |
2341 | .category = FIO_OPT_C_LOG, |
2342 | .group = FIO_OPT_G_INVALID, | |
b8bc8cba | 2343 | }, |
c504ee55 JA |
2344 | { |
2345 | .name = "bwavgtime", | |
2346 | .lname = "Bandwidth average time", | |
2347 | .type = FIO_OPT_INT, | |
2348 | .off1 = td_var_offset(bw_avg_time), | |
2349 | .help = "Time window over which to calculate bandwidth" | |
2350 | " (msec)", | |
2351 | .def = "500", | |
2352 | .parent = "write_bw_log", | |
2353 | .hide = 1, | |
2354 | .interval = 100, | |
2355 | .category = FIO_OPT_C_LOG, | |
2356 | .group = FIO_OPT_G_INVALID, | |
2357 | }, | |
2358 | { | |
2359 | .name = "iopsavgtime", | |
2360 | .lname = "IOPS average time", | |
2361 | .type = FIO_OPT_INT, | |
2362 | .off1 = td_var_offset(iops_avg_time), | |
2363 | .help = "Time window over which to calculate IOPS (msec)", | |
2364 | .def = "500", | |
2365 | .parent = "write_iops_log", | |
2366 | .hide = 1, | |
2367 | .interval = 100, | |
2368 | .category = FIO_OPT_C_LOG, | |
2369 | .group = FIO_OPT_G_INVALID, | |
2370 | }, | |
214e1eca JA |
2371 | { |
2372 | .name = "group_reporting", | |
e8b0e958 JA |
2373 | .lname = "Group reporting", |
2374 | .type = FIO_OPT_BOOL, | |
214e1eca JA |
2375 | .off1 = td_var_offset(group_reporting), |
2376 | .help = "Do reporting on a per-group basis", | |
e8b0e958 | 2377 | .def = "1", |
10860056 | 2378 | .category = FIO_OPT_C_STAT, |
e8b0e958 | 2379 | .group = FIO_OPT_G_INVALID, |
214e1eca | 2380 | }, |
e9459e5a JA |
2381 | { |
2382 | .name = "zero_buffers", | |
e8b0e958 | 2383 | .lname = "Zero I/O buffers", |
e9459e5a JA |
2384 | .type = FIO_OPT_STR_SET, |
2385 | .off1 = td_var_offset(zero_buffers), | |
2386 | .help = "Init IO buffers to all zeroes", | |
e8b0e958 | 2387 | .category = FIO_OPT_C_IO, |
3ceb458f | 2388 | .group = FIO_OPT_G_IO_BUF, |
e9459e5a | 2389 | }, |
5973cafb JA |
2390 | { |
2391 | .name = "refill_buffers", | |
e8b0e958 | 2392 | .lname = "Refill I/O buffers", |
5973cafb JA |
2393 | .type = FIO_OPT_STR_SET, |
2394 | .off1 = td_var_offset(refill_buffers), | |
2395 | .help = "Refill IO buffers on every IO submit", | |
e8b0e958 | 2396 | .category = FIO_OPT_C_IO, |
3ceb458f | 2397 | .group = FIO_OPT_G_IO_BUF, |
5973cafb | 2398 | }, |
fd68418e JA |
2399 | { |
2400 | .name = "scramble_buffers", | |
e8b0e958 | 2401 | .lname = "Scramble I/O buffers", |
fd68418e JA |
2402 | .type = FIO_OPT_BOOL, |
2403 | .off1 = td_var_offset(scramble_buffers), | |
2404 | .help = "Slightly scramble buffers on every IO submit", | |
2405 | .def = "1", | |
e8b0e958 | 2406 | .category = FIO_OPT_C_IO, |
3ceb458f | 2407 | .group = FIO_OPT_G_IO_BUF, |
fd68418e | 2408 | }, |
9c42684e JA |
2409 | { |
2410 | .name = "buffer_compress_percentage", | |
e8b0e958 | 2411 | .lname = "Buffer compression percentage", |
9c42684e JA |
2412 | .type = FIO_OPT_INT, |
2413 | .off1 = td_var_offset(compress_percentage), | |
2414 | .maxval = 100, | |
2415 | .minval = 1, | |
2416 | .help = "How compressible the buffer is (approximately)", | |
20eb06bd | 2417 | .interval = 5, |
e8b0e958 | 2418 | .category = FIO_OPT_C_IO, |
3ceb458f | 2419 | .group = FIO_OPT_G_IO_BUF, |
9c42684e | 2420 | }, |
f97a43a1 JA |
2421 | { |
2422 | .name = "buffer_compress_chunk", | |
e8b0e958 | 2423 | .lname = "Buffer compression chunk size", |
f97a43a1 JA |
2424 | .type = FIO_OPT_INT, |
2425 | .off1 = td_var_offset(compress_chunk), | |
207b18e4 | 2426 | .parent = "buffer_compress_percentage", |
d71c154c | 2427 | .hide = 1, |
f97a43a1 | 2428 | .help = "Size of compressible region in buffer", |
20eb06bd | 2429 | .interval = 256, |
e8b0e958 | 2430 | .category = FIO_OPT_C_IO, |
3ceb458f | 2431 | .group = FIO_OPT_G_IO_BUF, |
f97a43a1 | 2432 | }, |
83349190 YH |
2433 | { |
2434 | .name = "clat_percentiles", | |
e8b0e958 | 2435 | .lname = "Completion latency percentiles", |
83349190 YH |
2436 | .type = FIO_OPT_BOOL, |
2437 | .off1 = td_var_offset(clat_percentiles), | |
2438 | .help = "Enable the reporting of completion latency percentiles", | |
467b35ed | 2439 | .def = "1", |
e8b0e958 JA |
2440 | .category = FIO_OPT_C_STAT, |
2441 | .group = FIO_OPT_G_INVALID, | |
83349190 YH |
2442 | }, |
2443 | { | |
2444 | .name = "percentile_list", | |
e8b0e958 | 2445 | .lname = "Completion latency percentile list", |
83349190 YH |
2446 | .type = FIO_OPT_FLOAT_LIST, |
2447 | .off1 = td_var_offset(percentile_list), | |
2448 | .off2 = td_var_offset(overwrite_plist), | |
2449 | .help = "Specify a custom list of percentiles to report", | |
2450 | .maxlen = FIO_IO_U_LIST_MAX_LEN, | |
2451 | .minfp = 0.0, | |
2452 | .maxfp = 100.0, | |
e8b0e958 JA |
2453 | .category = FIO_OPT_C_STAT, |
2454 | .group = FIO_OPT_G_INVALID, | |
83349190 YH |
2455 | }, |
2456 | ||
0a839f30 JA |
2457 | #ifdef FIO_HAVE_DISK_UTIL |
2458 | { | |
2459 | .name = "disk_util", | |
e8b0e958 | 2460 | .lname = "Disk utilization", |
0a839f30 JA |
2461 | .type = FIO_OPT_BOOL, |
2462 | .off1 = td_var_offset(do_disk_util), | |
f66ab3c8 | 2463 | .help = "Log disk utilization statistics", |
0a839f30 | 2464 | .def = "1", |
e8b0e958 JA |
2465 | .category = FIO_OPT_C_STAT, |
2466 | .group = FIO_OPT_G_INVALID, | |
0a839f30 JA |
2467 | }, |
2468 | #endif | |
993bf48b JA |
2469 | { |
2470 | .name = "gtod_reduce", | |
e8b0e958 | 2471 | .lname = "Reduce gettimeofday() calls", |
993bf48b JA |
2472 | .type = FIO_OPT_BOOL, |
2473 | .help = "Greatly reduce number of gettimeofday() calls", | |
2474 | .cb = str_gtod_reduce_cb, | |
2475 | .def = "0", | |
a4ed77fe | 2476 | .hide_on_set = 1, |
e8b0e958 JA |
2477 | .category = FIO_OPT_C_STAT, |
2478 | .group = FIO_OPT_G_INVALID, | |
993bf48b | 2479 | }, |
02af0988 JA |
2480 | { |
2481 | .name = "disable_lat", | |
e8b0e958 | 2482 | .lname = "Disable all latency stats", |
02af0988 JA |
2483 | .type = FIO_OPT_BOOL, |
2484 | .off1 = td_var_offset(disable_lat), | |
2485 | .help = "Disable latency numbers", | |
2486 | .parent = "gtod_reduce", | |
d71c154c | 2487 | .hide = 1, |
02af0988 | 2488 | .def = "0", |
e8b0e958 JA |
2489 | .category = FIO_OPT_C_STAT, |
2490 | .group = FIO_OPT_G_INVALID, | |
02af0988 | 2491 | }, |
9520ebb9 JA |
2492 | { |
2493 | .name = "disable_clat", | |
e8b0e958 | 2494 | .lname = "Disable completion latency stats", |
9520ebb9 JA |
2495 | .type = FIO_OPT_BOOL, |
2496 | .off1 = td_var_offset(disable_clat), | |
2497 | .help = "Disable completion latency numbers", | |
993bf48b | 2498 | .parent = "gtod_reduce", |
d71c154c | 2499 | .hide = 1, |
9520ebb9 | 2500 | .def = "0", |
e8b0e958 JA |
2501 | .category = FIO_OPT_C_STAT, |
2502 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 JA |
2503 | }, |
2504 | { | |
2505 | .name = "disable_slat", | |
e8b0e958 | 2506 | .lname = "Disable submission latency stats", |
9520ebb9 JA |
2507 | .type = FIO_OPT_BOOL, |
2508 | .off1 = td_var_offset(disable_slat), | |
03e20d68 | 2509 | .help = "Disable submission latency numbers", |
993bf48b | 2510 | .parent = "gtod_reduce", |
d71c154c | 2511 | .hide = 1, |
9520ebb9 | 2512 | .def = "0", |
e8b0e958 JA |
2513 | .category = FIO_OPT_C_STAT, |
2514 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 JA |
2515 | }, |
2516 | { | |
2517 | .name = "disable_bw_measurement", | |
e8b0e958 | 2518 | .lname = "Disable bandwidth stats", |
9520ebb9 JA |
2519 | .type = FIO_OPT_BOOL, |
2520 | .off1 = td_var_offset(disable_bw), | |
2521 | .help = "Disable bandwidth logging", | |
993bf48b | 2522 | .parent = "gtod_reduce", |
d71c154c | 2523 | .hide = 1, |
9520ebb9 | 2524 | .def = "0", |
e8b0e958 JA |
2525 | .category = FIO_OPT_C_STAT, |
2526 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 | 2527 | }, |
be4ecfdf JA |
2528 | { |
2529 | .name = "gtod_cpu", | |
e8b0e958 | 2530 | .lname = "Dedicated gettimeofday() CPU", |
be4ecfdf JA |
2531 | .type = FIO_OPT_INT, |
2532 | .cb = str_gtod_cpu_cb, | |
03e20d68 | 2533 | .help = "Set up dedicated gettimeofday() thread on this CPU", |
29d43ff9 | 2534 | .verify = gtod_cpu_verify, |
e8b0e958 | 2535 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2536 | .group = FIO_OPT_G_CLOCK, |
be4ecfdf | 2537 | }, |
f2bba182 RR |
2538 | { |
2539 | .name = "continue_on_error", | |
e8b0e958 | 2540 | .lname = "Continue on error", |
06842027 | 2541 | .type = FIO_OPT_STR, |
f2bba182 | 2542 | .off1 = td_var_offset(continue_on_error), |
03e20d68 | 2543 | .help = "Continue on non-fatal errors during IO", |
06842027 | 2544 | .def = "none", |
e8b0e958 JA |
2545 | .category = FIO_OPT_C_GENERAL, |
2546 | .group = FIO_OPT_G_INVALID, | |
06842027 SL |
2547 | .posval = { |
2548 | { .ival = "none", | |
2549 | .oval = ERROR_TYPE_NONE, | |
2550 | .help = "Exit when an error is encountered", | |
2551 | }, | |
2552 | { .ival = "read", | |
2553 | .oval = ERROR_TYPE_READ, | |
2554 | .help = "Continue on read errors only", | |
2555 | }, | |
2556 | { .ival = "write", | |
2557 | .oval = ERROR_TYPE_WRITE, | |
2558 | .help = "Continue on write errors only", | |
2559 | }, | |
2560 | { .ival = "io", | |
2561 | .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE, | |
2562 | .help = "Continue on any IO errors", | |
2563 | }, | |
2564 | { .ival = "verify", | |
2565 | .oval = ERROR_TYPE_VERIFY, | |
2566 | .help = "Continue on verify errors only", | |
2567 | }, | |
2568 | { .ival = "all", | |
2569 | .oval = ERROR_TYPE_ANY, | |
2570 | .help = "Continue on all io and verify errors", | |
2571 | }, | |
2572 | { .ival = "0", | |
2573 | .oval = ERROR_TYPE_NONE, | |
2574 | .help = "Alias for 'none'", | |
2575 | }, | |
2576 | { .ival = "1", | |
2577 | .oval = ERROR_TYPE_ANY, | |
2578 | .help = "Alias for 'all'", | |
2579 | }, | |
2580 | }, | |
f2bba182 | 2581 | }, |
9ac8a797 JA |
2582 | { |
2583 | .name = "profile", | |
e8b0e958 | 2584 | .lname = "Profile", |
79d16311 | 2585 | .type = FIO_OPT_STR_STORE, |
9ac8a797 | 2586 | .off1 = td_var_offset(profile), |
9ac8a797 | 2587 | .help = "Select a specific builtin performance test", |
e8b0e958 JA |
2588 | .category = FIO_OPT_C_GENERAL, |
2589 | .group = FIO_OPT_G_INVALID, | |
9ac8a797 | 2590 | }, |
a696fa2a JA |
2591 | { |
2592 | .name = "cgroup", | |
e8b0e958 | 2593 | .lname = "Cgroup", |
a696fa2a JA |
2594 | .type = FIO_OPT_STR_STORE, |
2595 | .off1 = td_var_offset(cgroup), | |
2596 | .help = "Add job to cgroup of this name", | |
e8b0e958 | 2597 | .category = FIO_OPT_C_GENERAL, |
a1f6afec JA |
2598 | .group = FIO_OPT_G_CGROUP, |
2599 | }, | |
2600 | { | |
2601 | .name = "cgroup_nodelete", | |
2602 | .lname = "Cgroup no-delete", | |
2603 | .type = FIO_OPT_BOOL, | |
2604 | .off1 = td_var_offset(cgroup_nodelete), | |
2605 | .help = "Do not delete cgroups after job completion", | |
2606 | .def = "0", | |
2607 | .parent = "cgroup", | |
2608 | .category = FIO_OPT_C_GENERAL, | |
2609 | .group = FIO_OPT_G_CGROUP, | |
a696fa2a JA |
2610 | }, |
2611 | { | |
2612 | .name = "cgroup_weight", | |
e8b0e958 | 2613 | .lname = "Cgroup weight", |
a696fa2a JA |
2614 | .type = FIO_OPT_INT, |
2615 | .off1 = td_var_offset(cgroup_weight), | |
2616 | .help = "Use given weight for cgroup", | |
2617 | .minval = 100, | |
2618 | .maxval = 1000, | |
a1f6afec | 2619 | .parent = "cgroup", |
e8b0e958 | 2620 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2621 | .group = FIO_OPT_G_CGROUP, |
7de87099 | 2622 | }, |
e0b0d892 JA |
2623 | { |
2624 | .name = "uid", | |
e8b0e958 | 2625 | .lname = "User ID", |
e0b0d892 JA |
2626 | .type = FIO_OPT_INT, |
2627 | .off1 = td_var_offset(uid), | |
2628 | .help = "Run job with this user ID", | |
e8b0e958 | 2629 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2630 | .group = FIO_OPT_G_CRED, |
e0b0d892 JA |
2631 | }, |
2632 | { | |
2633 | .name = "gid", | |
e8b0e958 | 2634 | .lname = "Group ID", |
e0b0d892 JA |
2635 | .type = FIO_OPT_INT, |
2636 | .off1 = td_var_offset(gid), | |
2637 | .help = "Run job with this group ID", | |
e8b0e958 | 2638 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2639 | .group = FIO_OPT_G_CRED, |
e0b0d892 | 2640 | }, |
a1f6afec JA |
2641 | { |
2642 | .name = "kb_base", | |
2643 | .lname = "KB Base", | |
2644 | .type = FIO_OPT_INT, | |
2645 | .off1 = td_var_offset(kb_base), | |
2646 | .verify = kb_base_verify, | |
2647 | .prio = 1, | |
2648 | .def = "1024", | |
2649 | .help = "How many bytes per KB for reporting (1000 or 1024)", | |
2650 | .category = FIO_OPT_C_GENERAL, | |
2651 | .group = FIO_OPT_G_INVALID, | |
2652 | }, | |
3ceb458f JA |
2653 | { |
2654 | .name = "hugepage-size", | |
2655 | .lname = "Hugepage size", | |
2656 | .type = FIO_OPT_INT, | |
2657 | .off1 = td_var_offset(hugepage_size), | |
2658 | .help = "When using hugepages, specify size of each page", | |
2659 | .def = __fio_stringify(FIO_HUGE_PAGE), | |
2660 | .interval = 1024 * 1024, | |
2661 | .category = FIO_OPT_C_GENERAL, | |
2662 | .group = FIO_OPT_G_INVALID, | |
2663 | }, | |
9e684a49 DE |
2664 | { |
2665 | .name = "flow_id", | |
e8b0e958 | 2666 | .lname = "I/O flow ID", |
9e684a49 DE |
2667 | .type = FIO_OPT_INT, |
2668 | .off1 = td_var_offset(flow_id), | |
2669 | .help = "The flow index ID to use", | |
2670 | .def = "0", | |
e8b0e958 JA |
2671 | .category = FIO_OPT_C_IO, |
2672 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
2673 | }, |
2674 | { | |
2675 | .name = "flow", | |
e8b0e958 | 2676 | .lname = "I/O flow weight", |
9e684a49 DE |
2677 | .type = FIO_OPT_INT, |
2678 | .off1 = td_var_offset(flow), | |
2679 | .help = "Weight for flow control of this job", | |
2680 | .parent = "flow_id", | |
d71c154c | 2681 | .hide = 1, |
9e684a49 | 2682 | .def = "0", |
e8b0e958 JA |
2683 | .category = FIO_OPT_C_IO, |
2684 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
2685 | }, |
2686 | { | |
2687 | .name = "flow_watermark", | |
e8b0e958 | 2688 | .lname = "I/O flow watermark", |
9e684a49 DE |
2689 | .type = FIO_OPT_INT, |
2690 | .off1 = td_var_offset(flow_watermark), | |
2691 | .help = "High watermark for flow control. This option" | |
2692 | " should be set to the same value for all threads" | |
2693 | " with non-zero flow.", | |
2694 | .parent = "flow_id", | |
d71c154c | 2695 | .hide = 1, |
9e684a49 | 2696 | .def = "1024", |
e8b0e958 JA |
2697 | .category = FIO_OPT_C_IO, |
2698 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
2699 | }, |
2700 | { | |
2701 | .name = "flow_sleep", | |
e8b0e958 | 2702 | .lname = "I/O flow sleep", |
9e684a49 DE |
2703 | .type = FIO_OPT_INT, |
2704 | .off1 = td_var_offset(flow_sleep), | |
2705 | .help = "How many microseconds to sleep after being held" | |
2706 | " back by the flow control mechanism", | |
2707 | .parent = "flow_id", | |
d71c154c | 2708 | .hide = 1, |
9e684a49 | 2709 | .def = "0", |
e8b0e958 JA |
2710 | .category = FIO_OPT_C_IO, |
2711 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 | 2712 | }, |
214e1eca JA |
2713 | { |
2714 | .name = NULL, | |
2715 | }, | |
2716 | }; | |
2717 | ||
17af15d4 | 2718 | static void add_to_lopt(struct option *lopt, struct fio_option *o, |
de890a1e | 2719 | const char *name, int val) |
9f81736c | 2720 | { |
17af15d4 | 2721 | lopt->name = (char *) name; |
de890a1e | 2722 | lopt->val = val; |
9f81736c JA |
2723 | if (o->type == FIO_OPT_STR_SET) |
2724 | lopt->has_arg = no_argument; | |
2725 | else | |
2726 | lopt->has_arg = required_argument; | |
2727 | } | |
2728 | ||
de890a1e SL |
2729 | static void options_to_lopts(struct fio_option *opts, |
2730 | struct option *long_options, | |
2731 | int i, int option_type) | |
214e1eca | 2732 | { |
de890a1e | 2733 | struct fio_option *o = &opts[0]; |
214e1eca | 2734 | while (o->name) { |
de890a1e | 2735 | add_to_lopt(&long_options[i], o, o->name, option_type); |
17af15d4 JA |
2736 | if (o->alias) { |
2737 | i++; | |
de890a1e | 2738 | add_to_lopt(&long_options[i], o, o->alias, option_type); |
17af15d4 | 2739 | } |
214e1eca JA |
2740 | |
2741 | i++; | |
2742 | o++; | |
2743 | assert(i < FIO_NR_OPTIONS); | |
2744 | } | |
2745 | } | |
2746 | ||
de890a1e SL |
2747 | void fio_options_set_ioengine_opts(struct option *long_options, |
2748 | struct thread_data *td) | |
2749 | { | |
2750 | unsigned int i; | |
2751 | ||
2752 | i = 0; | |
2753 | while (long_options[i].name) { | |
2754 | if (long_options[i].val == FIO_GETOPT_IOENGINE) { | |
2755 | memset(&long_options[i], 0, sizeof(*long_options)); | |
2756 | break; | |
2757 | } | |
2758 | i++; | |
2759 | } | |
2760 | ||
2761 | /* | |
2762 | * Just clear out the prior ioengine options. | |
2763 | */ | |
2764 | if (!td || !td->eo) | |
2765 | return; | |
2766 | ||
2767 | options_to_lopts(td->io_ops->options, long_options, i, | |
2768 | FIO_GETOPT_IOENGINE); | |
2769 | } | |
2770 | ||
2771 | void fio_options_dup_and_init(struct option *long_options) | |
2772 | { | |
2773 | unsigned int i; | |
2774 | ||
9af4a244 | 2775 | options_init(fio_options); |
de890a1e SL |
2776 | |
2777 | i = 0; | |
2778 | while (long_options[i].name) | |
2779 | i++; | |
2780 | ||
9af4a244 | 2781 | options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB); |
de890a1e SL |
2782 | } |
2783 | ||
74929ac2 JA |
2784 | struct fio_keyword { |
2785 | const char *word; | |
2786 | const char *desc; | |
2787 | char *replace; | |
2788 | }; | |
2789 | ||
2790 | static struct fio_keyword fio_keywords[] = { | |
2791 | { | |
2792 | .word = "$pagesize", | |
2793 | .desc = "Page size in the system", | |
2794 | }, | |
2795 | { | |
2796 | .word = "$mb_memory", | |
2797 | .desc = "Megabytes of memory online", | |
2798 | }, | |
2799 | { | |
2800 | .word = "$ncpus", | |
2801 | .desc = "Number of CPUs online in the system", | |
2802 | }, | |
2803 | { | |
2804 | .word = NULL, | |
2805 | }, | |
2806 | }; | |
2807 | ||
2808 | void fio_keywords_init(void) | |
2809 | { | |
3b2e1464 | 2810 | unsigned long long mb_memory; |
74929ac2 JA |
2811 | char buf[128]; |
2812 | long l; | |
2813 | ||
2814 | sprintf(buf, "%lu", page_size); | |
2815 | fio_keywords[0].replace = strdup(buf); | |
2816 | ||
8eb016d3 | 2817 | mb_memory = os_phys_mem() / (1024 * 1024); |
3b2e1464 | 2818 | sprintf(buf, "%llu", mb_memory); |
74929ac2 JA |
2819 | fio_keywords[1].replace = strdup(buf); |
2820 | ||
c00a2289 | 2821 | l = cpus_online(); |
74929ac2 JA |
2822 | sprintf(buf, "%lu", l); |
2823 | fio_keywords[2].replace = strdup(buf); | |
2824 | } | |
2825 | ||
892a6ffc JA |
2826 | #define BC_APP "bc" |
2827 | ||
2828 | static char *bc_calc(char *str) | |
2829 | { | |
d0c814ec | 2830 | char buf[128], *tmp; |
892a6ffc JA |
2831 | FILE *f; |
2832 | int ret; | |
2833 | ||
2834 | /* | |
2835 | * No math, just return string | |
2836 | */ | |
d0c814ec SL |
2837 | if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') && |
2838 | !strchr(str, '/')) || strchr(str, '\'')) | |
892a6ffc JA |
2839 | return str; |
2840 | ||
2841 | /* | |
2842 | * Split option from value, we only need to calculate the value | |
2843 | */ | |
2844 | tmp = strchr(str, '='); | |
2845 | if (!tmp) | |
2846 | return str; | |
2847 | ||
2848 | tmp++; | |
892a6ffc | 2849 | |
d0c814ec SL |
2850 | /* |
2851 | * Prevent buffer overflows; such a case isn't reasonable anyway | |
2852 | */ | |
2853 | if (strlen(str) >= 128 || strlen(tmp) > 100) | |
2854 | return str; | |
892a6ffc JA |
2855 | |
2856 | sprintf(buf, "which %s > /dev/null", BC_APP); | |
2857 | if (system(buf)) { | |
2858 | log_err("fio: bc is needed for performing math\n"); | |
892a6ffc JA |
2859 | return NULL; |
2860 | } | |
2861 | ||
d0c814ec | 2862 | sprintf(buf, "echo '%s' | %s", tmp, BC_APP); |
892a6ffc | 2863 | f = popen(buf, "r"); |
3c3ed070 | 2864 | if (!f) |
892a6ffc | 2865 | return NULL; |
892a6ffc | 2866 | |
d0c814ec | 2867 | ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f); |
3c3ed070 | 2868 | if (ret <= 0) |
892a6ffc | 2869 | return NULL; |
892a6ffc | 2870 | |
892a6ffc | 2871 | pclose(f); |
d0c814ec SL |
2872 | buf[(tmp - str) + ret - 1] = '\0'; |
2873 | memcpy(buf, str, tmp - str); | |
892a6ffc | 2874 | free(str); |
d0c814ec SL |
2875 | return strdup(buf); |
2876 | } | |
2877 | ||
2878 | /* | |
2879 | * Return a copy of the input string with substrings of the form ${VARNAME} | |
2880 | * substituted with the value of the environment variable VARNAME. The | |
2881 | * substitution always occurs, even if VARNAME is empty or the corresponding | |
2882 | * environment variable undefined. | |
2883 | */ | |
2884 | static char *option_dup_subs(const char *opt) | |
2885 | { | |
2886 | char out[OPT_LEN_MAX+1]; | |
2887 | char in[OPT_LEN_MAX+1]; | |
2888 | char *outptr = out; | |
2889 | char *inptr = in; | |
2890 | char *ch1, *ch2, *env; | |
2891 | ssize_t nchr = OPT_LEN_MAX; | |
2892 | size_t envlen; | |
2893 | ||
2894 | if (strlen(opt) + 1 > OPT_LEN_MAX) { | |
2895 | log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX); | |
2896 | return NULL; | |
2897 | } | |
2898 | ||
2899 | in[OPT_LEN_MAX] = '\0'; | |
2900 | strncpy(in, opt, OPT_LEN_MAX); | |
2901 | ||
2902 | while (*inptr && nchr > 0) { | |
2903 | if (inptr[0] == '$' && inptr[1] == '{') { | |
2904 | ch2 = strchr(inptr, '}'); | |
2905 | if (ch2 && inptr+1 < ch2) { | |
2906 | ch1 = inptr+2; | |
2907 | inptr = ch2+1; | |
2908 | *ch2 = '\0'; | |
2909 | ||
2910 | env = getenv(ch1); | |
2911 | if (env) { | |
2912 | envlen = strlen(env); | |
2913 | if (envlen <= nchr) { | |
2914 | memcpy(outptr, env, envlen); | |
2915 | outptr += envlen; | |
2916 | nchr -= envlen; | |
2917 | } | |
2918 | } | |
2919 | ||
2920 | continue; | |
2921 | } | |
2922 | } | |
2923 | ||
2924 | *outptr++ = *inptr++; | |
2925 | --nchr; | |
2926 | } | |
2927 | ||
2928 | *outptr = '\0'; | |
2929 | return strdup(out); | |
892a6ffc JA |
2930 | } |
2931 | ||
74929ac2 JA |
2932 | /* |
2933 | * Look for reserved variable names and replace them with real values | |
2934 | */ | |
2935 | static char *fio_keyword_replace(char *opt) | |
2936 | { | |
2937 | char *s; | |
2938 | int i; | |
d0c814ec | 2939 | int docalc = 0; |
74929ac2 JA |
2940 | |
2941 | for (i = 0; fio_keywords[i].word != NULL; i++) { | |
2942 | struct fio_keyword *kw = &fio_keywords[i]; | |
2943 | ||
2944 | while ((s = strstr(opt, kw->word)) != NULL) { | |
2945 | char *new = malloc(strlen(opt) + 1); | |
2946 | char *o_org = opt; | |
2947 | int olen = s - opt; | |
2948 | int len; | |
2949 | ||
2950 | /* | |
2951 | * Copy part of the string before the keyword and | |
2952 | * sprintf() the replacement after it. | |
2953 | */ | |
2954 | memcpy(new, opt, olen); | |
2955 | len = sprintf(new + olen, "%s", kw->replace); | |
2956 | ||
2957 | /* | |
2958 | * If there's more in the original string, copy that | |
2959 | * in too | |
2960 | */ | |
2961 | opt += strlen(kw->word) + olen; | |
2962 | if (strlen(opt)) | |
2963 | memcpy(new + olen + len, opt, opt - o_org - 1); | |
2964 | ||
2965 | /* | |
2966 | * replace opt and free the old opt | |
2967 | */ | |
2968 | opt = new; | |
d0c814ec | 2969 | free(o_org); |
7a958bd5 | 2970 | |
d0c814ec | 2971 | docalc = 1; |
74929ac2 JA |
2972 | } |
2973 | } | |
2974 | ||
d0c814ec SL |
2975 | /* |
2976 | * Check for potential math and invoke bc, if possible | |
2977 | */ | |
2978 | if (docalc) | |
2979 | opt = bc_calc(opt); | |
2980 | ||
7a958bd5 | 2981 | return opt; |
74929ac2 JA |
2982 | } |
2983 | ||
d0c814ec SL |
2984 | static char **dup_and_sub_options(char **opts, int num_opts) |
2985 | { | |
2986 | int i; | |
2987 | char **opts_copy = malloc(num_opts * sizeof(*opts)); | |
2988 | for (i = 0; i < num_opts; i++) { | |
2989 | opts_copy[i] = option_dup_subs(opts[i]); | |
2990 | if (!opts_copy[i]) | |
2991 | continue; | |
2992 | opts_copy[i] = fio_keyword_replace(opts_copy[i]); | |
2993 | } | |
2994 | return opts_copy; | |
2995 | } | |
2996 | ||
3b8b7135 | 2997 | int fio_options_parse(struct thread_data *td, char **opts, int num_opts) |
214e1eca | 2998 | { |
de890a1e | 2999 | int i, ret, unknown; |
d0c814ec | 3000 | char **opts_copy; |
3b8b7135 | 3001 | |
9af4a244 | 3002 | sort_options(opts, fio_options, num_opts); |
d0c814ec | 3003 | opts_copy = dup_and_sub_options(opts, num_opts); |
3b8b7135 | 3004 | |
de890a1e SL |
3005 | for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) { |
3006 | struct fio_option *o; | |
9af4a244 JA |
3007 | int newret = parse_option(opts_copy[i], opts[i], fio_options, |
3008 | &o, td); | |
d0c814ec | 3009 | |
de890a1e SL |
3010 | if (opts_copy[i]) { |
3011 | if (newret && !o) { | |
3012 | unknown++; | |
3013 | continue; | |
3014 | } | |
d0c814ec | 3015 | free(opts_copy[i]); |
de890a1e SL |
3016 | opts_copy[i] = NULL; |
3017 | } | |
3018 | ||
3019 | ret |= newret; | |
3020 | } | |
3021 | ||
3022 | if (unknown) { | |
3023 | ret |= ioengine_load(td); | |
3024 | if (td->eo) { | |
3025 | sort_options(opts_copy, td->io_ops->options, num_opts); | |
3026 | opts = opts_copy; | |
3027 | } | |
3028 | for (i = 0; i < num_opts; i++) { | |
3029 | struct fio_option *o = NULL; | |
3030 | int newret = 1; | |
3031 | if (!opts_copy[i]) | |
3032 | continue; | |
3033 | ||
3034 | if (td->eo) | |
3035 | newret = parse_option(opts_copy[i], opts[i], | |
3036 | td->io_ops->options, &o, | |
3037 | td->eo); | |
3038 | ||
3039 | ret |= newret; | |
3040 | if (!o) | |
3041 | log_err("Bad option <%s>\n", opts[i]); | |
3042 | ||
3043 | free(opts_copy[i]); | |
3044 | opts_copy[i] = NULL; | |
3045 | } | |
74929ac2 | 3046 | } |
3b8b7135 | 3047 | |
d0c814ec | 3048 | free(opts_copy); |
3b8b7135 | 3049 | return ret; |
214e1eca JA |
3050 | } |
3051 | ||
3052 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) | |
3053 | { | |
9af4a244 | 3054 | return parse_cmd_option(opt, val, fio_options, td); |
214e1eca JA |
3055 | } |
3056 | ||
de890a1e SL |
3057 | int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt, |
3058 | char *val) | |
3059 | { | |
3060 | return parse_cmd_option(opt, val, td->io_ops->options, td); | |
3061 | } | |
3062 | ||
214e1eca JA |
3063 | void fio_fill_default_options(struct thread_data *td) |
3064 | { | |
9af4a244 | 3065 | fill_default_options(td, fio_options); |
214e1eca JA |
3066 | } |
3067 | ||
3068 | int fio_show_option_help(const char *opt) | |
3069 | { | |
9af4a244 | 3070 | return show_cmd_help(fio_options, opt); |
214e1eca | 3071 | } |
d23bb327 | 3072 | |
de890a1e | 3073 | void options_mem_dupe(void *data, struct fio_option *options) |
d23bb327 | 3074 | { |
de890a1e | 3075 | struct fio_option *o; |
d23bb327 | 3076 | char **ptr; |
d23bb327 | 3077 | |
de890a1e SL |
3078 | for (o = &options[0]; o->name; o++) { |
3079 | if (o->type != FIO_OPT_STR_STORE) | |
d23bb327 JA |
3080 | continue; |
3081 | ||
de890a1e | 3082 | ptr = td_var(data, o->off1); |
7e356b2d JA |
3083 | if (*ptr) |
3084 | *ptr = strdup(*ptr); | |
d23bb327 JA |
3085 | } |
3086 | } | |
3087 | ||
de890a1e SL |
3088 | /* |
3089 | * dupe FIO_OPT_STR_STORE options | |
3090 | */ | |
3091 | void fio_options_mem_dupe(struct thread_data *td) | |
3092 | { | |
9af4a244 | 3093 | options_mem_dupe(&td->o, fio_options); |
1647f592 JA |
3094 | |
3095 | if (td->eo && td->io_ops) { | |
de890a1e | 3096 | void *oldeo = td->eo; |
1647f592 | 3097 | |
de890a1e SL |
3098 | td->eo = malloc(td->io_ops->option_struct_size); |
3099 | memcpy(td->eo, oldeo, td->io_ops->option_struct_size); | |
3100 | options_mem_dupe(td->eo, td->io_ops->options); | |
3101 | } | |
3102 | } | |
3103 | ||
d6978a32 JA |
3104 | unsigned int fio_get_kb_base(void *data) |
3105 | { | |
83ea422a | 3106 | struct thread_options *o = data; |
d6978a32 JA |
3107 | unsigned int kb_base = 0; |
3108 | ||
83ea422a JA |
3109 | if (o) |
3110 | kb_base = o->kb_base; | |
d6978a32 JA |
3111 | if (!kb_base) |
3112 | kb_base = 1024; | |
3113 | ||
3114 | return kb_base; | |
3115 | } | |
9f988e2e | 3116 | |
07b3232d | 3117 | int add_option(struct fio_option *o) |
9f988e2e | 3118 | { |
07b3232d JA |
3119 | struct fio_option *__o; |
3120 | int opt_index = 0; | |
3121 | ||
9af4a244 | 3122 | __o = fio_options; |
07b3232d JA |
3123 | while (__o->name) { |
3124 | opt_index++; | |
3125 | __o++; | |
3126 | } | |
3127 | ||
9af4a244 | 3128 | memcpy(&fio_options[opt_index], o, sizeof(*o)); |
07b3232d | 3129 | return 0; |
9f988e2e | 3130 | } |
e2de69da | 3131 | |
07b3232d | 3132 | void invalidate_profile_options(const char *prof_name) |
e2de69da | 3133 | { |
07b3232d | 3134 | struct fio_option *o; |
e2de69da | 3135 | |
9af4a244 | 3136 | o = fio_options; |
07b3232d JA |
3137 | while (o->name) { |
3138 | if (o->prof_name && !strcmp(o->prof_name, prof_name)) { | |
3139 | o->type = FIO_OPT_INVALID; | |
3140 | o->prof_name = NULL; | |
3141 | } | |
3142 | o++; | |
e2de69da JA |
3143 | } |
3144 | } | |
f5b6bb85 JA |
3145 | |
3146 | void add_opt_posval(const char *optname, const char *ival, const char *help) | |
3147 | { | |
3148 | struct fio_option *o; | |
3149 | unsigned int i; | |
3150 | ||
9af4a244 | 3151 | o = find_option(fio_options, optname); |
f5b6bb85 JA |
3152 | if (!o) |
3153 | return; | |
3154 | ||
3155 | for (i = 0; i < PARSE_MAX_VP; i++) { | |
3156 | if (o->posval[i].ival) | |
3157 | continue; | |
3158 | ||
3159 | o->posval[i].ival = ival; | |
3160 | o->posval[i].help = help; | |
3161 | break; | |
3162 | } | |
3163 | } | |
3164 | ||
3165 | void del_opt_posval(const char *optname, const char *ival) | |
3166 | { | |
3167 | struct fio_option *o; | |
3168 | unsigned int i; | |
3169 | ||
9af4a244 | 3170 | o = find_option(fio_options, optname); |
f5b6bb85 JA |
3171 | if (!o) |
3172 | return; | |
3173 | ||
3174 | for (i = 0; i < PARSE_MAX_VP; i++) { | |
3175 | if (!o->posval[i].ival) | |
3176 | continue; | |
3177 | if (strcmp(o->posval[i].ival, ival)) | |
3178 | continue; | |
3179 | ||
3180 | o->posval[i].ival = NULL; | |
3181 | o->posval[i].help = NULL; | |
3182 | } | |
3183 | } | |
7e356b2d JA |
3184 | |
3185 | void fio_options_free(struct thread_data *td) | |
3186 | { | |
9af4a244 | 3187 | options_free(fio_options, td); |
de890a1e SL |
3188 | if (td->eo && td->io_ops && td->io_ops->options) { |
3189 | options_free(td->io_ops->options, td->eo); | |
3190 | free(td->eo); | |
3191 | td->eo = NULL; | |
3192 | } | |
7e356b2d | 3193 | } |
c504ee55 JA |
3194 | |
3195 | struct fio_option *fio_option_find(const char *name) | |
3196 | { | |
3197 | return find_option(fio_options, name); | |
3198 | } | |
3199 |