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 | ||
0de5b26f | 105 | if (str_to_decimal(fname, &val, 1, o, 0)) { |
564ca972 | 106 | log_err("fio: bssplit conversion failed\n"); |
d8b97c8e | 107 | free(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; | |
6eaf09d6 | 168 | char *str, *p, *odir, *ddir; |
720e84ad JA |
169 | int ret = 0; |
170 | ||
52c0cea3 JA |
171 | if (parse_dryrun()) |
172 | return 0; | |
173 | ||
720e84ad JA |
174 | p = str = strdup(input); |
175 | ||
176 | strip_blank_front(&str); | |
177 | strip_blank_end(str); | |
178 | ||
179 | odir = strchr(str, ','); | |
180 | if (odir) { | |
6eaf09d6 SL |
181 | ddir = strchr(odir + 1, ','); |
182 | if (ddir) { | |
d79db122 | 183 | ret = bssplit_ddir(&td->o, DDIR_TRIM, ddir + 1); |
6eaf09d6 SL |
184 | if (!ret) |
185 | *ddir = '\0'; | |
186 | } else { | |
187 | char *op; | |
188 | ||
189 | op = strdup(odir + 1); | |
d79db122 | 190 | ret = bssplit_ddir(&td->o, DDIR_TRIM, op); |
6eaf09d6 SL |
191 | |
192 | free(op); | |
193 | } | |
d79db122 JA |
194 | if (!ret) |
195 | ret = bssplit_ddir(&td->o, DDIR_WRITE, odir + 1); | |
720e84ad JA |
196 | if (!ret) { |
197 | *odir = '\0'; | |
83ea422a | 198 | ret = bssplit_ddir(&td->o, DDIR_READ, str); |
720e84ad JA |
199 | } |
200 | } else { | |
201 | char *op; | |
202 | ||
203 | op = strdup(str); | |
d79db122 | 204 | ret = bssplit_ddir(&td->o, DDIR_WRITE, op); |
6eaf09d6 | 205 | free(op); |
720e84ad | 206 | |
6eaf09d6 SL |
207 | if (!ret) { |
208 | op = strdup(str); | |
d79db122 | 209 | ret = bssplit_ddir(&td->o, DDIR_TRIM, op); |
6eaf09d6 SL |
210 | free(op); |
211 | } | |
83ea422a | 212 | ret = bssplit_ddir(&td->o, DDIR_READ, str); |
720e84ad | 213 | } |
564ca972 JA |
214 | |
215 | free(p); | |
720e84ad | 216 | return ret; |
564ca972 JA |
217 | } |
218 | ||
8b28bd41 DM |
219 | static int str2error(char *str) |
220 | { | |
a94eb99a | 221 | const char *err[] = { "EPERM", "ENOENT", "ESRCH", "EINTR", "EIO", |
8b28bd41 DM |
222 | "ENXIO", "E2BIG", "ENOEXEC", "EBADF", |
223 | "ECHILD", "EAGAIN", "ENOMEM", "EACCES", | |
224 | "EFAULT", "ENOTBLK", "EBUSY", "EEXIST", | |
225 | "EXDEV", "ENODEV", "ENOTDIR", "EISDIR", | |
226 | "EINVAL", "ENFILE", "EMFILE", "ENOTTY", | |
227 | "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE", | |
a94eb99a | 228 | "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE" }; |
8b28bd41 DM |
229 | int i = 0, num = sizeof(err) / sizeof(void *); |
230 | ||
a94eb99a | 231 | while (i < num) { |
8b28bd41 DM |
232 | if (!strcmp(err[i], str)) |
233 | return i + 1; | |
234 | i++; | |
235 | } | |
236 | return 0; | |
237 | } | |
238 | ||
239 | static int ignore_error_type(struct thread_data *td, int etype, char *str) | |
240 | { | |
241 | unsigned int i; | |
242 | int *error; | |
243 | char *fname; | |
244 | ||
245 | if (etype >= ERROR_TYPE_CNT) { | |
246 | log_err("Illegal error type\n"); | |
247 | return 1; | |
248 | } | |
249 | ||
250 | td->o.ignore_error_nr[etype] = 4; | |
251 | error = malloc(4 * sizeof(struct bssplit)); | |
252 | ||
253 | i = 0; | |
254 | while ((fname = strsep(&str, ":")) != NULL) { | |
255 | ||
256 | if (!strlen(fname)) | |
257 | break; | |
258 | ||
259 | /* | |
260 | * grow struct buffer, if needed | |
261 | */ | |
262 | if (i == td->o.ignore_error_nr[etype]) { | |
263 | td->o.ignore_error_nr[etype] <<= 1; | |
264 | error = realloc(error, td->o.ignore_error_nr[etype] | |
265 | * sizeof(int)); | |
266 | } | |
267 | if (fname[0] == 'E') { | |
268 | error[i] = str2error(fname); | |
269 | } else { | |
270 | error[i] = atoi(fname); | |
271 | if (error[i] < 0) | |
272 | error[i] = error[i]; | |
273 | } | |
274 | if (!error[i]) { | |
275 | log_err("Unknown error %s, please use number value \n", | |
276 | fname); | |
0fddbf7a | 277 | free(error); |
8b28bd41 DM |
278 | return 1; |
279 | } | |
280 | i++; | |
281 | } | |
282 | if (i) { | |
283 | td->o.continue_on_error |= 1 << etype; | |
284 | td->o.ignore_error_nr[etype] = i; | |
285 | td->o.ignore_error[etype] = error; | |
286 | } | |
287 | return 0; | |
288 | ||
289 | } | |
290 | ||
291 | static int str_ignore_error_cb(void *data, const char *input) | |
292 | { | |
293 | struct thread_data *td = data; | |
294 | char *str, *p, *n; | |
295 | int type = 0, ret = 1; | |
52c0cea3 JA |
296 | |
297 | if (parse_dryrun()) | |
298 | return 0; | |
299 | ||
8b28bd41 DM |
300 | p = str = strdup(input); |
301 | ||
302 | strip_blank_front(&str); | |
303 | strip_blank_end(str); | |
304 | ||
305 | while (p) { | |
306 | n = strchr(p, ','); | |
307 | if (n) | |
308 | *n++ = '\0'; | |
309 | ret = ignore_error_type(td, type, p); | |
310 | if (ret) | |
311 | break; | |
312 | p = n; | |
313 | type++; | |
314 | } | |
315 | free(str); | |
316 | return ret; | |
317 | } | |
318 | ||
211097b2 JA |
319 | static int str_rw_cb(void *data, const char *str) |
320 | { | |
321 | struct thread_data *td = data; | |
83ea422a | 322 | struct thread_options *o = &td->o; |
211097b2 JA |
323 | char *nr = get_opt_postfix(str); |
324 | ||
52c0cea3 JA |
325 | if (parse_dryrun()) |
326 | return 0; | |
327 | ||
83ea422a JA |
328 | o->ddir_seq_nr = 1; |
329 | o->ddir_seq_add = 0; | |
059b0802 JA |
330 | |
331 | if (!nr) | |
332 | return 0; | |
333 | ||
334 | if (td_random(td)) | |
83ea422a | 335 | o->ddir_seq_nr = atoi(nr); |
059b0802 JA |
336 | else { |
337 | long long val; | |
338 | ||
0de5b26f | 339 | if (str_to_decimal(nr, &val, 1, o, 0)) { |
059b0802 JA |
340 | log_err("fio: rw postfix parsing failed\n"); |
341 | free(nr); | |
342 | return 1; | |
343 | } | |
344 | ||
83ea422a | 345 | o->ddir_seq_add = val; |
182ec6ee | 346 | } |
211097b2 | 347 | |
059b0802 | 348 | free(nr); |
211097b2 JA |
349 | return 0; |
350 | } | |
351 | ||
214e1eca JA |
352 | static int str_mem_cb(void *data, const char *mem) |
353 | { | |
354 | struct thread_data *td = data; | |
355 | ||
d9759b1e | 356 | if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) |
836fcc0f | 357 | td->o.mmapfile = get_opt_postfix(mem); |
214e1eca JA |
358 | |
359 | return 0; | |
360 | } | |
361 | ||
c223da83 JA |
362 | static int fio_clock_source_cb(void *data, const char *str) |
363 | { | |
364 | struct thread_data *td = data; | |
365 | ||
366 | fio_clock_source = td->o.clocksource; | |
fa80feae | 367 | fio_clock_source_set = 1; |
01423eae | 368 | fio_clock_init(); |
c223da83 JA |
369 | return 0; |
370 | } | |
371 | ||
85bc833b | 372 | static int str_rwmix_read_cb(void *data, unsigned long long *val) |
cb499fc4 JA |
373 | { |
374 | struct thread_data *td = data; | |
375 | ||
376 | td->o.rwmix[DDIR_READ] = *val; | |
377 | td->o.rwmix[DDIR_WRITE] = 100 - *val; | |
378 | return 0; | |
379 | } | |
380 | ||
85bc833b | 381 | static int str_rwmix_write_cb(void *data, unsigned long long *val) |
cb499fc4 JA |
382 | { |
383 | struct thread_data *td = data; | |
384 | ||
385 | td->o.rwmix[DDIR_WRITE] = *val; | |
386 | td->o.rwmix[DDIR_READ] = 100 - *val; | |
387 | return 0; | |
388 | } | |
389 | ||
214e1eca JA |
390 | static int str_exitall_cb(void) |
391 | { | |
392 | exitall_on_terminate = 1; | |
393 | return 0; | |
394 | } | |
395 | ||
214e1eca | 396 | #ifdef FIO_HAVE_CPU_AFFINITY |
50b5860b | 397 | int fio_cpus_split(os_cpu_mask_t *mask, unsigned int cpu_index) |
c2acfbac | 398 | { |
50b5860b | 399 | unsigned int i, index, cpus_in_mask; |
c2acfbac | 400 | const long max_cpu = cpus_online(); |
c2acfbac | 401 | |
50b5860b JA |
402 | cpus_in_mask = fio_cpu_count(mask); |
403 | cpu_index = cpu_index % cpus_in_mask; | |
404 | ||
405 | index = 0; | |
c2acfbac | 406 | for (i = 0; i < max_cpu; i++) { |
50b5860b | 407 | if (!fio_cpu_isset(mask, i)) |
c2acfbac | 408 | continue; |
50b5860b JA |
409 | |
410 | if (cpu_index != index) | |
411 | fio_cpu_clear(mask, i); | |
412 | ||
413 | index++; | |
c2acfbac JA |
414 | } |
415 | ||
416 | return fio_cpu_count(mask); | |
417 | } | |
418 | ||
85bc833b | 419 | static int str_cpumask_cb(void *data, unsigned long long *val) |
d2e268b0 JA |
420 | { |
421 | struct thread_data *td = data; | |
214e1eca | 422 | unsigned int i; |
b03daafb | 423 | long max_cpu; |
d2ce18b5 JA |
424 | int ret; |
425 | ||
52c0cea3 JA |
426 | if (parse_dryrun()) |
427 | return 0; | |
428 | ||
d2ce18b5 JA |
429 | ret = fio_cpuset_init(&td->o.cpumask); |
430 | if (ret < 0) { | |
431 | log_err("fio: cpuset_init failed\n"); | |
432 | td_verror(td, ret, "fio_cpuset_init"); | |
433 | return 1; | |
434 | } | |
214e1eca | 435 | |
c00a2289 | 436 | max_cpu = cpus_online(); |
214e1eca | 437 | |
62a7273d JA |
438 | for (i = 0; i < sizeof(int) * 8; i++) { |
439 | if ((1 << i) & *val) { | |
b03daafb JA |
440 | if (i > max_cpu) { |
441 | log_err("fio: CPU %d too large (max=%ld)\n", i, | |
442 | max_cpu); | |
443 | return 1; | |
444 | } | |
62a7273d | 445 | dprint(FD_PARSE, "set cpu allowed %d\n", i); |
6d459ee7 | 446 | fio_cpu_set(&td->o.cpumask, i); |
62a7273d JA |
447 | } |
448 | } | |
d2e268b0 JA |
449 | |
450 | td->o.cpumask_set = 1; | |
451 | return 0; | |
214e1eca JA |
452 | } |
453 | ||
e8462bd8 JA |
454 | static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask, |
455 | const char *input) | |
214e1eca | 456 | { |
d2e268b0 | 457 | char *cpu, *str, *p; |
b03daafb | 458 | long max_cpu; |
19608d6c | 459 | int ret = 0; |
d2e268b0 | 460 | |
e8462bd8 | 461 | ret = fio_cpuset_init(mask); |
d2ce18b5 JA |
462 | if (ret < 0) { |
463 | log_err("fio: cpuset_init failed\n"); | |
464 | td_verror(td, ret, "fio_cpuset_init"); | |
465 | return 1; | |
466 | } | |
d2e268b0 JA |
467 | |
468 | p = str = strdup(input); | |
214e1eca | 469 | |
d2e268b0 JA |
470 | strip_blank_front(&str); |
471 | strip_blank_end(str); | |
472 | ||
c00a2289 | 473 | max_cpu = cpus_online(); |
b03daafb | 474 | |
d2e268b0 | 475 | while ((cpu = strsep(&str, ",")) != NULL) { |
62a7273d JA |
476 | char *str2, *cpu2; |
477 | int icpu, icpu2; | |
478 | ||
d2e268b0 JA |
479 | if (!strlen(cpu)) |
480 | break; | |
62a7273d JA |
481 | |
482 | str2 = cpu; | |
483 | icpu2 = -1; | |
484 | while ((cpu2 = strsep(&str2, "-")) != NULL) { | |
485 | if (!strlen(cpu2)) | |
486 | break; | |
487 | ||
488 | icpu2 = atoi(cpu2); | |
489 | } | |
490 | ||
491 | icpu = atoi(cpu); | |
492 | if (icpu2 == -1) | |
493 | icpu2 = icpu; | |
494 | while (icpu <= icpu2) { | |
6d459ee7 | 495 | if (icpu >= FIO_MAX_CPUS) { |
19608d6c | 496 | log_err("fio: your OS only supports up to" |
6d459ee7 | 497 | " %d CPUs\n", (int) FIO_MAX_CPUS); |
19608d6c JA |
498 | ret = 1; |
499 | break; | |
500 | } | |
b03daafb JA |
501 | if (icpu > max_cpu) { |
502 | log_err("fio: CPU %d too large (max=%ld)\n", | |
503 | icpu, max_cpu); | |
504 | ret = 1; | |
505 | break; | |
506 | } | |
0b9d69ec | 507 | |
62a7273d | 508 | dprint(FD_PARSE, "set cpu allowed %d\n", icpu); |
e8462bd8 | 509 | fio_cpu_set(mask, icpu); |
62a7273d JA |
510 | icpu++; |
511 | } | |
19608d6c JA |
512 | if (ret) |
513 | break; | |
d2e268b0 JA |
514 | } |
515 | ||
516 | free(p); | |
19608d6c JA |
517 | if (!ret) |
518 | td->o.cpumask_set = 1; | |
519 | return ret; | |
214e1eca | 520 | } |
e8462bd8 JA |
521 | |
522 | static int str_cpus_allowed_cb(void *data, const char *input) | |
523 | { | |
524 | struct thread_data *td = data; | |
525 | int ret; | |
526 | ||
52c0cea3 JA |
527 | if (parse_dryrun()) |
528 | return 0; | |
529 | ||
e8462bd8 JA |
530 | ret = set_cpus_allowed(td, &td->o.cpumask, input); |
531 | if (!ret) | |
532 | td->o.cpumask_set = 1; | |
533 | ||
534 | return ret; | |
535 | } | |
536 | ||
537 | static int str_verify_cpus_allowed_cb(void *data, const char *input) | |
538 | { | |
539 | struct thread_data *td = data; | |
540 | int ret; | |
541 | ||
542 | ret = set_cpus_allowed(td, &td->o.verify_cpumask, input); | |
543 | if (!ret) | |
544 | td->o.verify_cpumask_set = 1; | |
545 | ||
546 | return ret; | |
547 | } | |
d2e268b0 | 548 | #endif |
214e1eca | 549 | |
67bf9823 | 550 | #ifdef CONFIG_LIBNUMA |
d0b937ed YR |
551 | static int str_numa_cpunodes_cb(void *data, char *input) |
552 | { | |
553 | struct thread_data *td = data; | |
554 | ||
52c0cea3 JA |
555 | if (parse_dryrun()) |
556 | return 0; | |
557 | ||
d0b937ed YR |
558 | /* numa_parse_nodestring() parses a character string list |
559 | * of nodes into a bit mask. The bit mask is allocated by | |
560 | * numa_allocate_nodemask(), so it should be freed by | |
561 | * numa_free_nodemask(). | |
562 | */ | |
563 | td->o.numa_cpunodesmask = numa_parse_nodestring(input); | |
564 | if (td->o.numa_cpunodesmask == NULL) { | |
565 | log_err("fio: numa_parse_nodestring failed\n"); | |
566 | td_verror(td, 1, "str_numa_cpunodes_cb"); | |
567 | return 1; | |
568 | } | |
569 | ||
570 | td->o.numa_cpumask_set = 1; | |
571 | return 0; | |
572 | } | |
573 | ||
574 | static int str_numa_mpol_cb(void *data, char *input) | |
575 | { | |
576 | struct thread_data *td = data; | |
577 | const char * const policy_types[] = | |
05d6f44b | 578 | { "default", "prefer", "bind", "interleave", "local", NULL }; |
d0b937ed | 579 | int i; |
52c0cea3 JA |
580 | char *nodelist; |
581 | ||
582 | if (parse_dryrun()) | |
583 | return 0; | |
d0b937ed | 584 | |
52c0cea3 | 585 | nodelist = strchr(input, ':'); |
d0b937ed YR |
586 | if (nodelist) { |
587 | /* NUL-terminate mode */ | |
588 | *nodelist++ = '\0'; | |
589 | } | |
590 | ||
591 | for (i = 0; i <= MPOL_LOCAL; i++) { | |
592 | if (!strcmp(input, policy_types[i])) { | |
593 | td->o.numa_mem_mode = i; | |
594 | break; | |
595 | } | |
596 | } | |
597 | if (i > MPOL_LOCAL) { | |
598 | log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n"); | |
599 | goto out; | |
600 | } | |
601 | ||
602 | switch (td->o.numa_mem_mode) { | |
603 | case MPOL_PREFERRED: | |
604 | /* | |
605 | * Insist on a nodelist of one node only | |
606 | */ | |
607 | if (nodelist) { | |
608 | char *rest = nodelist; | |
609 | while (isdigit(*rest)) | |
610 | rest++; | |
611 | if (*rest) { | |
612 | log_err("fio: one node only for \'prefer\'\n"); | |
613 | goto out; | |
614 | } | |
615 | } else { | |
616 | log_err("fio: one node is needed for \'prefer\'\n"); | |
617 | goto out; | |
618 | } | |
619 | break; | |
620 | case MPOL_INTERLEAVE: | |
621 | /* | |
622 | * Default to online nodes with memory if no nodelist | |
623 | */ | |
624 | if (!nodelist) | |
625 | nodelist = strdup("all"); | |
626 | break; | |
627 | case MPOL_LOCAL: | |
628 | case MPOL_DEFAULT: | |
629 | /* | |
630 | * Don't allow a nodelist | |
631 | */ | |
632 | if (nodelist) { | |
633 | log_err("fio: NO nodelist for \'local\'\n"); | |
634 | goto out; | |
635 | } | |
636 | break; | |
637 | case MPOL_BIND: | |
638 | /* | |
639 | * Insist on a nodelist | |
640 | */ | |
641 | if (!nodelist) { | |
642 | log_err("fio: a nodelist is needed for \'bind\'\n"); | |
643 | goto out; | |
644 | } | |
645 | break; | |
646 | } | |
647 | ||
648 | ||
649 | /* numa_parse_nodestring() parses a character string list | |
650 | * of nodes into a bit mask. The bit mask is allocated by | |
651 | * numa_allocate_nodemask(), so it should be freed by | |
652 | * numa_free_nodemask(). | |
653 | */ | |
654 | switch (td->o.numa_mem_mode) { | |
655 | case MPOL_PREFERRED: | |
656 | td->o.numa_mem_prefer_node = atoi(nodelist); | |
657 | break; | |
658 | case MPOL_INTERLEAVE: | |
659 | case MPOL_BIND: | |
660 | td->o.numa_memnodesmask = numa_parse_nodestring(nodelist); | |
661 | if (td->o.numa_memnodesmask == NULL) { | |
662 | log_err("fio: numa_parse_nodestring failed\n"); | |
663 | td_verror(td, 1, "str_numa_memnodes_cb"); | |
664 | return 1; | |
665 | } | |
666 | break; | |
667 | case MPOL_LOCAL: | |
668 | case MPOL_DEFAULT: | |
669 | default: | |
670 | break; | |
671 | } | |
672 | ||
673 | td->o.numa_memmask_set = 1; | |
674 | return 0; | |
675 | ||
676 | out: | |
677 | return 1; | |
678 | } | |
679 | #endif | |
680 | ||
214e1eca JA |
681 | static int str_fst_cb(void *data, const char *str) |
682 | { | |
683 | struct thread_data *td = data; | |
684 | char *nr = get_opt_postfix(str); | |
685 | ||
686 | td->file_service_nr = 1; | |
182ec6ee | 687 | if (nr) { |
214e1eca | 688 | td->file_service_nr = atoi(nr); |
182ec6ee JA |
689 | free(nr); |
690 | } | |
214e1eca JA |
691 | |
692 | return 0; | |
693 | } | |
694 | ||
67bf9823 | 695 | #ifdef CONFIG_SYNC_FILE_RANGE |
44f29692 JA |
696 | static int str_sfr_cb(void *data, const char *str) |
697 | { | |
698 | struct thread_data *td = data; | |
699 | char *nr = get_opt_postfix(str); | |
700 | ||
701 | td->sync_file_range_nr = 1; | |
702 | if (nr) { | |
703 | td->sync_file_range_nr = atoi(nr); | |
704 | free(nr); | |
705 | } | |
706 | ||
707 | return 0; | |
708 | } | |
3ae06371 | 709 | #endif |
44f29692 | 710 | |
e25839d4 JA |
711 | static int str_random_distribution_cb(void *data, const char *str) |
712 | { | |
713 | struct thread_data *td = data; | |
714 | double val; | |
715 | char *nr; | |
716 | ||
52c0cea3 JA |
717 | if (parse_dryrun()) |
718 | return 0; | |
719 | ||
925fee33 JA |
720 | if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) |
721 | val = 1.1; | |
722 | else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) | |
723 | val = 0.2; | |
724 | else | |
e25839d4 JA |
725 | return 0; |
726 | ||
727 | nr = get_opt_postfix(str); | |
925fee33 | 728 | if (nr && !str_to_float(nr, &val)) { |
e25839d4 JA |
729 | log_err("fio: random postfix parsing failed\n"); |
730 | free(nr); | |
731 | return 1; | |
732 | } | |
733 | ||
078189c1 JA |
734 | free(nr); |
735 | ||
18ded917 JA |
736 | if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) { |
737 | if (val == 1.00) { | |
738 | log_err("fio: zipf theta must different than 1.0\n"); | |
739 | return 1; | |
740 | } | |
1e5324e7 | 741 | td->o.zipf_theta.u.f = val; |
18ded917 | 742 | } else { |
078189c1 JA |
743 | if (val <= 0.00 || val >= 1.00) { |
744 | log_err("fio: pareto input out of range (0 < input < 1.0)\n"); | |
745 | return 1; | |
746 | } | |
1e5324e7 | 747 | td->o.pareto_h.u.f = val; |
fcef0b35 | 748 | } |
921c766f JA |
749 | |
750 | return 0; | |
751 | } | |
752 | ||
8e827d35 | 753 | /* |
bcbfeefa | 754 | * Return next name in the string. Files are separated with ':'. If the ':' |
8e827d35 JA |
755 | * is escaped with a '\', then that ':' is part of the filename and does not |
756 | * indicate a new file. | |
757 | */ | |
bcbfeefa | 758 | static char *get_next_name(char **ptr) |
8e827d35 JA |
759 | { |
760 | char *str = *ptr; | |
761 | char *p, *start; | |
762 | ||
763 | if (!str || !strlen(str)) | |
764 | return NULL; | |
765 | ||
766 | start = str; | |
767 | do { | |
768 | /* | |
769 | * No colon, we are done | |
770 | */ | |
771 | p = strchr(str, ':'); | |
772 | if (!p) { | |
773 | *ptr = NULL; | |
774 | break; | |
775 | } | |
776 | ||
777 | /* | |
778 | * We got a colon, but it's the first character. Skip and | |
779 | * continue | |
780 | */ | |
781 | if (p == start) { | |
782 | str = ++start; | |
783 | continue; | |
784 | } | |
785 | ||
786 | if (*(p - 1) != '\\') { | |
787 | *p = '\0'; | |
788 | *ptr = p + 1; | |
789 | break; | |
790 | } | |
791 | ||
792 | memmove(p - 1, p, strlen(p) + 1); | |
793 | str = p; | |
794 | } while (1); | |
795 | ||
796 | return start; | |
797 | } | |
798 | ||
bcbfeefa CE |
799 | |
800 | static int get_max_name_idx(char *input) | |
801 | { | |
802 | unsigned int cur_idx; | |
803 | char *str, *p; | |
804 | ||
805 | p = str = strdup(input); | |
806 | for (cur_idx = 0; ; cur_idx++) | |
807 | if (get_next_name(&str) == NULL) | |
808 | break; | |
809 | ||
810 | free(p); | |
811 | return cur_idx; | |
812 | } | |
813 | ||
814 | /* | |
815 | * Returns the directory at the index, indexes > entires will be | |
816 | * assigned via modulo division of the index | |
817 | */ | |
818 | int set_name_idx(char *target, char *input, int index) | |
819 | { | |
820 | unsigned int cur_idx; | |
821 | int len; | |
822 | char *fname, *str, *p; | |
823 | ||
824 | p = str = strdup(input); | |
825 | ||
826 | index %= get_max_name_idx(input); | |
827 | for (cur_idx = 0; cur_idx <= index; cur_idx++) | |
828 | fname = get_next_name(&str); | |
829 | ||
830 | len = sprintf(target, "%s/", fname); | |
831 | free(p); | |
832 | ||
833 | return len; | |
834 | } | |
835 | ||
214e1eca JA |
836 | static int str_filename_cb(void *data, const char *input) |
837 | { | |
838 | struct thread_data *td = data; | |
839 | char *fname, *str, *p; | |
840 | ||
841 | p = str = strdup(input); | |
842 | ||
843 | strip_blank_front(&str); | |
844 | strip_blank_end(str); | |
845 | ||
846 | if (!td->files_index) | |
2dc1bbeb | 847 | td->o.nr_files = 0; |
214e1eca | 848 | |
bcbfeefa | 849 | while ((fname = get_next_name(&str)) != NULL) { |
214e1eca JA |
850 | if (!strlen(fname)) |
851 | break; | |
5903e7b7 | 852 | add_file(td, fname, 0, 1); |
214e1eca JA |
853 | } |
854 | ||
855 | free(p); | |
856 | return 0; | |
857 | } | |
858 | ||
bcbfeefa | 859 | static int str_directory_cb(void *data, const char fio_unused *unused) |
214e1eca JA |
860 | { |
861 | struct thread_data *td = data; | |
862 | struct stat sb; | |
bcbfeefa CE |
863 | char *dirname, *str, *p; |
864 | int ret = 0; | |
214e1eca | 865 | |
f9633d72 JA |
866 | if (parse_dryrun()) |
867 | return 0; | |
868 | ||
bcbfeefa CE |
869 | p = str = strdup(td->o.directory); |
870 | while ((dirname = get_next_name(&str)) != NULL) { | |
871 | if (lstat(dirname, &sb) < 0) { | |
872 | ret = errno; | |
921c766f | 873 | |
bcbfeefa CE |
874 | log_err("fio: %s is not a directory\n", dirname); |
875 | td_verror(td, ret, "lstat"); | |
876 | goto out; | |
877 | } | |
878 | if (!S_ISDIR(sb.st_mode)) { | |
879 | log_err("fio: %s is not a directory\n", dirname); | |
880 | ret = 1; | |
881 | goto out; | |
882 | } | |
214e1eca JA |
883 | } |
884 | ||
bcbfeefa CE |
885 | out: |
886 | free(p); | |
887 | return ret; | |
214e1eca JA |
888 | } |
889 | ||
f2a2803a JA |
890 | static int str_lockfile_cb(void *data, const char fio_unused *str) |
891 | { | |
892 | struct thread_data *td = data; | |
893 | ||
894 | if (td->files_index) { | |
895 | log_err("fio: lockfile= option must precede filename=\n"); | |
896 | return 1; | |
897 | } | |
898 | ||
899 | return 0; | |
900 | } | |
901 | ||
214e1eca JA |
902 | static int str_opendir_cb(void *data, const char fio_unused *str) |
903 | { | |
904 | struct thread_data *td = data; | |
905 | ||
52c0cea3 JA |
906 | if (parse_dryrun()) |
907 | return 0; | |
908 | ||
214e1eca | 909 | if (!td->files_index) |
2dc1bbeb | 910 | td->o.nr_files = 0; |
214e1eca | 911 | |
2dc1bbeb | 912 | return add_dir_files(td, td->o.opendir); |
214e1eca JA |
913 | } |
914 | ||
ce35b1ec JA |
915 | static int pattern_cb(char *pattern, unsigned int max_size, |
916 | const char *input, unsigned int *pattern_bytes) | |
90059d65 | 917 | { |
0e92f873 | 918 | long off; |
ce35b1ec JA |
919 | int i = 0, j = 0, len, k, base = 10; |
920 | uint32_t pattern_length; | |
3c3ed070 | 921 | char *loc1, *loc2; |
0e92f873 RR |
922 | |
923 | loc1 = strstr(input, "0x"); | |
924 | loc2 = strstr(input, "0X"); | |
925 | if (loc1 || loc2) | |
926 | base = 16; | |
927 | off = strtol(input, NULL, base); | |
928 | if (off != LONG_MAX || errno != ERANGE) { | |
929 | while (off) { | |
ce35b1ec | 930 | pattern[i] = off & 0xff; |
0e92f873 RR |
931 | off >>= 8; |
932 | i++; | |
933 | } | |
934 | } else { | |
935 | len = strlen(input); | |
936 | k = len - 1; | |
937 | if (base == 16) { | |
938 | if (loc1) | |
939 | j = loc1 - input + 2; | |
940 | else | |
941 | j = loc2 - input + 2; | |
942 | } else | |
943 | return 1; | |
ce35b1ec | 944 | if (len - j < max_size * 2) { |
0e92f873 RR |
945 | while (k >= j) { |
946 | off = converthexchartoint(input[k--]); | |
947 | if (k >= j) | |
948 | off += (converthexchartoint(input[k--]) | |
949 | * 16); | |
ce35b1ec | 950 | pattern[i++] = (char) off; |
0e92f873 RR |
951 | } |
952 | } | |
953 | } | |
efcd9dcc SL |
954 | |
955 | /* | |
956 | * Fill the pattern all the way to the end. This greatly reduces | |
957 | * the number of memcpy's we have to do when verifying the IO. | |
958 | */ | |
e078de4a | 959 | pattern_length = i; |
ce35b1ec JA |
960 | while (i > 1 && i * 2 <= max_size) { |
961 | memcpy(&pattern[i], &pattern[0], i); | |
efcd9dcc SL |
962 | i *= 2; |
963 | } | |
e078de4a JA |
964 | |
965 | /* | |
966 | * Fill remainder, if the pattern multiple ends up not being | |
ce35b1ec | 967 | * max_size. |
e078de4a | 968 | */ |
ce35b1ec JA |
969 | while (i > 1 && i < max_size) { |
970 | unsigned int b = min(pattern_length, max_size - i); | |
e078de4a | 971 | |
ce35b1ec | 972 | memcpy(&pattern[i], &pattern[0], b); |
e078de4a JA |
973 | i += b; |
974 | } | |
975 | ||
9a2a86d0 SL |
976 | if (i == 1) { |
977 | /* | |
978 | * The code in verify_io_u_pattern assumes a single byte pattern | |
979 | * fills the whole verify pattern buffer. | |
980 | */ | |
ce35b1ec JA |
981 | memset(pattern, pattern[0], max_size); |
982 | } | |
983 | ||
984 | *pattern_bytes = i; | |
985 | return 0; | |
986 | } | |
987 | ||
988 | static int str_buffer_pattern_cb(void *data, const char *input) | |
989 | { | |
990 | struct thread_data *td = data; | |
991 | int ret; | |
992 | ||
993 | ret = pattern_cb(td->o.buffer_pattern, MAX_PATTERN_SIZE, input, | |
994 | &td->o.buffer_pattern_bytes); | |
995 | ||
996 | if (!ret) { | |
997 | td->o.refill_buffers = 0; | |
998 | td->o.scramble_buffers = 0; | |
999 | td->o.zero_buffers = 0; | |
9a2a86d0 | 1000 | } |
efcd9dcc | 1001 | |
ce35b1ec JA |
1002 | return ret; |
1003 | } | |
1004 | ||
bedc9dc2 JA |
1005 | static int str_buffer_compress_cb(void *data, unsigned long long *il) |
1006 | { | |
1007 | struct thread_data *td = data; | |
1008 | ||
1009 | td->flags |= TD_F_COMPRESS; | |
1010 | td->o.compress_percentage = *il; | |
1011 | return 0; | |
1012 | } | |
1013 | ||
ce35b1ec JA |
1014 | static int str_verify_pattern_cb(void *data, const char *input) |
1015 | { | |
1016 | struct thread_data *td = data; | |
1017 | int ret; | |
1018 | ||
1019 | ret = pattern_cb(td->o.verify_pattern, MAX_PATTERN_SIZE, input, | |
1020 | &td->o.verify_pattern_bytes); | |
efcd9dcc | 1021 | |
92bf48d5 JA |
1022 | /* |
1023 | * VERIFY_META could already be set | |
1024 | */ | |
ce35b1ec | 1025 | if (!ret && td->o.verify == VERIFY_NONE) |
92bf48d5 | 1026 | td->o.verify = VERIFY_PATTERN; |
efcd9dcc | 1027 | |
ce35b1ec | 1028 | return ret; |
90059d65 | 1029 | } |
214e1eca | 1030 | |
993bf48b JA |
1031 | static int str_gtod_reduce_cb(void *data, int *il) |
1032 | { | |
1033 | struct thread_data *td = data; | |
1034 | int val = *il; | |
1035 | ||
02af0988 | 1036 | td->o.disable_lat = !!val; |
993bf48b JA |
1037 | td->o.disable_clat = !!val; |
1038 | td->o.disable_slat = !!val; | |
1039 | td->o.disable_bw = !!val; | |
0dc1bc03 | 1040 | td->o.clat_percentiles = !val; |
993bf48b JA |
1041 | if (val) |
1042 | td->tv_cache_mask = 63; | |
1043 | ||
1044 | return 0; | |
1045 | } | |
1046 | ||
85bc833b | 1047 | static int str_gtod_cpu_cb(void *data, long long *il) |
be4ecfdf JA |
1048 | { |
1049 | struct thread_data *td = data; | |
1050 | int val = *il; | |
1051 | ||
1052 | td->o.gtod_cpu = val; | |
1053 | td->o.gtod_offload = 1; | |
1054 | return 0; | |
1055 | } | |
1056 | ||
7bb59102 JA |
1057 | static int str_size_cb(void *data, unsigned long long *__val) |
1058 | { | |
1059 | struct thread_data *td = data; | |
1060 | unsigned long long v = *__val; | |
1061 | ||
1062 | if (parse_is_percent(v)) { | |
1063 | td->o.size = 0; | |
1064 | td->o.size_percent = -1ULL - v; | |
1065 | } else | |
1066 | td->o.size = v; | |
1067 | ||
1068 | return 0; | |
1069 | } | |
1070 | ||
896cac2a JA |
1071 | static int rw_verify(struct fio_option *o, void *data) |
1072 | { | |
1073 | struct thread_data *td = data; | |
1074 | ||
1075 | if (read_only && td_write(td)) { | |
1076 | log_err("fio: job <%s> has write bit set, but fio is in" | |
1077 | " read-only mode\n", td->o.name); | |
1078 | return 1; | |
1079 | } | |
1080 | ||
1081 | return 0; | |
1082 | } | |
1083 | ||
276ca4f7 | 1084 | static int gtod_cpu_verify(struct fio_option *o, void *data) |
29d43ff9 | 1085 | { |
276ca4f7 | 1086 | #ifndef FIO_HAVE_CPU_AFFINITY |
29d43ff9 JA |
1087 | struct thread_data *td = data; |
1088 | ||
29d43ff9 JA |
1089 | if (td->o.gtod_cpu) { |
1090 | log_err("fio: platform must support CPU affinity for" | |
1091 | "gettimeofday() offloading\n"); | |
1092 | return 1; | |
1093 | } | |
1094 | #endif | |
1095 | ||
1096 | return 0; | |
1097 | } | |
1098 | ||
9af4a244 JA |
1099 | /* |
1100 | * Option grouping | |
1101 | */ | |
1102 | static struct opt_group fio_opt_groups[] = { | |
1103 | { | |
e8b0e958 JA |
1104 | .name = "General", |
1105 | .mask = FIO_OPT_C_GENERAL, | |
9af4a244 JA |
1106 | }, |
1107 | { | |
e8b0e958 JA |
1108 | .name = "I/O", |
1109 | .mask = FIO_OPT_C_IO, | |
9af4a244 JA |
1110 | }, |
1111 | { | |
e8b0e958 JA |
1112 | .name = "File", |
1113 | .mask = FIO_OPT_C_FILE, | |
9af4a244 JA |
1114 | }, |
1115 | { | |
e8b0e958 JA |
1116 | .name = "Statistics", |
1117 | .mask = FIO_OPT_C_STAT, | |
9af4a244 JA |
1118 | }, |
1119 | { | |
e8b0e958 JA |
1120 | .name = "Logging", |
1121 | .mask = FIO_OPT_C_LOG, | |
9af4a244 | 1122 | }, |
13fca827 JA |
1123 | { |
1124 | .name = "Profiles", | |
1125 | .mask = FIO_OPT_C_PROFILE, | |
1126 | }, | |
e231bbe6 | 1127 | { |
e8b0e958 | 1128 | .name = NULL, |
e231bbe6 | 1129 | }, |
e8b0e958 JA |
1130 | }; |
1131 | ||
1132 | static struct opt_group *__opt_group_from_mask(struct opt_group *ogs, unsigned int *mask, | |
1133 | unsigned int inv_mask) | |
1134 | { | |
1135 | struct opt_group *og; | |
1136 | int i; | |
1137 | ||
1138 | if (*mask == inv_mask || !*mask) | |
1139 | return NULL; | |
1140 | ||
1141 | for (i = 0; ogs[i].name; i++) { | |
1142 | og = &ogs[i]; | |
1143 | ||
1144 | if (*mask & og->mask) { | |
1145 | *mask &= ~(og->mask); | |
1146 | return og; | |
1147 | } | |
1148 | } | |
1149 | ||
1150 | return NULL; | |
1151 | } | |
1152 | ||
1153 | struct opt_group *opt_group_from_mask(unsigned int *mask) | |
1154 | { | |
1155 | return __opt_group_from_mask(fio_opt_groups, mask, FIO_OPT_C_INVALID); | |
1156 | } | |
1157 | ||
1158 | static struct opt_group fio_opt_cat_groups[] = { | |
3e260a46 JA |
1159 | { |
1160 | .name = "Latency profiling", | |
1161 | .mask = FIO_OPT_G_LATPROF, | |
1162 | }, | |
9af4a244 | 1163 | { |
e8b0e958 JA |
1164 | .name = "Rate", |
1165 | .mask = FIO_OPT_G_RATE, | |
9af4a244 JA |
1166 | }, |
1167 | { | |
e8b0e958 JA |
1168 | .name = "Zone", |
1169 | .mask = FIO_OPT_G_ZONE, | |
9af4a244 JA |
1170 | }, |
1171 | { | |
e8b0e958 JA |
1172 | .name = "Read/write mix", |
1173 | .mask = FIO_OPT_G_RWMIX, | |
9af4a244 JA |
1174 | }, |
1175 | { | |
1176 | .name = "Verify", | |
1177 | .mask = FIO_OPT_G_VERIFY, | |
1178 | }, | |
1179 | { | |
e8b0e958 JA |
1180 | .name = "Trim", |
1181 | .mask = FIO_OPT_G_TRIM, | |
9af4a244 JA |
1182 | }, |
1183 | { | |
e8b0e958 JA |
1184 | .name = "I/O Logging", |
1185 | .mask = FIO_OPT_G_IOLOG, | |
9af4a244 JA |
1186 | }, |
1187 | { | |
e8b0e958 JA |
1188 | .name = "I/O Depth", |
1189 | .mask = FIO_OPT_G_IO_DEPTH, | |
9af4a244 JA |
1190 | }, |
1191 | { | |
e8b0e958 JA |
1192 | .name = "I/O Flow", |
1193 | .mask = FIO_OPT_G_IO_FLOW, | |
9af4a244 | 1194 | }, |
0626037e JA |
1195 | { |
1196 | .name = "Description", | |
1197 | .mask = FIO_OPT_G_DESC, | |
1198 | }, | |
1199 | { | |
1200 | .name = "Filename", | |
1201 | .mask = FIO_OPT_G_FILENAME, | |
1202 | }, | |
1203 | { | |
1204 | .name = "General I/O", | |
1205 | .mask = FIO_OPT_G_IO_BASIC, | |
1206 | }, | |
a1f6afec JA |
1207 | { |
1208 | .name = "Cgroups", | |
1209 | .mask = FIO_OPT_G_CGROUP, | |
1210 | }, | |
1211 | { | |
1212 | .name = "Runtime", | |
1213 | .mask = FIO_OPT_G_RUNTIME, | |
1214 | }, | |
10860056 JA |
1215 | { |
1216 | .name = "Process", | |
1217 | .mask = FIO_OPT_G_PROCESS, | |
1218 | }, | |
1219 | { | |
1220 | .name = "Job credentials / priority", | |
1221 | .mask = FIO_OPT_G_CRED, | |
1222 | }, | |
1223 | { | |
1224 | .name = "Clock settings", | |
1225 | .mask = FIO_OPT_G_CLOCK, | |
1226 | }, | |
3ceb458f JA |
1227 | { |
1228 | .name = "I/O Type", | |
1229 | .mask = FIO_OPT_G_IO_TYPE, | |
1230 | }, | |
1231 | { | |
1232 | .name = "I/O Thinktime", | |
1233 | .mask = FIO_OPT_G_THINKTIME, | |
1234 | }, | |
1235 | { | |
1236 | .name = "Randomizations", | |
1237 | .mask = FIO_OPT_G_RANDOM, | |
1238 | }, | |
1239 | { | |
1240 | .name = "I/O buffers", | |
1241 | .mask = FIO_OPT_G_IO_BUF, | |
1242 | }, | |
13fca827 JA |
1243 | { |
1244 | .name = "Tiobench profile", | |
1245 | .mask = FIO_OPT_G_TIOBENCH, | |
1246 | }, | |
1247 | ||
9af4a244 JA |
1248 | { |
1249 | .name = NULL, | |
e8b0e958 | 1250 | } |
9af4a244 JA |
1251 | }; |
1252 | ||
e8b0e958 | 1253 | struct opt_group *opt_group_cat_from_mask(unsigned int *mask) |
9af4a244 | 1254 | { |
e8b0e958 | 1255 | return __opt_group_from_mask(fio_opt_cat_groups, mask, FIO_OPT_G_INVALID); |
9af4a244 JA |
1256 | } |
1257 | ||
214e1eca JA |
1258 | /* |
1259 | * Map of job/command line options | |
1260 | */ | |
9af4a244 | 1261 | struct fio_option fio_options[FIO_MAX_OPTS] = { |
214e1eca JA |
1262 | { |
1263 | .name = "description", | |
e8b0e958 | 1264 | .lname = "Description of job", |
214e1eca JA |
1265 | .type = FIO_OPT_STR_STORE, |
1266 | .off1 = td_var_offset(description), | |
1267 | .help = "Text job description", | |
e8b0e958 | 1268 | .category = FIO_OPT_C_GENERAL, |
0626037e | 1269 | .group = FIO_OPT_G_DESC, |
214e1eca JA |
1270 | }, |
1271 | { | |
1272 | .name = "name", | |
e8b0e958 | 1273 | .lname = "Job name", |
214e1eca JA |
1274 | .type = FIO_OPT_STR_STORE, |
1275 | .off1 = td_var_offset(name), | |
1276 | .help = "Name of this job", | |
e8b0e958 | 1277 | .category = FIO_OPT_C_GENERAL, |
0626037e | 1278 | .group = FIO_OPT_G_DESC, |
214e1eca | 1279 | }, |
214e1eca JA |
1280 | { |
1281 | .name = "filename", | |
e8b0e958 | 1282 | .lname = "Filename(s)", |
214e1eca JA |
1283 | .type = FIO_OPT_STR_STORE, |
1284 | .off1 = td_var_offset(filename), | |
1285 | .cb = str_filename_cb, | |
f0d524b0 | 1286 | .prio = -1, /* must come after "directory" */ |
214e1eca | 1287 | .help = "File(s) to use for the workload", |
e8b0e958 | 1288 | .category = FIO_OPT_C_FILE, |
0626037e | 1289 | .group = FIO_OPT_G_FILENAME, |
214e1eca | 1290 | }, |
90fef2d1 | 1291 | { |
e8b0e958 JA |
1292 | .name = "directory", |
1293 | .lname = "Directory", | |
1294 | .type = FIO_OPT_STR_STORE, | |
1295 | .off1 = td_var_offset(directory), | |
1296 | .cb = str_directory_cb, | |
1297 | .help = "Directory to store files in", | |
1298 | .category = FIO_OPT_C_FILE, | |
0626037e | 1299 | .group = FIO_OPT_G_FILENAME, |
90fef2d1 | 1300 | }, |
de98bd30 JA |
1301 | { |
1302 | .name = "filename_format", | |
1303 | .type = FIO_OPT_STR_STORE, | |
1304 | .off1 = td_var_offset(filename_format), | |
1305 | .prio = -1, /* must come after "directory" */ | |
1306 | .help = "Override default $jobname.$jobnum.$filenum naming", | |
1307 | .def = "$jobname.$jobnum.$filenum", | |
93bb626a JA |
1308 | .category = FIO_OPT_C_FILE, |
1309 | .group = FIO_OPT_G_FILENAME, | |
ad705bcb | 1310 | }, |
29c1349f JA |
1311 | { |
1312 | .name = "lockfile", | |
e8b0e958 | 1313 | .lname = "Lockfile", |
4d4e80f2 | 1314 | .type = FIO_OPT_STR, |
4d4e80f2 | 1315 | .off1 = td_var_offset(file_lock_mode), |
29c1349f | 1316 | .help = "Lock file when doing IO to it", |
bc6a0a5d | 1317 | .prio = 1, |
29c1349f | 1318 | .parent = "filename", |
d71c154c | 1319 | .hide = 0, |
4d4e80f2 | 1320 | .def = "none", |
f2a2803a | 1321 | .cb = str_lockfile_cb, |
e8b0e958 | 1322 | .category = FIO_OPT_C_FILE, |
0626037e | 1323 | .group = FIO_OPT_G_FILENAME, |
4d4e80f2 JA |
1324 | .posval = { |
1325 | { .ival = "none", | |
1326 | .oval = FILE_LOCK_NONE, | |
1327 | .help = "No file locking", | |
1328 | }, | |
1329 | { .ival = "exclusive", | |
1330 | .oval = FILE_LOCK_EXCLUSIVE, | |
1331 | .help = "Exclusive file lock", | |
1332 | }, | |
1333 | { | |
1334 | .ival = "readwrite", | |
1335 | .oval = FILE_LOCK_READWRITE, | |
1336 | .help = "Read vs write lock", | |
1337 | }, | |
1338 | }, | |
29c1349f | 1339 | }, |
214e1eca JA |
1340 | { |
1341 | .name = "opendir", | |
e8b0e958 | 1342 | .lname = "Open directory", |
214e1eca JA |
1343 | .type = FIO_OPT_STR_STORE, |
1344 | .off1 = td_var_offset(opendir), | |
1345 | .cb = str_opendir_cb, | |
1346 | .help = "Recursively add files from this directory and down", | |
e8b0e958 | 1347 | .category = FIO_OPT_C_FILE, |
0626037e | 1348 | .group = FIO_OPT_G_FILENAME, |
214e1eca JA |
1349 | }, |
1350 | { | |
1351 | .name = "rw", | |
e8b0e958 | 1352 | .lname = "Read/write", |
d3aad8f2 | 1353 | .alias = "readwrite", |
214e1eca | 1354 | .type = FIO_OPT_STR, |
211097b2 | 1355 | .cb = str_rw_cb, |
214e1eca JA |
1356 | .off1 = td_var_offset(td_ddir), |
1357 | .help = "IO direction", | |
1358 | .def = "read", | |
896cac2a | 1359 | .verify = rw_verify, |
e8b0e958 | 1360 | .category = FIO_OPT_C_IO, |
0626037e | 1361 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1362 | .posval = { |
1363 | { .ival = "read", | |
1364 | .oval = TD_DDIR_READ, | |
1365 | .help = "Sequential read", | |
1366 | }, | |
1367 | { .ival = "write", | |
1368 | .oval = TD_DDIR_WRITE, | |
1369 | .help = "Sequential write", | |
1370 | }, | |
6eaf09d6 SL |
1371 | { .ival = "trim", |
1372 | .oval = TD_DDIR_TRIM, | |
1373 | .help = "Sequential trim", | |
1374 | }, | |
214e1eca JA |
1375 | { .ival = "randread", |
1376 | .oval = TD_DDIR_RANDREAD, | |
1377 | .help = "Random read", | |
1378 | }, | |
1379 | { .ival = "randwrite", | |
1380 | .oval = TD_DDIR_RANDWRITE, | |
1381 | .help = "Random write", | |
1382 | }, | |
6eaf09d6 SL |
1383 | { .ival = "randtrim", |
1384 | .oval = TD_DDIR_RANDTRIM, | |
1385 | .help = "Random trim", | |
1386 | }, | |
214e1eca JA |
1387 | { .ival = "rw", |
1388 | .oval = TD_DDIR_RW, | |
1389 | .help = "Sequential read and write mix", | |
1390 | }, | |
10b023db JA |
1391 | { .ival = "readwrite", |
1392 | .oval = TD_DDIR_RW, | |
1393 | .help = "Sequential read and write mix", | |
1394 | }, | |
214e1eca JA |
1395 | { .ival = "randrw", |
1396 | .oval = TD_DDIR_RANDRW, | |
1397 | .help = "Random read and write mix" | |
1398 | }, | |
1399 | }, | |
1400 | }, | |
38dad62d JA |
1401 | { |
1402 | .name = "rw_sequencer", | |
e8b0e958 | 1403 | .lname = "RW Sequencer", |
38dad62d JA |
1404 | .type = FIO_OPT_STR, |
1405 | .off1 = td_var_offset(rw_seq), | |
1406 | .help = "IO offset generator modifier", | |
1407 | .def = "sequential", | |
e8b0e958 | 1408 | .category = FIO_OPT_C_IO, |
0626037e | 1409 | .group = FIO_OPT_G_IO_BASIC, |
38dad62d JA |
1410 | .posval = { |
1411 | { .ival = "sequential", | |
1412 | .oval = RW_SEQ_SEQ, | |
1413 | .help = "Generate sequential offsets", | |
1414 | }, | |
1415 | { .ival = "identical", | |
1416 | .oval = RW_SEQ_IDENT, | |
1417 | .help = "Generate identical offsets", | |
1418 | }, | |
1419 | }, | |
1420 | }, | |
1421 | ||
214e1eca JA |
1422 | { |
1423 | .name = "ioengine", | |
e8b0e958 | 1424 | .lname = "IO Engine", |
214e1eca JA |
1425 | .type = FIO_OPT_STR_STORE, |
1426 | .off1 = td_var_offset(ioengine), | |
1427 | .help = "IO engine to use", | |
58483fa4 | 1428 | .def = FIO_PREFERRED_ENGINE, |
e8b0e958 | 1429 | .category = FIO_OPT_C_IO, |
0626037e | 1430 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1431 | .posval = { |
1432 | { .ival = "sync", | |
1433 | .help = "Use read/write", | |
1434 | }, | |
a31041ea | 1435 | { .ival = "psync", |
1436 | .help = "Use pread/pwrite", | |
1437 | }, | |
1d2af02a | 1438 | { .ival = "vsync", |
03e20d68 | 1439 | .help = "Use readv/writev", |
1d2af02a | 1440 | }, |
07fc0acd JA |
1441 | #ifdef CONFIG_PWRITEV |
1442 | { .ival = "pvsync", | |
1443 | .help = "Use preadv/pwritev", | |
1444 | }, | |
1445 | #endif | |
67bf9823 | 1446 | #ifdef CONFIG_LIBAIO |
214e1eca JA |
1447 | { .ival = "libaio", |
1448 | .help = "Linux native asynchronous IO", | |
1449 | }, | |
1450 | #endif | |
67bf9823 | 1451 | #ifdef CONFIG_POSIXAIO |
214e1eca JA |
1452 | { .ival = "posixaio", |
1453 | .help = "POSIX asynchronous IO", | |
1454 | }, | |
417f0068 | 1455 | #endif |
997843cb | 1456 | #ifdef CONFIG_SOLARISAIO |
417f0068 JA |
1457 | { .ival = "solarisaio", |
1458 | .help = "Solaris native asynchronous IO", | |
1459 | }, | |
214e1eca | 1460 | #endif |
4700b234 | 1461 | #ifdef CONFIG_WINDOWSAIO |
03e20d68 | 1462 | { .ival = "windowsaio", |
3be80071 | 1463 | .help = "Windows native asynchronous IO" |
de890a1e | 1464 | }, |
fc5c0345 DG |
1465 | #endif |
1466 | #ifdef CONFIG_RBD | |
1467 | { .ival = "rbd", | |
1468 | .help = "Rados Block Device asynchronous IO" | |
1469 | }, | |
3be80071 | 1470 | #endif |
214e1eca | 1471 | { .ival = "mmap", |
03e20d68 | 1472 | .help = "Memory mapped IO" |
214e1eca | 1473 | }, |
67bf9823 | 1474 | #ifdef CONFIG_LINUX_SPLICE |
214e1eca JA |
1475 | { .ival = "splice", |
1476 | .help = "splice/vmsplice based IO", | |
1477 | }, | |
9cce02e8 JA |
1478 | { .ival = "netsplice", |
1479 | .help = "splice/vmsplice to/from the network", | |
1480 | }, | |
214e1eca JA |
1481 | #endif |
1482 | #ifdef FIO_HAVE_SGIO | |
1483 | { .ival = "sg", | |
1484 | .help = "SCSI generic v3 IO", | |
1485 | }, | |
1486 | #endif | |
1487 | { .ival = "null", | |
1488 | .help = "Testing engine (no data transfer)", | |
1489 | }, | |
1490 | { .ival = "net", | |
1491 | .help = "Network IO", | |
1492 | }, | |
214e1eca | 1493 | { .ival = "cpuio", |
03e20d68 | 1494 | .help = "CPU cycle burner engine", |
214e1eca | 1495 | }, |
67bf9823 | 1496 | #ifdef CONFIG_GUASI |
b8c82a46 JA |
1497 | { .ival = "guasi", |
1498 | .help = "GUASI IO engine", | |
1499 | }, | |
79a43187 JA |
1500 | #endif |
1501 | #ifdef FIO_HAVE_BINJECT | |
1502 | { .ival = "binject", | |
1503 | .help = "binject direct inject block engine", | |
1504 | }, | |
21b8aee8 | 1505 | #endif |
67bf9823 | 1506 | #ifdef CONFIG_RDMA |
21b8aee8 | 1507 | { .ival = "rdma", |
1508 | .help = "RDMA IO engine", | |
1509 | }, | |
8200b8c7 | 1510 | #endif |
67bf9823 | 1511 | #ifdef CONFIG_FUSION_AW |
8200b8c7 JA |
1512 | { .ival = "fusion-aw-sync", |
1513 | .help = "Fusion-io atomic write engine", | |
1514 | }, | |
1ecc95ca | 1515 | #endif |
997843cb | 1516 | #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT |
1ecc95ca JA |
1517 | { .ival = "e4defrag", |
1518 | .help = "ext4 defrag engine", | |
1519 | }, | |
1520 | #endif | |
997843cb | 1521 | #ifdef CONFIG_LINUX_FALLOCATE |
1ecc95ca JA |
1522 | { .ival = "falloc", |
1523 | .help = "fallocate() file based engine", | |
1524 | }, | |
b8c82a46 | 1525 | #endif |
214e1eca JA |
1526 | { .ival = "external", |
1527 | .help = "Load external engine (append name)", | |
1528 | }, | |
1529 | }, | |
1530 | }, | |
1531 | { | |
1532 | .name = "iodepth", | |
e8b0e958 | 1533 | .lname = "IO Depth", |
214e1eca JA |
1534 | .type = FIO_OPT_INT, |
1535 | .off1 = td_var_offset(iodepth), | |
03e20d68 | 1536 | .help = "Number of IO buffers to keep in flight", |
757aff4f | 1537 | .minval = 1, |
20eb06bd | 1538 | .interval = 1, |
214e1eca | 1539 | .def = "1", |
e8b0e958 | 1540 | .category = FIO_OPT_C_IO, |
0626037e | 1541 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1542 | }, |
1543 | { | |
1544 | .name = "iodepth_batch", | |
e8b0e958 | 1545 | .lname = "IO Depth batch", |
4950421a | 1546 | .alias = "iodepth_batch_submit", |
214e1eca JA |
1547 | .type = FIO_OPT_INT, |
1548 | .off1 = td_var_offset(iodepth_batch), | |
d65db441 | 1549 | .help = "Number of IO buffers to submit in one go", |
afdf9352 | 1550 | .parent = "iodepth", |
d71c154c | 1551 | .hide = 1, |
a2e6f8ac | 1552 | .minval = 1, |
20eb06bd | 1553 | .interval = 1, |
a2e6f8ac | 1554 | .def = "1", |
e8b0e958 | 1555 | .category = FIO_OPT_C_IO, |
0626037e | 1556 | .group = FIO_OPT_G_IO_BASIC, |
4950421a JA |
1557 | }, |
1558 | { | |
1559 | .name = "iodepth_batch_complete", | |
e8b0e958 | 1560 | .lname = "IO Depth batch complete", |
4950421a JA |
1561 | .type = FIO_OPT_INT, |
1562 | .off1 = td_var_offset(iodepth_batch_complete), | |
d65db441 | 1563 | .help = "Number of IO buffers to retrieve in one go", |
4950421a | 1564 | .parent = "iodepth", |
d71c154c | 1565 | .hide = 1, |
4950421a | 1566 | .minval = 0, |
20eb06bd | 1567 | .interval = 1, |
4950421a | 1568 | .def = "1", |
e8b0e958 | 1569 | .category = FIO_OPT_C_IO, |
0626037e | 1570 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1571 | }, |
1572 | { | |
1573 | .name = "iodepth_low", | |
e8b0e958 | 1574 | .lname = "IO Depth batch low", |
214e1eca JA |
1575 | .type = FIO_OPT_INT, |
1576 | .off1 = td_var_offset(iodepth_low), | |
1577 | .help = "Low water mark for queuing depth", | |
afdf9352 | 1578 | .parent = "iodepth", |
d71c154c | 1579 | .hide = 1, |
20eb06bd | 1580 | .interval = 1, |
e8b0e958 | 1581 | .category = FIO_OPT_C_IO, |
0626037e | 1582 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1583 | }, |
1584 | { | |
1585 | .name = "size", | |
e8b0e958 | 1586 | .lname = "Size", |
214e1eca | 1587 | .type = FIO_OPT_STR_VAL, |
7bb59102 | 1588 | .cb = str_size_cb, |
214e1eca | 1589 | .help = "Total size of device or files", |
20eb06bd | 1590 | .interval = 1024 * 1024, |
e8b0e958 JA |
1591 | .category = FIO_OPT_C_IO, |
1592 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1593 | }, |
aa31f1f1 SL |
1594 | { |
1595 | .name = "fill_device", | |
e8b0e958 | 1596 | .lname = "Fill device", |
74586c1e | 1597 | .alias = "fill_fs", |
aa31f1f1 SL |
1598 | .type = FIO_OPT_BOOL, |
1599 | .off1 = td_var_offset(fill_device), | |
1600 | .help = "Write until an ENOSPC error occurs", | |
1601 | .def = "0", | |
e8b0e958 JA |
1602 | .category = FIO_OPT_C_FILE, |
1603 | .group = FIO_OPT_G_INVALID, | |
aa31f1f1 | 1604 | }, |
214e1eca JA |
1605 | { |
1606 | .name = "filesize", | |
e8b0e958 | 1607 | .lname = "File size", |
214e1eca JA |
1608 | .type = FIO_OPT_STR_VAL, |
1609 | .off1 = td_var_offset(file_size_low), | |
1610 | .off2 = td_var_offset(file_size_high), | |
c3edbdba | 1611 | .minval = 1, |
214e1eca | 1612 | .help = "Size of individual files", |
20eb06bd | 1613 | .interval = 1024 * 1024, |
e8b0e958 JA |
1614 | .category = FIO_OPT_C_FILE, |
1615 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1616 | }, |
bedc9dc2 JA |
1617 | { |
1618 | .name = "file_append", | |
1619 | .lname = "File append", | |
1620 | .type = FIO_OPT_BOOL, | |
1621 | .off1 = td_var_offset(file_append), | |
1622 | .help = "IO will start at the end of the file(s)", | |
1623 | .def = "0", | |
1624 | .category = FIO_OPT_C_FILE, | |
1625 | .group = FIO_OPT_G_INVALID, | |
1626 | }, | |
67a1000f JA |
1627 | { |
1628 | .name = "offset", | |
e8b0e958 | 1629 | .lname = "IO offset", |
67a1000f JA |
1630 | .alias = "fileoffset", |
1631 | .type = FIO_OPT_STR_VAL, | |
1632 | .off1 = td_var_offset(start_offset), | |
1633 | .help = "Start IO from this offset", | |
1634 | .def = "0", | |
20eb06bd | 1635 | .interval = 1024 * 1024, |
e8b0e958 JA |
1636 | .category = FIO_OPT_C_IO, |
1637 | .group = FIO_OPT_G_INVALID, | |
67a1000f | 1638 | }, |
2d7cd868 JA |
1639 | { |
1640 | .name = "offset_increment", | |
e8b0e958 | 1641 | .lname = "IO offset increment", |
2d7cd868 JA |
1642 | .type = FIO_OPT_STR_VAL, |
1643 | .off1 = td_var_offset(offset_increment), | |
1644 | .help = "What is the increment from one offset to the next", | |
1645 | .parent = "offset", | |
d71c154c | 1646 | .hide = 1, |
2d7cd868 | 1647 | .def = "0", |
20eb06bd | 1648 | .interval = 1024 * 1024, |
e8b0e958 JA |
1649 | .category = FIO_OPT_C_IO, |
1650 | .group = FIO_OPT_G_INVALID, | |
2d7cd868 | 1651 | }, |
ddf24e42 JA |
1652 | { |
1653 | .name = "number_ios", | |
1654 | .lname = "Number of IOs to perform", | |
1655 | .type = FIO_OPT_STR_VAL, | |
1656 | .off1 = td_var_offset(number_ios), | |
1657 | .help = "Force job completion of this number of IOs", | |
1658 | .def = "0", | |
1659 | .category = FIO_OPT_C_IO, | |
1660 | .group = FIO_OPT_G_INVALID, | |
1661 | }, | |
214e1eca JA |
1662 | { |
1663 | .name = "bs", | |
e8b0e958 | 1664 | .lname = "Block size", |
d3aad8f2 | 1665 | .alias = "blocksize", |
e01b22b8 | 1666 | .type = FIO_OPT_INT, |
214e1eca JA |
1667 | .off1 = td_var_offset(bs[DDIR_READ]), |
1668 | .off2 = td_var_offset(bs[DDIR_WRITE]), | |
6eaf09d6 | 1669 | .off3 = td_var_offset(bs[DDIR_TRIM]), |
c3edbdba | 1670 | .minval = 1, |
214e1eca JA |
1671 | .help = "Block size unit", |
1672 | .def = "4k", | |
67a1000f | 1673 | .parent = "rw", |
d71c154c | 1674 | .hide = 1, |
20eb06bd | 1675 | .interval = 512, |
e8b0e958 JA |
1676 | .category = FIO_OPT_C_IO, |
1677 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1678 | }, |
2b7a01d0 JA |
1679 | { |
1680 | .name = "ba", | |
e8b0e958 | 1681 | .lname = "Block size align", |
2b7a01d0 | 1682 | .alias = "blockalign", |
e01b22b8 | 1683 | .type = FIO_OPT_INT, |
2b7a01d0 JA |
1684 | .off1 = td_var_offset(ba[DDIR_READ]), |
1685 | .off2 = td_var_offset(ba[DDIR_WRITE]), | |
6eaf09d6 | 1686 | .off3 = td_var_offset(ba[DDIR_TRIM]), |
2b7a01d0 JA |
1687 | .minval = 1, |
1688 | .help = "IO block offset alignment", | |
1689 | .parent = "rw", | |
d71c154c | 1690 | .hide = 1, |
20eb06bd | 1691 | .interval = 512, |
e8b0e958 JA |
1692 | .category = FIO_OPT_C_IO, |
1693 | .group = FIO_OPT_G_INVALID, | |
2b7a01d0 | 1694 | }, |
214e1eca JA |
1695 | { |
1696 | .name = "bsrange", | |
e8b0e958 | 1697 | .lname = "Block size range", |
d3aad8f2 | 1698 | .alias = "blocksize_range", |
214e1eca JA |
1699 | .type = FIO_OPT_RANGE, |
1700 | .off1 = td_var_offset(min_bs[DDIR_READ]), | |
1701 | .off2 = td_var_offset(max_bs[DDIR_READ]), | |
1702 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), | |
1703 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), | |
6eaf09d6 SL |
1704 | .off5 = td_var_offset(min_bs[DDIR_TRIM]), |
1705 | .off6 = td_var_offset(max_bs[DDIR_TRIM]), | |
c3edbdba | 1706 | .minval = 1, |
214e1eca | 1707 | .help = "Set block size range (in more detail than bs)", |
67a1000f | 1708 | .parent = "rw", |
d71c154c | 1709 | .hide = 1, |
20eb06bd | 1710 | .interval = 4096, |
e8b0e958 JA |
1711 | .category = FIO_OPT_C_IO, |
1712 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1713 | }, |
564ca972 JA |
1714 | { |
1715 | .name = "bssplit", | |
e8b0e958 | 1716 | .lname = "Block size split", |
564ca972 JA |
1717 | .type = FIO_OPT_STR, |
1718 | .cb = str_bssplit_cb, | |
1719 | .help = "Set a specific mix of block sizes", | |
1720 | .parent = "rw", | |
d71c154c | 1721 | .hide = 1, |
e8b0e958 JA |
1722 | .category = FIO_OPT_C_IO, |
1723 | .group = FIO_OPT_G_INVALID, | |
564ca972 | 1724 | }, |
214e1eca JA |
1725 | { |
1726 | .name = "bs_unaligned", | |
e8b0e958 | 1727 | .lname = "Block size unaligned", |
d3aad8f2 | 1728 | .alias = "blocksize_unaligned", |
214e1eca JA |
1729 | .type = FIO_OPT_STR_SET, |
1730 | .off1 = td_var_offset(bs_unaligned), | |
1731 | .help = "Don't sector align IO buffer sizes", | |
67a1000f | 1732 | .parent = "rw", |
d71c154c | 1733 | .hide = 1, |
e8b0e958 JA |
1734 | .category = FIO_OPT_C_IO, |
1735 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1736 | }, |
6aca9b3d JA |
1737 | { |
1738 | .name = "bs_is_seq_rand", | |
1739 | .lname = "Block size division is seq/random (not read/write)", | |
1740 | .type = FIO_OPT_BOOL, | |
1741 | .off1 = td_var_offset(bs_is_seq_rand), | |
1742 | .help = "Consider any blocksize setting to be sequential,ramdom", | |
1743 | .def = "0", | |
1744 | .parent = "blocksize", | |
1745 | .category = FIO_OPT_C_IO, | |
1746 | .group = FIO_OPT_G_INVALID, | |
1747 | }, | |
214e1eca JA |
1748 | { |
1749 | .name = "randrepeat", | |
e8b0e958 | 1750 | .lname = "Random repeatable", |
214e1eca JA |
1751 | .type = FIO_OPT_BOOL, |
1752 | .off1 = td_var_offset(rand_repeatable), | |
1753 | .help = "Use repeatable random IO pattern", | |
1754 | .def = "1", | |
67a1000f | 1755 | .parent = "rw", |
d71c154c | 1756 | .hide = 1, |
e8b0e958 | 1757 | .category = FIO_OPT_C_IO, |
3ceb458f | 1758 | .group = FIO_OPT_G_RANDOM, |
214e1eca | 1759 | }, |
04778baf JA |
1760 | { |
1761 | .name = "randseed", | |
1762 | .lname = "The random generator seed", | |
363cffa7 | 1763 | .type = FIO_OPT_STR_VAL, |
04778baf JA |
1764 | .off1 = td_var_offset(rand_seed), |
1765 | .help = "Set the random generator seed value", | |
1766 | .parent = "rw", | |
1767 | .category = FIO_OPT_C_IO, | |
1768 | .group = FIO_OPT_G_RANDOM, | |
1769 | }, | |
2615cc4b JA |
1770 | { |
1771 | .name = "use_os_rand", | |
e8b0e958 | 1772 | .lname = "Use OS random", |
2615cc4b JA |
1773 | .type = FIO_OPT_BOOL, |
1774 | .off1 = td_var_offset(use_os_rand), | |
1775 | .help = "Set to use OS random generator", | |
1776 | .def = "0", | |
1777 | .parent = "rw", | |
d71c154c | 1778 | .hide = 1, |
e8b0e958 | 1779 | .category = FIO_OPT_C_IO, |
3ceb458f | 1780 | .group = FIO_OPT_G_RANDOM, |
2615cc4b | 1781 | }, |
214e1eca JA |
1782 | { |
1783 | .name = "norandommap", | |
e8b0e958 | 1784 | .lname = "No randommap", |
214e1eca JA |
1785 | .type = FIO_OPT_STR_SET, |
1786 | .off1 = td_var_offset(norandommap), | |
1787 | .help = "Accept potential duplicate random blocks", | |
67a1000f | 1788 | .parent = "rw", |
d71c154c | 1789 | .hide = 1, |
b2452a43 | 1790 | .hide_on_set = 1, |
e8b0e958 | 1791 | .category = FIO_OPT_C_IO, |
3ceb458f | 1792 | .group = FIO_OPT_G_RANDOM, |
214e1eca | 1793 | }, |
2b386d25 JA |
1794 | { |
1795 | .name = "softrandommap", | |
e8b0e958 | 1796 | .lname = "Soft randommap", |
2b386d25 JA |
1797 | .type = FIO_OPT_BOOL, |
1798 | .off1 = td_var_offset(softrandommap), | |
f66ab3c8 | 1799 | .help = "Set norandommap if randommap allocation fails", |
2b386d25 | 1800 | .parent = "norandommap", |
d71c154c | 1801 | .hide = 1, |
2b386d25 | 1802 | .def = "0", |
e8b0e958 | 1803 | .category = FIO_OPT_C_IO, |
3ceb458f | 1804 | .group = FIO_OPT_G_RANDOM, |
2b386d25 | 1805 | }, |
8055e41d JA |
1806 | { |
1807 | .name = "random_generator", | |
1808 | .type = FIO_OPT_STR, | |
1809 | .off1 = td_var_offset(random_generator), | |
1810 | .help = "Type of random number generator to use", | |
1811 | .def = "tausworthe", | |
1812 | .posval = { | |
1813 | { .ival = "tausworthe", | |
1814 | .oval = FIO_RAND_GEN_TAUSWORTHE, | |
1815 | .help = "Strong Tausworthe generator", | |
1816 | }, | |
1817 | { .ival = "lfsr", | |
1818 | .oval = FIO_RAND_GEN_LFSR, | |
1819 | .help = "Variable length LFSR", | |
1820 | }, | |
1821 | }, | |
48107598 JA |
1822 | .category = FIO_OPT_C_IO, |
1823 | .group = FIO_OPT_G_RANDOM, | |
8055e41d | 1824 | }, |
e25839d4 JA |
1825 | { |
1826 | .name = "random_distribution", | |
1827 | .type = FIO_OPT_STR, | |
1828 | .off1 = td_var_offset(random_distribution), | |
1829 | .cb = str_random_distribution_cb, | |
1830 | .help = "Random offset distribution generator", | |
1831 | .def = "random", | |
1832 | .posval = { | |
1833 | { .ival = "random", | |
1834 | .oval = FIO_RAND_DIST_RANDOM, | |
1835 | .help = "Completely random", | |
1836 | }, | |
1837 | { .ival = "zipf", | |
1838 | .oval = FIO_RAND_DIST_ZIPF, | |
1839 | .help = "Zipf distribution", | |
1840 | }, | |
925fee33 JA |
1841 | { .ival = "pareto", |
1842 | .oval = FIO_RAND_DIST_PARETO, | |
1843 | .help = "Pareto distribution", | |
1844 | }, | |
e25839d4 | 1845 | }, |
48107598 JA |
1846 | .category = FIO_OPT_C_IO, |
1847 | .group = FIO_OPT_G_RANDOM, | |
e25839d4 | 1848 | }, |
211c9b89 JA |
1849 | { |
1850 | .name = "percentage_random", | |
1851 | .lname = "Percentage Random", | |
1852 | .type = FIO_OPT_INT, | |
d9472271 JA |
1853 | .off1 = td_var_offset(perc_rand[DDIR_READ]), |
1854 | .off2 = td_var_offset(perc_rand[DDIR_WRITE]), | |
1855 | .off3 = td_var_offset(perc_rand[DDIR_TRIM]), | |
211c9b89 JA |
1856 | .maxval = 100, |
1857 | .help = "Percentage of seq/random mix that should be random", | |
d9472271 | 1858 | .def = "100,100,100", |
211c9b89 JA |
1859 | .interval = 5, |
1860 | .inverse = "percentage_sequential", | |
1861 | .category = FIO_OPT_C_IO, | |
1862 | .group = FIO_OPT_G_RANDOM, | |
1863 | }, | |
1864 | { | |
1865 | .name = "percentage_sequential", | |
1866 | .lname = "Percentage Sequential", | |
d9472271 | 1867 | .type = FIO_OPT_DEPRECATED, |
211c9b89 JA |
1868 | .category = FIO_OPT_C_IO, |
1869 | .group = FIO_OPT_G_RANDOM, | |
1870 | }, | |
56e2a5fc CE |
1871 | { |
1872 | .name = "allrandrepeat", | |
1873 | .type = FIO_OPT_BOOL, | |
1874 | .off1 = td_var_offset(allrand_repeatable), | |
1875 | .help = "Use repeatable random numbers for everything", | |
1876 | .def = "0", | |
a869d9c6 JA |
1877 | .category = FIO_OPT_C_IO, |
1878 | .group = FIO_OPT_G_RANDOM, | |
56e2a5fc | 1879 | }, |
214e1eca JA |
1880 | { |
1881 | .name = "nrfiles", | |
e8b0e958 | 1882 | .lname = "Number of files", |
d7c8be03 | 1883 | .alias = "nr_files", |
214e1eca JA |
1884 | .type = FIO_OPT_INT, |
1885 | .off1 = td_var_offset(nr_files), | |
1886 | .help = "Split job workload between this number of files", | |
1887 | .def = "1", | |
20eb06bd | 1888 | .interval = 1, |
e8b0e958 JA |
1889 | .category = FIO_OPT_C_FILE, |
1890 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1891 | }, |
1892 | { | |
1893 | .name = "openfiles", | |
e8b0e958 | 1894 | .lname = "Number of open files", |
214e1eca JA |
1895 | .type = FIO_OPT_INT, |
1896 | .off1 = td_var_offset(open_files), | |
1897 | .help = "Number of files to keep open at the same time", | |
e8b0e958 JA |
1898 | .category = FIO_OPT_C_FILE, |
1899 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1900 | }, |
1901 | { | |
1902 | .name = "file_service_type", | |
e8b0e958 | 1903 | .lname = "File service type", |
214e1eca JA |
1904 | .type = FIO_OPT_STR, |
1905 | .cb = str_fst_cb, | |
1906 | .off1 = td_var_offset(file_service_type), | |
1907 | .help = "How to select which file to service next", | |
1908 | .def = "roundrobin", | |
e8b0e958 JA |
1909 | .category = FIO_OPT_C_FILE, |
1910 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1911 | .posval = { |
1912 | { .ival = "random", | |
1913 | .oval = FIO_FSERVICE_RANDOM, | |
1914 | .help = "Choose a file at random", | |
1915 | }, | |
1916 | { .ival = "roundrobin", | |
1917 | .oval = FIO_FSERVICE_RR, | |
1918 | .help = "Round robin select files", | |
1919 | }, | |
a086c257 JA |
1920 | { .ival = "sequential", |
1921 | .oval = FIO_FSERVICE_SEQ, | |
1922 | .help = "Finish one file before moving to the next", | |
1923 | }, | |
214e1eca | 1924 | }, |
67a1000f | 1925 | .parent = "nrfiles", |
d71c154c | 1926 | .hide = 1, |
67a1000f | 1927 | }, |
97ac992c | 1928 | #ifdef CONFIG_POSIX_FALLOCATE |
7bc8c2cf JA |
1929 | { |
1930 | .name = "fallocate", | |
e8b0e958 | 1931 | .lname = "Fallocate", |
a596f047 EG |
1932 | .type = FIO_OPT_STR, |
1933 | .off1 = td_var_offset(fallocate_mode), | |
1934 | .help = "Whether pre-allocation is performed when laying out files", | |
1935 | .def = "posix", | |
e8b0e958 JA |
1936 | .category = FIO_OPT_C_FILE, |
1937 | .group = FIO_OPT_G_INVALID, | |
a596f047 EG |
1938 | .posval = { |
1939 | { .ival = "none", | |
1940 | .oval = FIO_FALLOCATE_NONE, | |
1941 | .help = "Do not pre-allocate space", | |
1942 | }, | |
1943 | { .ival = "posix", | |
1944 | .oval = FIO_FALLOCATE_POSIX, | |
1945 | .help = "Use posix_fallocate()", | |
1946 | }, | |
97ac992c | 1947 | #ifdef CONFIG_LINUX_FALLOCATE |
a596f047 EG |
1948 | { .ival = "keep", |
1949 | .oval = FIO_FALLOCATE_KEEP_SIZE, | |
1950 | .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)", | |
1951 | }, | |
7bc8c2cf | 1952 | #endif |
a596f047 EG |
1953 | /* Compatibility with former boolean values */ |
1954 | { .ival = "0", | |
1955 | .oval = FIO_FALLOCATE_NONE, | |
1956 | .help = "Alias for 'none'", | |
1957 | }, | |
1958 | { .ival = "1", | |
1959 | .oval = FIO_FALLOCATE_POSIX, | |
1960 | .help = "Alias for 'posix'", | |
1961 | }, | |
1962 | }, | |
1963 | }, | |
97ac992c | 1964 | #endif /* CONFIG_POSIX_FALLOCATE */ |
67a1000f JA |
1965 | { |
1966 | .name = "fadvise_hint", | |
e8b0e958 | 1967 | .lname = "Fadvise hint", |
67a1000f JA |
1968 | .type = FIO_OPT_BOOL, |
1969 | .off1 = td_var_offset(fadvise_hint), | |
1970 | .help = "Use fadvise() to advise the kernel on IO pattern", | |
1971 | .def = "1", | |
e8b0e958 JA |
1972 | .category = FIO_OPT_C_FILE, |
1973 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
1974 | }, |
1975 | { | |
1976 | .name = "fsync", | |
e8b0e958 | 1977 | .lname = "Fsync", |
214e1eca JA |
1978 | .type = FIO_OPT_INT, |
1979 | .off1 = td_var_offset(fsync_blocks), | |
1980 | .help = "Issue fsync for writes every given number of blocks", | |
1981 | .def = "0", | |
20eb06bd | 1982 | .interval = 1, |
e8b0e958 JA |
1983 | .category = FIO_OPT_C_FILE, |
1984 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 1985 | }, |
5f9099ea JA |
1986 | { |
1987 | .name = "fdatasync", | |
e8b0e958 | 1988 | .lname = "Fdatasync", |
5f9099ea JA |
1989 | .type = FIO_OPT_INT, |
1990 | .off1 = td_var_offset(fdatasync_blocks), | |
1991 | .help = "Issue fdatasync for writes every given number of blocks", | |
1992 | .def = "0", | |
20eb06bd | 1993 | .interval = 1, |
e8b0e958 JA |
1994 | .category = FIO_OPT_C_FILE, |
1995 | .group = FIO_OPT_G_INVALID, | |
5f9099ea | 1996 | }, |
1ef2b6be JA |
1997 | { |
1998 | .name = "write_barrier", | |
e8b0e958 | 1999 | .lname = "Write barrier", |
1ef2b6be JA |
2000 | .type = FIO_OPT_INT, |
2001 | .off1 = td_var_offset(barrier_blocks), | |
2002 | .help = "Make every Nth write a barrier write", | |
2003 | .def = "0", | |
20eb06bd | 2004 | .interval = 1, |
e8b0e958 JA |
2005 | .category = FIO_OPT_C_IO, |
2006 | .group = FIO_OPT_G_INVALID, | |
1ef2b6be | 2007 | }, |
67bf9823 | 2008 | #ifdef CONFIG_SYNC_FILE_RANGE |
44f29692 JA |
2009 | { |
2010 | .name = "sync_file_range", | |
e8b0e958 | 2011 | .lname = "Sync file range", |
44f29692 JA |
2012 | .posval = { |
2013 | { .ival = "wait_before", | |
2014 | .oval = SYNC_FILE_RANGE_WAIT_BEFORE, | |
2015 | .help = "SYNC_FILE_RANGE_WAIT_BEFORE", | |
ebadc0ce | 2016 | .orval = 1, |
44f29692 JA |
2017 | }, |
2018 | { .ival = "write", | |
2019 | .oval = SYNC_FILE_RANGE_WRITE, | |
2020 | .help = "SYNC_FILE_RANGE_WRITE", | |
ebadc0ce | 2021 | .orval = 1, |
44f29692 JA |
2022 | }, |
2023 | { | |
2024 | .ival = "wait_after", | |
2025 | .oval = SYNC_FILE_RANGE_WAIT_AFTER, | |
2026 | .help = "SYNC_FILE_RANGE_WAIT_AFTER", | |
ebadc0ce | 2027 | .orval = 1, |
44f29692 JA |
2028 | }, |
2029 | }, | |
3843deb3 | 2030 | .type = FIO_OPT_STR_MULTI, |
44f29692 JA |
2031 | .cb = str_sfr_cb, |
2032 | .off1 = td_var_offset(sync_file_range), | |
2033 | .help = "Use sync_file_range()", | |
e8b0e958 JA |
2034 | .category = FIO_OPT_C_FILE, |
2035 | .group = FIO_OPT_G_INVALID, | |
44f29692 JA |
2036 | }, |
2037 | #endif | |
214e1eca JA |
2038 | { |
2039 | .name = "direct", | |
e8b0e958 | 2040 | .lname = "Direct I/O", |
214e1eca JA |
2041 | .type = FIO_OPT_BOOL, |
2042 | .off1 = td_var_offset(odirect), | |
2043 | .help = "Use O_DIRECT IO (negates buffered)", | |
2044 | .def = "0", | |
a01a1bc5 | 2045 | .inverse = "buffered", |
e8b0e958 | 2046 | .category = FIO_OPT_C_IO, |
3ceb458f | 2047 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca | 2048 | }, |
d01612f3 CM |
2049 | { |
2050 | .name = "atomic", | |
2051 | .lname = "Atomic I/O", | |
2052 | .type = FIO_OPT_BOOL, | |
2053 | .off1 = td_var_offset(oatomic), | |
2054 | .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)", | |
2055 | .def = "0", | |
2056 | .category = FIO_OPT_C_IO, | |
2057 | .group = FIO_OPT_G_IO_TYPE, | |
2058 | }, | |
214e1eca JA |
2059 | { |
2060 | .name = "buffered", | |
e8b0e958 | 2061 | .lname = "Buffered I/O", |
214e1eca JA |
2062 | .type = FIO_OPT_BOOL, |
2063 | .off1 = td_var_offset(odirect), | |
2064 | .neg = 1, | |
2065 | .help = "Use buffered IO (negates direct)", | |
2066 | .def = "1", | |
a01a1bc5 | 2067 | .inverse = "direct", |
e8b0e958 | 2068 | .category = FIO_OPT_C_IO, |
3ceb458f | 2069 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
2070 | }, |
2071 | { | |
2072 | .name = "overwrite", | |
e8b0e958 | 2073 | .lname = "Overwrite", |
214e1eca JA |
2074 | .type = FIO_OPT_BOOL, |
2075 | .off1 = td_var_offset(overwrite), | |
2076 | .help = "When writing, set whether to overwrite current data", | |
2077 | .def = "0", | |
e8b0e958 JA |
2078 | .category = FIO_OPT_C_FILE, |
2079 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2080 | }, |
2081 | { | |
2082 | .name = "loops", | |
e8b0e958 | 2083 | .lname = "Loops", |
214e1eca JA |
2084 | .type = FIO_OPT_INT, |
2085 | .off1 = td_var_offset(loops), | |
2086 | .help = "Number of times to run the job", | |
2087 | .def = "1", | |
20eb06bd | 2088 | .interval = 1, |
e8b0e958 | 2089 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2090 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
2091 | }, |
2092 | { | |
2093 | .name = "numjobs", | |
e8b0e958 | 2094 | .lname = "Number of jobs", |
214e1eca JA |
2095 | .type = FIO_OPT_INT, |
2096 | .off1 = td_var_offset(numjobs), | |
2097 | .help = "Duplicate this job this many times", | |
2098 | .def = "1", | |
20eb06bd | 2099 | .interval = 1, |
e8b0e958 | 2100 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2101 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
2102 | }, |
2103 | { | |
2104 | .name = "startdelay", | |
e8b0e958 | 2105 | .lname = "Start delay", |
a5737c93 | 2106 | .type = FIO_OPT_STR_VAL_TIME, |
214e1eca | 2107 | .off1 = td_var_offset(start_delay), |
23ed19b0 | 2108 | .off2 = td_var_offset(start_delay_high), |
214e1eca JA |
2109 | .help = "Only start job when this period has passed", |
2110 | .def = "0", | |
0de5b26f | 2111 | .is_seconds = 1, |
e8b0e958 | 2112 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2113 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
2114 | }, |
2115 | { | |
2116 | .name = "runtime", | |
e8b0e958 | 2117 | .lname = "Runtime", |
214e1eca JA |
2118 | .alias = "timeout", |
2119 | .type = FIO_OPT_STR_VAL_TIME, | |
2120 | .off1 = td_var_offset(timeout), | |
2121 | .help = "Stop workload when this amount of time has passed", | |
2122 | .def = "0", | |
0de5b26f | 2123 | .is_seconds = 1, |
e8b0e958 | 2124 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2125 | .group = FIO_OPT_G_RUNTIME, |
214e1eca | 2126 | }, |
cf4464ca JA |
2127 | { |
2128 | .name = "time_based", | |
e8b0e958 | 2129 | .lname = "Time based", |
cf4464ca JA |
2130 | .type = FIO_OPT_STR_SET, |
2131 | .off1 = td_var_offset(time_based), | |
2132 | .help = "Keep running until runtime/timeout is met", | |
e8b0e958 | 2133 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2134 | .group = FIO_OPT_G_RUNTIME, |
cf4464ca | 2135 | }, |
62167762 JC |
2136 | { |
2137 | .name = "verify_only", | |
2138 | .lname = "Verify only", | |
2139 | .type = FIO_OPT_STR_SET, | |
2140 | .off1 = td_var_offset(verify_only), | |
2141 | .help = "Verifies previously written data is still valid", | |
2142 | .category = FIO_OPT_C_GENERAL, | |
2143 | .group = FIO_OPT_G_RUNTIME, | |
2144 | }, | |
721938ae JA |
2145 | { |
2146 | .name = "ramp_time", | |
e8b0e958 | 2147 | .lname = "Ramp time", |
721938ae JA |
2148 | .type = FIO_OPT_STR_VAL_TIME, |
2149 | .off1 = td_var_offset(ramp_time), | |
2150 | .help = "Ramp up time before measuring performance", | |
0de5b26f | 2151 | .is_seconds = 1, |
e8b0e958 | 2152 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2153 | .group = FIO_OPT_G_RUNTIME, |
721938ae | 2154 | }, |
c223da83 JA |
2155 | { |
2156 | .name = "clocksource", | |
e8b0e958 | 2157 | .lname = "Clock source", |
c223da83 JA |
2158 | .type = FIO_OPT_STR, |
2159 | .cb = fio_clock_source_cb, | |
2160 | .off1 = td_var_offset(clocksource), | |
2161 | .help = "What type of timing source to use", | |
e8b0e958 | 2162 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2163 | .group = FIO_OPT_G_CLOCK, |
c223da83 | 2164 | .posval = { |
67bf9823 | 2165 | #ifdef CONFIG_GETTIMEOFDAY |
c223da83 JA |
2166 | { .ival = "gettimeofday", |
2167 | .oval = CS_GTOD, | |
2168 | .help = "Use gettimeofday(2) for timing", | |
2169 | }, | |
67bf9823 JA |
2170 | #endif |
2171 | #ifdef CONFIG_CLOCK_GETTIME | |
c223da83 JA |
2172 | { .ival = "clock_gettime", |
2173 | .oval = CS_CGETTIME, | |
2174 | .help = "Use clock_gettime(2) for timing", | |
2175 | }, | |
67bf9823 | 2176 | #endif |
c223da83 JA |
2177 | #ifdef ARCH_HAVE_CPU_CLOCK |
2178 | { .ival = "cpu", | |
2179 | .oval = CS_CPUCLOCK, | |
2180 | .help = "Use CPU private clock", | |
2181 | }, | |
2182 | #endif | |
2183 | }, | |
2184 | }, | |
214e1eca JA |
2185 | { |
2186 | .name = "mem", | |
d3aad8f2 | 2187 | .alias = "iomem", |
e8b0e958 | 2188 | .lname = "I/O Memory", |
214e1eca JA |
2189 | .type = FIO_OPT_STR, |
2190 | .cb = str_mem_cb, | |
2191 | .off1 = td_var_offset(mem_type), | |
2192 | .help = "Backing type for IO buffers", | |
2193 | .def = "malloc", | |
e8b0e958 JA |
2194 | .category = FIO_OPT_C_IO, |
2195 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2196 | .posval = { |
2197 | { .ival = "malloc", | |
2198 | .oval = MEM_MALLOC, | |
2199 | .help = "Use malloc(3) for IO buffers", | |
2200 | }, | |
37c8cdfe JA |
2201 | { .ival = "shm", |
2202 | .oval = MEM_SHM, | |
2203 | .help = "Use shared memory segments for IO buffers", | |
2204 | }, | |
214e1eca JA |
2205 | #ifdef FIO_HAVE_HUGETLB |
2206 | { .ival = "shmhuge", | |
2207 | .oval = MEM_SHMHUGE, | |
2208 | .help = "Like shm, but use huge pages", | |
2209 | }, | |
b370e46a | 2210 | #endif |
37c8cdfe JA |
2211 | { .ival = "mmap", |
2212 | .oval = MEM_MMAP, | |
2213 | .help = "Use mmap(2) (file or anon) for IO buffers", | |
2214 | }, | |
214e1eca JA |
2215 | #ifdef FIO_HAVE_HUGETLB |
2216 | { .ival = "mmaphuge", | |
2217 | .oval = MEM_MMAPHUGE, | |
2218 | .help = "Like mmap, but use huge pages", | |
2219 | }, | |
2220 | #endif | |
2221 | }, | |
2222 | }, | |
d529ee19 JA |
2223 | { |
2224 | .name = "iomem_align", | |
2225 | .alias = "mem_align", | |
e8b0e958 | 2226 | .lname = "I/O memory alignment", |
d529ee19 JA |
2227 | .type = FIO_OPT_INT, |
2228 | .off1 = td_var_offset(mem_align), | |
2229 | .minval = 0, | |
2230 | .help = "IO memory buffer offset alignment", | |
2231 | .def = "0", | |
2232 | .parent = "iomem", | |
d71c154c | 2233 | .hide = 1, |
e8b0e958 JA |
2234 | .category = FIO_OPT_C_IO, |
2235 | .group = FIO_OPT_G_INVALID, | |
d529ee19 | 2236 | }, |
214e1eca JA |
2237 | { |
2238 | .name = "verify", | |
e8b0e958 | 2239 | .lname = "Verify", |
214e1eca JA |
2240 | .type = FIO_OPT_STR, |
2241 | .off1 = td_var_offset(verify), | |
2242 | .help = "Verify data written", | |
2243 | .def = "0", | |
e8b0e958 | 2244 | .category = FIO_OPT_C_IO, |
3ceb458f | 2245 | .group = FIO_OPT_G_VERIFY, |
214e1eca JA |
2246 | .posval = { |
2247 | { .ival = "0", | |
2248 | .oval = VERIFY_NONE, | |
2249 | .help = "Don't do IO verification", | |
2250 | }, | |
fcca4b58 JA |
2251 | { .ival = "md5", |
2252 | .oval = VERIFY_MD5, | |
2253 | .help = "Use md5 checksums for verification", | |
2254 | }, | |
d77a7af3 JA |
2255 | { .ival = "crc64", |
2256 | .oval = VERIFY_CRC64, | |
2257 | .help = "Use crc64 checksums for verification", | |
2258 | }, | |
214e1eca JA |
2259 | { .ival = "crc32", |
2260 | .oval = VERIFY_CRC32, | |
2261 | .help = "Use crc32 checksums for verification", | |
2262 | }, | |
af497e6a | 2263 | { .ival = "crc32c-intel", |
e3aaafc4 JA |
2264 | .oval = VERIFY_CRC32C, |
2265 | .help = "Use crc32c checksums for verification (hw assisted, if available)", | |
af497e6a | 2266 | }, |
bac39e0e JA |
2267 | { .ival = "crc32c", |
2268 | .oval = VERIFY_CRC32C, | |
e3aaafc4 | 2269 | .help = "Use crc32c checksums for verification (hw assisted, if available)", |
bac39e0e | 2270 | }, |
969f7ed3 JA |
2271 | { .ival = "crc16", |
2272 | .oval = VERIFY_CRC16, | |
2273 | .help = "Use crc16 checksums for verification", | |
2274 | }, | |
1e154bdb JA |
2275 | { .ival = "crc7", |
2276 | .oval = VERIFY_CRC7, | |
2277 | .help = "Use crc7 checksums for verification", | |
2278 | }, | |
7c353ceb JA |
2279 | { .ival = "sha1", |
2280 | .oval = VERIFY_SHA1, | |
2281 | .help = "Use sha1 checksums for verification", | |
2282 | }, | |
cd14cc10 JA |
2283 | { .ival = "sha256", |
2284 | .oval = VERIFY_SHA256, | |
2285 | .help = "Use sha256 checksums for verification", | |
2286 | }, | |
2287 | { .ival = "sha512", | |
2288 | .oval = VERIFY_SHA512, | |
2289 | .help = "Use sha512 checksums for verification", | |
2290 | }, | |
844ea602 JA |
2291 | { .ival = "xxhash", |
2292 | .oval = VERIFY_XXHASH, | |
2293 | .help = "Use xxhash checksums for verification", | |
2294 | }, | |
7437ee87 SL |
2295 | { .ival = "meta", |
2296 | .oval = VERIFY_META, | |
2297 | .help = "Use io information", | |
2298 | }, | |
36690c9b JA |
2299 | { |
2300 | .ival = "null", | |
2301 | .oval = VERIFY_NULL, | |
2302 | .help = "Pretend to verify", | |
2303 | }, | |
214e1eca JA |
2304 | }, |
2305 | }, | |
005c565a JA |
2306 | { |
2307 | .name = "do_verify", | |
e8b0e958 | 2308 | .lname = "Perform verify step", |
68e1f29a | 2309 | .type = FIO_OPT_BOOL, |
005c565a JA |
2310 | .off1 = td_var_offset(do_verify), |
2311 | .help = "Run verification stage after write", | |
2312 | .def = "1", | |
2313 | .parent = "verify", | |
d71c154c | 2314 | .hide = 1, |
e8b0e958 JA |
2315 | .category = FIO_OPT_C_IO, |
2316 | .group = FIO_OPT_G_VERIFY, | |
005c565a | 2317 | }, |
160b966d JA |
2318 | { |
2319 | .name = "verifysort", | |
e8b0e958 | 2320 | .lname = "Verify sort", |
160b966d JA |
2321 | .type = FIO_OPT_BOOL, |
2322 | .off1 = td_var_offset(verifysort), | |
2323 | .help = "Sort written verify blocks for read back", | |
2324 | .def = "1", | |
c83f2df1 | 2325 | .parent = "verify", |
d71c154c | 2326 | .hide = 1, |
e8b0e958 JA |
2327 | .category = FIO_OPT_C_IO, |
2328 | .group = FIO_OPT_G_VERIFY, | |
160b966d | 2329 | }, |
1ae83d45 JA |
2330 | { |
2331 | .name = "verifysort_nr", | |
2332 | .type = FIO_OPT_INT, | |
2333 | .off1 = td_var_offset(verifysort_nr), | |
2334 | .help = "Pre-load and sort verify blocks for a read workload", | |
2335 | .minval = 0, | |
2336 | .maxval = 131072, | |
2337 | .def = "1024", | |
2338 | .parent = "verify", | |
836fcc0f JA |
2339 | .category = FIO_OPT_C_IO, |
2340 | .group = FIO_OPT_G_VERIFY, | |
1ae83d45 | 2341 | }, |
3f9f4e26 | 2342 | { |
a59e170d | 2343 | .name = "verify_interval", |
e8b0e958 | 2344 | .lname = "Verify interval", |
e01b22b8 | 2345 | .type = FIO_OPT_INT, |
a59e170d | 2346 | .off1 = td_var_offset(verify_interval), |
819a9680 | 2347 | .minval = 2 * sizeof(struct verify_header), |
a59e170d | 2348 | .help = "Store verify buffer header every N bytes", |
afdf9352 | 2349 | .parent = "verify", |
d71c154c | 2350 | .hide = 1, |
20eb06bd | 2351 | .interval = 2 * sizeof(struct verify_header), |
e8b0e958 JA |
2352 | .category = FIO_OPT_C_IO, |
2353 | .group = FIO_OPT_G_VERIFY, | |
3f9f4e26 | 2354 | }, |
546a9142 | 2355 | { |
a59e170d | 2356 | .name = "verify_offset", |
e8b0e958 | 2357 | .lname = "Verify offset", |
e01b22b8 | 2358 | .type = FIO_OPT_INT, |
a59e170d | 2359 | .help = "Offset verify header location by N bytes", |
203160d5 JA |
2360 | .off1 = td_var_offset(verify_offset), |
2361 | .minval = sizeof(struct verify_header), | |
afdf9352 | 2362 | .parent = "verify", |
d71c154c | 2363 | .hide = 1, |
e8b0e958 JA |
2364 | .category = FIO_OPT_C_IO, |
2365 | .group = FIO_OPT_G_VERIFY, | |
546a9142 | 2366 | }, |
e28218f3 SL |
2367 | { |
2368 | .name = "verify_pattern", | |
e8b0e958 | 2369 | .lname = "Verify pattern", |
0e92f873 | 2370 | .type = FIO_OPT_STR, |
e28218f3 SL |
2371 | .cb = str_verify_pattern_cb, |
2372 | .help = "Fill pattern for IO buffers", | |
2373 | .parent = "verify", | |
d71c154c | 2374 | .hide = 1, |
e8b0e958 JA |
2375 | .category = FIO_OPT_C_IO, |
2376 | .group = FIO_OPT_G_VERIFY, | |
e28218f3 | 2377 | }, |
a12a3b4d JA |
2378 | { |
2379 | .name = "verify_fatal", | |
e8b0e958 | 2380 | .lname = "Verify fatal", |
68e1f29a | 2381 | .type = FIO_OPT_BOOL, |
a12a3b4d JA |
2382 | .off1 = td_var_offset(verify_fatal), |
2383 | .def = "0", | |
2384 | .help = "Exit on a single verify failure, don't continue", | |
2385 | .parent = "verify", | |
d71c154c | 2386 | .hide = 1, |
e8b0e958 JA |
2387 | .category = FIO_OPT_C_IO, |
2388 | .group = FIO_OPT_G_VERIFY, | |
a12a3b4d | 2389 | }, |
b463e936 JA |
2390 | { |
2391 | .name = "verify_dump", | |
e8b0e958 | 2392 | .lname = "Verify dump", |
b463e936 JA |
2393 | .type = FIO_OPT_BOOL, |
2394 | .off1 = td_var_offset(verify_dump), | |
ef71e317 | 2395 | .def = "0", |
b463e936 JA |
2396 | .help = "Dump contents of good and bad blocks on failure", |
2397 | .parent = "verify", | |
d71c154c | 2398 | .hide = 1, |
e8b0e958 JA |
2399 | .category = FIO_OPT_C_IO, |
2400 | .group = FIO_OPT_G_VERIFY, | |
b463e936 | 2401 | }, |
e8462bd8 JA |
2402 | { |
2403 | .name = "verify_async", | |
e8b0e958 | 2404 | .lname = "Verify asynchronously", |
e8462bd8 JA |
2405 | .type = FIO_OPT_INT, |
2406 | .off1 = td_var_offset(verify_async), | |
2407 | .def = "0", | |
2408 | .help = "Number of async verifier threads to use", | |
2409 | .parent = "verify", | |
d71c154c | 2410 | .hide = 1, |
e8b0e958 JA |
2411 | .category = FIO_OPT_C_IO, |
2412 | .group = FIO_OPT_G_VERIFY, | |
e8462bd8 | 2413 | }, |
9e144189 JA |
2414 | { |
2415 | .name = "verify_backlog", | |
e8b0e958 | 2416 | .lname = "Verify backlog", |
9e144189 JA |
2417 | .type = FIO_OPT_STR_VAL, |
2418 | .off1 = td_var_offset(verify_backlog), | |
2419 | .help = "Verify after this number of blocks are written", | |
2420 | .parent = "verify", | |
d71c154c | 2421 | .hide = 1, |
e8b0e958 JA |
2422 | .category = FIO_OPT_C_IO, |
2423 | .group = FIO_OPT_G_VERIFY, | |
9e144189 JA |
2424 | }, |
2425 | { | |
2426 | .name = "verify_backlog_batch", | |
e8b0e958 | 2427 | .lname = "Verify backlog batch", |
9e144189 JA |
2428 | .type = FIO_OPT_INT, |
2429 | .off1 = td_var_offset(verify_batch), | |
2430 | .help = "Verify this number of IO blocks", | |
0d29de83 | 2431 | .parent = "verify", |
d71c154c | 2432 | .hide = 1, |
e8b0e958 JA |
2433 | .category = FIO_OPT_C_IO, |
2434 | .group = FIO_OPT_G_VERIFY, | |
9e144189 | 2435 | }, |
e8462bd8 JA |
2436 | #ifdef FIO_HAVE_CPU_AFFINITY |
2437 | { | |
2438 | .name = "verify_async_cpus", | |
e8b0e958 | 2439 | .lname = "Async verify CPUs", |
e8462bd8 JA |
2440 | .type = FIO_OPT_STR, |
2441 | .cb = str_verify_cpus_allowed_cb, | |
2442 | .help = "Set CPUs allowed for async verify threads", | |
2443 | .parent = "verify_async", | |
d71c154c | 2444 | .hide = 1, |
e8b0e958 JA |
2445 | .category = FIO_OPT_C_IO, |
2446 | .group = FIO_OPT_G_VERIFY, | |
e8462bd8 | 2447 | }, |
0d29de83 | 2448 | #endif |
51aa2da8 JA |
2449 | { |
2450 | .name = "experimental_verify", | |
2451 | .off1 = td_var_offset(experimental_verify), | |
2452 | .type = FIO_OPT_BOOL, | |
b31eaac9 | 2453 | .help = "Enable experimental verification", |
836fcc0f JA |
2454 | .category = FIO_OPT_C_IO, |
2455 | .group = FIO_OPT_G_VERIFY, | |
51aa2da8 | 2456 | }, |
0d29de83 JA |
2457 | #ifdef FIO_HAVE_TRIM |
2458 | { | |
2459 | .name = "trim_percentage", | |
e8b0e958 | 2460 | .lname = "Trim percentage", |
0d29de83 | 2461 | .type = FIO_OPT_INT, |
203160d5 | 2462 | .off1 = td_var_offset(trim_percentage), |
20eb06bd | 2463 | .minval = 0, |
0d29de83 JA |
2464 | .maxval = 100, |
2465 | .help = "Number of verify blocks to discard/trim", | |
2466 | .parent = "verify", | |
2467 | .def = "0", | |
20eb06bd | 2468 | .interval = 1, |
d71c154c | 2469 | .hide = 1, |
e8b0e958 JA |
2470 | .category = FIO_OPT_C_IO, |
2471 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
2472 | }, |
2473 | { | |
2474 | .name = "trim_verify_zero", | |
e8b0e958 | 2475 | .lname = "Verify trim zero", |
20eb06bd | 2476 | .type = FIO_OPT_BOOL, |
0d29de83 JA |
2477 | .help = "Verify that trim/discarded blocks are returned as zeroes", |
2478 | .off1 = td_var_offset(trim_zero), | |
2479 | .parent = "trim_percentage", | |
d71c154c | 2480 | .hide = 1, |
0d29de83 | 2481 | .def = "1", |
e8b0e958 JA |
2482 | .category = FIO_OPT_C_IO, |
2483 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
2484 | }, |
2485 | { | |
2486 | .name = "trim_backlog", | |
e8b0e958 | 2487 | .lname = "Trim backlog", |
0d29de83 JA |
2488 | .type = FIO_OPT_STR_VAL, |
2489 | .off1 = td_var_offset(trim_backlog), | |
2490 | .help = "Trim after this number of blocks are written", | |
2491 | .parent = "trim_percentage", | |
d71c154c | 2492 | .hide = 1, |
20eb06bd | 2493 | .interval = 1, |
e8b0e958 JA |
2494 | .category = FIO_OPT_C_IO, |
2495 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
2496 | }, |
2497 | { | |
2498 | .name = "trim_backlog_batch", | |
e8b0e958 | 2499 | .lname = "Trim backlog batch", |
0d29de83 JA |
2500 | .type = FIO_OPT_INT, |
2501 | .off1 = td_var_offset(trim_batch), | |
2502 | .help = "Trim this number of IO blocks", | |
2503 | .parent = "trim_percentage", | |
d71c154c | 2504 | .hide = 1, |
20eb06bd | 2505 | .interval = 1, |
e8b0e958 JA |
2506 | .category = FIO_OPT_C_IO, |
2507 | .group = FIO_OPT_G_TRIM, | |
0d29de83 | 2508 | }, |
e8462bd8 | 2509 | #endif |
214e1eca JA |
2510 | { |
2511 | .name = "write_iolog", | |
e8b0e958 | 2512 | .lname = "Write I/O log", |
214e1eca JA |
2513 | .type = FIO_OPT_STR_STORE, |
2514 | .off1 = td_var_offset(write_iolog_file), | |
2515 | .help = "Store IO pattern to file", | |
e8b0e958 JA |
2516 | .category = FIO_OPT_C_IO, |
2517 | .group = FIO_OPT_G_IOLOG, | |
214e1eca JA |
2518 | }, |
2519 | { | |
2520 | .name = "read_iolog", | |
e8b0e958 | 2521 | .lname = "Read I/O log", |
214e1eca JA |
2522 | .type = FIO_OPT_STR_STORE, |
2523 | .off1 = td_var_offset(read_iolog_file), | |
2524 | .help = "Playback IO pattern from file", | |
e8b0e958 JA |
2525 | .category = FIO_OPT_C_IO, |
2526 | .group = FIO_OPT_G_IOLOG, | |
214e1eca | 2527 | }, |
64bbb865 DN |
2528 | { |
2529 | .name = "replay_no_stall", | |
e8b0e958 | 2530 | .lname = "Don't stall on replay", |
20eb06bd | 2531 | .type = FIO_OPT_BOOL, |
64bbb865 DN |
2532 | .off1 = td_var_offset(no_stall), |
2533 | .def = "0", | |
87e7a972 | 2534 | .parent = "read_iolog", |
d71c154c | 2535 | .hide = 1, |
64bbb865 | 2536 | .help = "Playback IO pattern file as fast as possible without stalls", |
e8b0e958 JA |
2537 | .category = FIO_OPT_C_IO, |
2538 | .group = FIO_OPT_G_IOLOG, | |
64bbb865 | 2539 | }, |
d1c46c04 DN |
2540 | { |
2541 | .name = "replay_redirect", | |
e8b0e958 | 2542 | .lname = "Redirect device for replay", |
d1c46c04 DN |
2543 | .type = FIO_OPT_STR_STORE, |
2544 | .off1 = td_var_offset(replay_redirect), | |
2545 | .parent = "read_iolog", | |
d71c154c | 2546 | .hide = 1, |
d1c46c04 | 2547 | .help = "Replay all I/O onto this device, regardless of trace device", |
e8b0e958 JA |
2548 | .category = FIO_OPT_C_IO, |
2549 | .group = FIO_OPT_G_IOLOG, | |
d1c46c04 | 2550 | }, |
214e1eca JA |
2551 | { |
2552 | .name = "exec_prerun", | |
e8b0e958 | 2553 | .lname = "Pre-execute runnable", |
214e1eca JA |
2554 | .type = FIO_OPT_STR_STORE, |
2555 | .off1 = td_var_offset(exec_prerun), | |
2556 | .help = "Execute this file prior to running job", | |
e8b0e958 JA |
2557 | .category = FIO_OPT_C_GENERAL, |
2558 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2559 | }, |
2560 | { | |
2561 | .name = "exec_postrun", | |
e8b0e958 | 2562 | .lname = "Post-execute runnable", |
214e1eca JA |
2563 | .type = FIO_OPT_STR_STORE, |
2564 | .off1 = td_var_offset(exec_postrun), | |
2565 | .help = "Execute this file after running job", | |
e8b0e958 JA |
2566 | .category = FIO_OPT_C_GENERAL, |
2567 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2568 | }, |
2569 | #ifdef FIO_HAVE_IOSCHED_SWITCH | |
2570 | { | |
2571 | .name = "ioscheduler", | |
e8b0e958 | 2572 | .lname = "I/O scheduler", |
214e1eca JA |
2573 | .type = FIO_OPT_STR_STORE, |
2574 | .off1 = td_var_offset(ioscheduler), | |
2575 | .help = "Use this IO scheduler on the backing device", | |
e8b0e958 JA |
2576 | .category = FIO_OPT_C_FILE, |
2577 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2578 | }, |
2579 | #endif | |
2580 | { | |
2581 | .name = "zonesize", | |
e8b0e958 | 2582 | .lname = "Zone size", |
214e1eca JA |
2583 | .type = FIO_OPT_STR_VAL, |
2584 | .off1 = td_var_offset(zone_size), | |
ed335855 SN |
2585 | .help = "Amount of data to read per zone", |
2586 | .def = "0", | |
20eb06bd | 2587 | .interval = 1024 * 1024, |
e8b0e958 JA |
2588 | .category = FIO_OPT_C_IO, |
2589 | .group = FIO_OPT_G_ZONE, | |
ed335855 SN |
2590 | }, |
2591 | { | |
2592 | .name = "zonerange", | |
e8b0e958 | 2593 | .lname = "Zone range", |
ed335855 SN |
2594 | .type = FIO_OPT_STR_VAL, |
2595 | .off1 = td_var_offset(zone_range), | |
214e1eca JA |
2596 | .help = "Give size of an IO zone", |
2597 | .def = "0", | |
20eb06bd | 2598 | .interval = 1024 * 1024, |
e8b0e958 JA |
2599 | .category = FIO_OPT_C_IO, |
2600 | .group = FIO_OPT_G_ZONE, | |
214e1eca JA |
2601 | }, |
2602 | { | |
2603 | .name = "zoneskip", | |
e8b0e958 | 2604 | .lname = "Zone skip", |
214e1eca JA |
2605 | .type = FIO_OPT_STR_VAL, |
2606 | .off1 = td_var_offset(zone_skip), | |
2607 | .help = "Space between IO zones", | |
2608 | .def = "0", | |
20eb06bd | 2609 | .interval = 1024 * 1024, |
e8b0e958 JA |
2610 | .category = FIO_OPT_C_IO, |
2611 | .group = FIO_OPT_G_ZONE, | |
214e1eca JA |
2612 | }, |
2613 | { | |
2614 | .name = "lockmem", | |
e8b0e958 | 2615 | .lname = "Lock memory", |
214e1eca | 2616 | .type = FIO_OPT_STR_VAL, |
1b79a070 | 2617 | .off1 = td_var_offset(lockmem), |
81c6b6cd | 2618 | .help = "Lock down this amount of memory (per worker)", |
214e1eca | 2619 | .def = "0", |
20eb06bd | 2620 | .interval = 1024 * 1024, |
e8b0e958 JA |
2621 | .category = FIO_OPT_C_GENERAL, |
2622 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2623 | }, |
214e1eca JA |
2624 | { |
2625 | .name = "rwmixread", | |
e8b0e958 | 2626 | .lname = "Read/write mix read", |
214e1eca | 2627 | .type = FIO_OPT_INT, |
cb499fc4 | 2628 | .cb = str_rwmix_read_cb, |
214e1eca JA |
2629 | .maxval = 100, |
2630 | .help = "Percentage of mixed workload that is reads", | |
2631 | .def = "50", | |
20eb06bd | 2632 | .interval = 5, |
90265353 | 2633 | .inverse = "rwmixwrite", |
e8b0e958 JA |
2634 | .category = FIO_OPT_C_IO, |
2635 | .group = FIO_OPT_G_RWMIX, | |
214e1eca JA |
2636 | }, |
2637 | { | |
2638 | .name = "rwmixwrite", | |
e8b0e958 | 2639 | .lname = "Read/write mix write", |
214e1eca | 2640 | .type = FIO_OPT_INT, |
cb499fc4 | 2641 | .cb = str_rwmix_write_cb, |
214e1eca JA |
2642 | .maxval = 100, |
2643 | .help = "Percentage of mixed workload that is writes", | |
2644 | .def = "50", | |
20eb06bd | 2645 | .interval = 5, |
90265353 | 2646 | .inverse = "rwmixread", |
e8b0e958 JA |
2647 | .category = FIO_OPT_C_IO, |
2648 | .group = FIO_OPT_G_RWMIX, | |
214e1eca | 2649 | }, |
afdf9352 JA |
2650 | { |
2651 | .name = "rwmixcycle", | |
e8b0e958 | 2652 | .lname = "Read/write mix cycle", |
15ca150e | 2653 | .type = FIO_OPT_DEPRECATED, |
e8b0e958 JA |
2654 | .category = FIO_OPT_C_IO, |
2655 | .group = FIO_OPT_G_RWMIX, | |
afdf9352 | 2656 | }, |
214e1eca JA |
2657 | { |
2658 | .name = "nice", | |
e8b0e958 | 2659 | .lname = "Nice", |
214e1eca JA |
2660 | .type = FIO_OPT_INT, |
2661 | .off1 = td_var_offset(nice), | |
2662 | .help = "Set job CPU nice value", | |
2663 | .minval = -19, | |
2664 | .maxval = 20, | |
2665 | .def = "0", | |
20eb06bd | 2666 | .interval = 1, |
e8b0e958 | 2667 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2668 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
2669 | }, |
2670 | #ifdef FIO_HAVE_IOPRIO | |
2671 | { | |
2672 | .name = "prio", | |
e8b0e958 | 2673 | .lname = "I/O nice priority", |
214e1eca | 2674 | .type = FIO_OPT_INT, |
28727df7 | 2675 | .off1 = td_var_offset(ioprio), |
214e1eca JA |
2676 | .help = "Set job IO priority value", |
2677 | .minval = 0, | |
2678 | .maxval = 7, | |
20eb06bd | 2679 | .interval = 1, |
e8b0e958 | 2680 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2681 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
2682 | }, |
2683 | { | |
2684 | .name = "prioclass", | |
e8b0e958 | 2685 | .lname = "I/O nice priority class", |
214e1eca | 2686 | .type = FIO_OPT_INT, |
28727df7 | 2687 | .off1 = td_var_offset(ioprio_class), |
214e1eca JA |
2688 | .help = "Set job IO priority class", |
2689 | .minval = 0, | |
2690 | .maxval = 3, | |
20eb06bd | 2691 | .interval = 1, |
e8b0e958 | 2692 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2693 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
2694 | }, |
2695 | #endif | |
2696 | { | |
2697 | .name = "thinktime", | |
e8b0e958 | 2698 | .lname = "Thinktime", |
214e1eca JA |
2699 | .type = FIO_OPT_INT, |
2700 | .off1 = td_var_offset(thinktime), | |
2701 | .help = "Idle time between IO buffers (usec)", | |
2702 | .def = "0", | |
e8b0e958 | 2703 | .category = FIO_OPT_C_IO, |
3ceb458f | 2704 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
2705 | }, |
2706 | { | |
2707 | .name = "thinktime_spin", | |
e8b0e958 | 2708 | .lname = "Thinktime spin", |
214e1eca JA |
2709 | .type = FIO_OPT_INT, |
2710 | .off1 = td_var_offset(thinktime_spin), | |
2711 | .help = "Start think time by spinning this amount (usec)", | |
2712 | .def = "0", | |
afdf9352 | 2713 | .parent = "thinktime", |
d71c154c | 2714 | .hide = 1, |
e8b0e958 | 2715 | .category = FIO_OPT_C_IO, |
3ceb458f | 2716 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
2717 | }, |
2718 | { | |
2719 | .name = "thinktime_blocks", | |
e8b0e958 | 2720 | .lname = "Thinktime blocks", |
214e1eca JA |
2721 | .type = FIO_OPT_INT, |
2722 | .off1 = td_var_offset(thinktime_blocks), | |
2723 | .help = "IO buffer period between 'thinktime'", | |
2724 | .def = "1", | |
afdf9352 | 2725 | .parent = "thinktime", |
d71c154c | 2726 | .hide = 1, |
e8b0e958 | 2727 | .category = FIO_OPT_C_IO, |
3ceb458f | 2728 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
2729 | }, |
2730 | { | |
2731 | .name = "rate", | |
e8b0e958 | 2732 | .lname = "I/O rate", |
e01b22b8 | 2733 | .type = FIO_OPT_INT, |
6eaf09d6 SL |
2734 | .off1 = td_var_offset(rate[DDIR_READ]), |
2735 | .off2 = td_var_offset(rate[DDIR_WRITE]), | |
2736 | .off3 = td_var_offset(rate[DDIR_TRIM]), | |
214e1eca | 2737 | .help = "Set bandwidth rate", |
e8b0e958 JA |
2738 | .category = FIO_OPT_C_IO, |
2739 | .group = FIO_OPT_G_RATE, | |
214e1eca JA |
2740 | }, |
2741 | { | |
2742 | .name = "ratemin", | |
e8b0e958 | 2743 | .lname = "I/O min rate", |
e01b22b8 | 2744 | .type = FIO_OPT_INT, |
6eaf09d6 SL |
2745 | .off1 = td_var_offset(ratemin[DDIR_READ]), |
2746 | .off2 = td_var_offset(ratemin[DDIR_WRITE]), | |
2747 | .off3 = td_var_offset(ratemin[DDIR_TRIM]), | |
4e991c23 | 2748 | .help = "Job must meet this rate or it will be shutdown", |
afdf9352 | 2749 | .parent = "rate", |
d71c154c | 2750 | .hide = 1, |
e8b0e958 JA |
2751 | .category = FIO_OPT_C_IO, |
2752 | .group = FIO_OPT_G_RATE, | |
4e991c23 JA |
2753 | }, |
2754 | { | |
2755 | .name = "rate_iops", | |
e8b0e958 | 2756 | .lname = "I/O rate IOPS", |
e01b22b8 | 2757 | .type = FIO_OPT_INT, |
6eaf09d6 SL |
2758 | .off1 = td_var_offset(rate_iops[DDIR_READ]), |
2759 | .off2 = td_var_offset(rate_iops[DDIR_WRITE]), | |
2760 | .off3 = td_var_offset(rate_iops[DDIR_TRIM]), | |
4e991c23 | 2761 | .help = "Limit IO used to this number of IO operations/sec", |
d71c154c | 2762 | .hide = 1, |
e8b0e958 JA |
2763 | .category = FIO_OPT_C_IO, |
2764 | .group = FIO_OPT_G_RATE, | |
4e991c23 JA |
2765 | }, |
2766 | { | |
2767 | .name = "rate_iops_min", | |
e8b0e958 | 2768 | .lname = "I/O min rate IOPS", |
e01b22b8 | 2769 | .type = FIO_OPT_INT, |
6eaf09d6 SL |
2770 | .off1 = td_var_offset(rate_iops_min[DDIR_READ]), |
2771 | .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]), | |
2772 | .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]), | |
03e20d68 | 2773 | .help = "Job must meet this rate or it will be shut down", |
afdf9352 | 2774 | .parent = "rate_iops", |
d71c154c | 2775 | .hide = 1, |
e8b0e958 JA |
2776 | .category = FIO_OPT_C_IO, |
2777 | .group = FIO_OPT_G_RATE, | |
214e1eca JA |
2778 | }, |
2779 | { | |
2780 | .name = "ratecycle", | |
e8b0e958 | 2781 | .lname = "I/O rate cycle", |
214e1eca JA |
2782 | .type = FIO_OPT_INT, |
2783 | .off1 = td_var_offset(ratecycle), | |
2784 | .help = "Window average for rate limits (msec)", | |
2785 | .def = "1000", | |
afdf9352 | 2786 | .parent = "rate", |
d71c154c | 2787 | .hide = 1, |
e8b0e958 JA |
2788 | .category = FIO_OPT_C_IO, |
2789 | .group = FIO_OPT_G_RATE, | |
214e1eca | 2790 | }, |
15501535 JA |
2791 | { |
2792 | .name = "max_latency", | |
2793 | .type = FIO_OPT_INT, | |
2794 | .off1 = td_var_offset(max_latency), | |
2795 | .help = "Maximum tolerated IO latency (usec)", | |
1e5324e7 | 2796 | .category = FIO_OPT_C_IO, |
3e260a46 JA |
2797 | .group = FIO_OPT_G_LATPROF, |
2798 | }, | |
2799 | { | |
2800 | .name = "latency_target", | |
2801 | .lname = "Latency Target (usec)", | |
2802 | .type = FIO_OPT_STR_VAL_TIME, | |
2803 | .off1 = td_var_offset(latency_target), | |
2804 | .help = "Ramp to max queue depth supporting this latency", | |
2805 | .category = FIO_OPT_C_IO, | |
2806 | .group = FIO_OPT_G_LATPROF, | |
2807 | }, | |
2808 | { | |
2809 | .name = "latency_window", | |
2810 | .lname = "Latency Window (usec)", | |
2811 | .type = FIO_OPT_STR_VAL_TIME, | |
2812 | .off1 = td_var_offset(latency_window), | |
2813 | .help = "Time to sustain latency_target", | |
2814 | .category = FIO_OPT_C_IO, | |
2815 | .group = FIO_OPT_G_LATPROF, | |
2816 | }, | |
2817 | { | |
2818 | .name = "latency_percentile", | |
2819 | .lname = "Latency Percentile", | |
2820 | .type = FIO_OPT_FLOAT_LIST, | |
2821 | .off1 = td_var_offset(latency_percentile), | |
2822 | .help = "Percentile of IOs must be below latency_target", | |
2823 | .def = "100", | |
2824 | .maxlen = 1, | |
2825 | .minfp = 0.0, | |
2826 | .maxfp = 100.0, | |
2827 | .category = FIO_OPT_C_IO, | |
2828 | .group = FIO_OPT_G_LATPROF, | |
15501535 | 2829 | }, |
214e1eca JA |
2830 | { |
2831 | .name = "invalidate", | |
e8b0e958 | 2832 | .lname = "Cache invalidate", |
214e1eca JA |
2833 | .type = FIO_OPT_BOOL, |
2834 | .off1 = td_var_offset(invalidate_cache), | |
2835 | .help = "Invalidate buffer/page cache prior to running job", | |
2836 | .def = "1", | |
e8b0e958 | 2837 | .category = FIO_OPT_C_IO, |
3ceb458f | 2838 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
2839 | }, |
2840 | { | |
2841 | .name = "sync", | |
e8b0e958 | 2842 | .lname = "Synchronous I/O", |
214e1eca JA |
2843 | .type = FIO_OPT_BOOL, |
2844 | .off1 = td_var_offset(sync_io), | |
2845 | .help = "Use O_SYNC for buffered writes", | |
2846 | .def = "0", | |
67a1000f | 2847 | .parent = "buffered", |
d71c154c | 2848 | .hide = 1, |
e8b0e958 | 2849 | .category = FIO_OPT_C_IO, |
3ceb458f | 2850 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca | 2851 | }, |
214e1eca JA |
2852 | { |
2853 | .name = "create_serialize", | |
e8b0e958 | 2854 | .lname = "Create serialize", |
214e1eca JA |
2855 | .type = FIO_OPT_BOOL, |
2856 | .off1 = td_var_offset(create_serialize), | |
2857 | .help = "Serialize creating of job files", | |
2858 | .def = "1", | |
e8b0e958 JA |
2859 | .category = FIO_OPT_C_FILE, |
2860 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2861 | }, |
2862 | { | |
2863 | .name = "create_fsync", | |
e8b0e958 | 2864 | .lname = "Create fsync", |
214e1eca JA |
2865 | .type = FIO_OPT_BOOL, |
2866 | .off1 = td_var_offset(create_fsync), | |
03e20d68 | 2867 | .help = "fsync file after creation", |
214e1eca | 2868 | .def = "1", |
e8b0e958 JA |
2869 | .category = FIO_OPT_C_FILE, |
2870 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2871 | }, |
814452bd JA |
2872 | { |
2873 | .name = "create_on_open", | |
e8b0e958 | 2874 | .lname = "Create on open", |
814452bd JA |
2875 | .type = FIO_OPT_BOOL, |
2876 | .off1 = td_var_offset(create_on_open), | |
2877 | .help = "Create files when they are opened for IO", | |
2878 | .def = "0", | |
e8b0e958 JA |
2879 | .category = FIO_OPT_C_FILE, |
2880 | .group = FIO_OPT_G_INVALID, | |
814452bd | 2881 | }, |
25460cf6 JA |
2882 | { |
2883 | .name = "create_only", | |
2884 | .type = FIO_OPT_BOOL, | |
2885 | .off1 = td_var_offset(create_only), | |
2886 | .help = "Only perform file creation phase", | |
d17fda71 | 2887 | .category = FIO_OPT_C_FILE, |
25460cf6 JA |
2888 | .def = "0", |
2889 | }, | |
0b9d69ec | 2890 | { |
afad68f7 | 2891 | .name = "pre_read", |
e8b0e958 | 2892 | .lname = "Pre-read files", |
afad68f7 ZY |
2893 | .type = FIO_OPT_BOOL, |
2894 | .off1 = td_var_offset(pre_read), | |
03e20d68 | 2895 | .help = "Pre-read files before starting official testing", |
afad68f7 | 2896 | .def = "0", |
e8b0e958 JA |
2897 | .category = FIO_OPT_C_FILE, |
2898 | .group = FIO_OPT_G_INVALID, | |
afad68f7 | 2899 | }, |
214e1eca JA |
2900 | #ifdef FIO_HAVE_CPU_AFFINITY |
2901 | { | |
2902 | .name = "cpumask", | |
e8b0e958 | 2903 | .lname = "CPU mask", |
214e1eca JA |
2904 | .type = FIO_OPT_INT, |
2905 | .cb = str_cpumask_cb, | |
2906 | .help = "CPU affinity mask", | |
e8b0e958 | 2907 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2908 | .group = FIO_OPT_G_CRED, |
214e1eca | 2909 | }, |
d2e268b0 JA |
2910 | { |
2911 | .name = "cpus_allowed", | |
e8b0e958 | 2912 | .lname = "CPUs allowed", |
d2e268b0 JA |
2913 | .type = FIO_OPT_STR, |
2914 | .cb = str_cpus_allowed_cb, | |
2915 | .help = "Set CPUs allowed", | |
e8b0e958 | 2916 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2917 | .group = FIO_OPT_G_CRED, |
d2e268b0 | 2918 | }, |
c2acfbac JA |
2919 | { |
2920 | .name = "cpus_allowed_policy", | |
2921 | .lname = "CPUs allowed distribution policy", | |
2922 | .type = FIO_OPT_STR, | |
2923 | .off1 = td_var_offset(cpus_allowed_policy), | |
2924 | .help = "Distribution policy for cpus_allowed", | |
2925 | .parent = "cpus_allowed", | |
2926 | .prio = 1, | |
2927 | .posval = { | |
2928 | { .ival = "shared", | |
2929 | .oval = FIO_CPUS_SHARED, | |
2930 | .help = "Mask shared between threads", | |
2931 | }, | |
2932 | { .ival = "split", | |
2933 | .oval = FIO_CPUS_SPLIT, | |
2934 | .help = "Mask split between threads", | |
2935 | }, | |
2936 | }, | |
2937 | .category = FIO_OPT_C_GENERAL, | |
2938 | .group = FIO_OPT_G_CRED, | |
2939 | }, | |
d0b937ed | 2940 | #endif |
67bf9823 | 2941 | #ifdef CONFIG_LIBNUMA |
d0b937ed YR |
2942 | { |
2943 | .name = "numa_cpu_nodes", | |
2944 | .type = FIO_OPT_STR, | |
2945 | .cb = str_numa_cpunodes_cb, | |
2946 | .help = "NUMA CPU nodes bind", | |
6be54b2d JA |
2947 | .category = FIO_OPT_C_GENERAL, |
2948 | .group = FIO_OPT_G_INVALID, | |
d0b937ed YR |
2949 | }, |
2950 | { | |
2951 | .name = "numa_mem_policy", | |
2952 | .type = FIO_OPT_STR, | |
2953 | .cb = str_numa_mpol_cb, | |
2954 | .help = "NUMA memory policy setup", | |
6be54b2d JA |
2955 | .category = FIO_OPT_C_GENERAL, |
2956 | .group = FIO_OPT_G_INVALID, | |
d0b937ed | 2957 | }, |
214e1eca JA |
2958 | #endif |
2959 | { | |
2960 | .name = "end_fsync", | |
e8b0e958 | 2961 | .lname = "End fsync", |
214e1eca JA |
2962 | .type = FIO_OPT_BOOL, |
2963 | .off1 = td_var_offset(end_fsync), | |
2964 | .help = "Include fsync at the end of job", | |
2965 | .def = "0", | |
e8b0e958 JA |
2966 | .category = FIO_OPT_C_FILE, |
2967 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2968 | }, |
2969 | { | |
2970 | .name = "fsync_on_close", | |
e8b0e958 | 2971 | .lname = "Fsync on close", |
214e1eca JA |
2972 | .type = FIO_OPT_BOOL, |
2973 | .off1 = td_var_offset(fsync_on_close), | |
2974 | .help = "fsync files on close", | |
2975 | .def = "0", | |
e8b0e958 JA |
2976 | .category = FIO_OPT_C_FILE, |
2977 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2978 | }, |
2979 | { | |
2980 | .name = "unlink", | |
e8b0e958 | 2981 | .lname = "Unlink file", |
214e1eca JA |
2982 | .type = FIO_OPT_BOOL, |
2983 | .off1 = td_var_offset(unlink), | |
2984 | .help = "Unlink created files after job has completed", | |
2985 | .def = "0", | |
e8b0e958 JA |
2986 | .category = FIO_OPT_C_FILE, |
2987 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2988 | }, |
2989 | { | |
2990 | .name = "exitall", | |
e8b0e958 | 2991 | .lname = "Exit-all on terminate", |
214e1eca JA |
2992 | .type = FIO_OPT_STR_SET, |
2993 | .cb = str_exitall_cb, | |
2994 | .help = "Terminate all jobs when one exits", | |
e8b0e958 | 2995 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2996 | .group = FIO_OPT_G_PROCESS, |
214e1eca JA |
2997 | }, |
2998 | { | |
2999 | .name = "stonewall", | |
e8b0e958 | 3000 | .lname = "Wait for previous", |
d392365e | 3001 | .alias = "wait_for_previous", |
214e1eca JA |
3002 | .type = FIO_OPT_STR_SET, |
3003 | .off1 = td_var_offset(stonewall), | |
3004 | .help = "Insert a hard barrier between this job and previous", | |
e8b0e958 | 3005 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 3006 | .group = FIO_OPT_G_PROCESS, |
214e1eca | 3007 | }, |
b3d62a75 JA |
3008 | { |
3009 | .name = "new_group", | |
e8b0e958 | 3010 | .lname = "New group", |
b3d62a75 JA |
3011 | .type = FIO_OPT_STR_SET, |
3012 | .off1 = td_var_offset(new_group), | |
3013 | .help = "Mark the start of a new group (for reporting)", | |
e8b0e958 | 3014 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 3015 | .group = FIO_OPT_G_PROCESS, |
b3d62a75 | 3016 | }, |
214e1eca JA |
3017 | { |
3018 | .name = "thread", | |
e8b0e958 | 3019 | .lname = "Thread", |
214e1eca JA |
3020 | .type = FIO_OPT_STR_SET, |
3021 | .off1 = td_var_offset(use_thread), | |
20eb06bd | 3022 | .help = "Use threads instead of processes", |
e8b0e958 | 3023 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 3024 | .group = FIO_OPT_G_PROCESS, |
214e1eca JA |
3025 | }, |
3026 | { | |
3027 | .name = "write_bw_log", | |
e8b0e958 | 3028 | .lname = "Write bandwidth log", |
203160d5 JA |
3029 | .type = FIO_OPT_STR_STORE, |
3030 | .off1 = td_var_offset(bw_log_file), | |
214e1eca | 3031 | .help = "Write log of bandwidth during run", |
e8b0e958 JA |
3032 | .category = FIO_OPT_C_LOG, |
3033 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
3034 | }, |
3035 | { | |
3036 | .name = "write_lat_log", | |
e8b0e958 | 3037 | .lname = "Write latency log", |
203160d5 JA |
3038 | .type = FIO_OPT_STR_STORE, |
3039 | .off1 = td_var_offset(lat_log_file), | |
214e1eca | 3040 | .help = "Write log of latency during run", |
e8b0e958 JA |
3041 | .category = FIO_OPT_C_LOG, |
3042 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 3043 | }, |
c8eeb9df JA |
3044 | { |
3045 | .name = "write_iops_log", | |
e8b0e958 | 3046 | .lname = "Write IOPS log", |
577c83bd | 3047 | .type = FIO_OPT_STR_STORE, |
203160d5 | 3048 | .off1 = td_var_offset(iops_log_file), |
c8eeb9df | 3049 | .help = "Write log of IOPS during run", |
e8b0e958 JA |
3050 | .category = FIO_OPT_C_LOG, |
3051 | .group = FIO_OPT_G_INVALID, | |
c8eeb9df | 3052 | }, |
b8bc8cba JA |
3053 | { |
3054 | .name = "log_avg_msec", | |
e8b0e958 | 3055 | .lname = "Log averaging (msec)", |
b8bc8cba JA |
3056 | .type = FIO_OPT_INT, |
3057 | .off1 = td_var_offset(log_avg_msec), | |
3058 | .help = "Average bw/iops/lat logs over this period of time", | |
3059 | .def = "0", | |
e8b0e958 JA |
3060 | .category = FIO_OPT_C_LOG, |
3061 | .group = FIO_OPT_G_INVALID, | |
b8bc8cba | 3062 | }, |
c504ee55 JA |
3063 | { |
3064 | .name = "bwavgtime", | |
3065 | .lname = "Bandwidth average time", | |
3066 | .type = FIO_OPT_INT, | |
3067 | .off1 = td_var_offset(bw_avg_time), | |
3068 | .help = "Time window over which to calculate bandwidth" | |
3069 | " (msec)", | |
3070 | .def = "500", | |
3071 | .parent = "write_bw_log", | |
3072 | .hide = 1, | |
3073 | .interval = 100, | |
3074 | .category = FIO_OPT_C_LOG, | |
3075 | .group = FIO_OPT_G_INVALID, | |
3076 | }, | |
3077 | { | |
3078 | .name = "iopsavgtime", | |
3079 | .lname = "IOPS average time", | |
3080 | .type = FIO_OPT_INT, | |
3081 | .off1 = td_var_offset(iops_avg_time), | |
3082 | .help = "Time window over which to calculate IOPS (msec)", | |
3083 | .def = "500", | |
3084 | .parent = "write_iops_log", | |
3085 | .hide = 1, | |
3086 | .interval = 100, | |
3087 | .category = FIO_OPT_C_LOG, | |
3088 | .group = FIO_OPT_G_INVALID, | |
3089 | }, | |
214e1eca JA |
3090 | { |
3091 | .name = "group_reporting", | |
e8b0e958 | 3092 | .lname = "Group reporting", |
d2507043 | 3093 | .type = FIO_OPT_STR_SET, |
214e1eca JA |
3094 | .off1 = td_var_offset(group_reporting), |
3095 | .help = "Do reporting on a per-group basis", | |
10860056 | 3096 | .category = FIO_OPT_C_STAT, |
e8b0e958 | 3097 | .group = FIO_OPT_G_INVALID, |
214e1eca | 3098 | }, |
e9459e5a JA |
3099 | { |
3100 | .name = "zero_buffers", | |
e8b0e958 | 3101 | .lname = "Zero I/O buffers", |
e9459e5a JA |
3102 | .type = FIO_OPT_STR_SET, |
3103 | .off1 = td_var_offset(zero_buffers), | |
3104 | .help = "Init IO buffers to all zeroes", | |
e8b0e958 | 3105 | .category = FIO_OPT_C_IO, |
3ceb458f | 3106 | .group = FIO_OPT_G_IO_BUF, |
e9459e5a | 3107 | }, |
5973cafb JA |
3108 | { |
3109 | .name = "refill_buffers", | |
e8b0e958 | 3110 | .lname = "Refill I/O buffers", |
5973cafb JA |
3111 | .type = FIO_OPT_STR_SET, |
3112 | .off1 = td_var_offset(refill_buffers), | |
3113 | .help = "Refill IO buffers on every IO submit", | |
e8b0e958 | 3114 | .category = FIO_OPT_C_IO, |
3ceb458f | 3115 | .group = FIO_OPT_G_IO_BUF, |
5973cafb | 3116 | }, |
fd68418e JA |
3117 | { |
3118 | .name = "scramble_buffers", | |
e8b0e958 | 3119 | .lname = "Scramble I/O buffers", |
fd68418e JA |
3120 | .type = FIO_OPT_BOOL, |
3121 | .off1 = td_var_offset(scramble_buffers), | |
3122 | .help = "Slightly scramble buffers on every IO submit", | |
3123 | .def = "1", | |
e8b0e958 | 3124 | .category = FIO_OPT_C_IO, |
3ceb458f | 3125 | .group = FIO_OPT_G_IO_BUF, |
fd68418e | 3126 | }, |
ce35b1ec JA |
3127 | { |
3128 | .name = "buffer_pattern", | |
3129 | .lname = "Buffer pattern", | |
3130 | .type = FIO_OPT_STR, | |
3131 | .cb = str_buffer_pattern_cb, | |
3132 | .help = "Fill pattern for IO buffers", | |
3133 | .category = FIO_OPT_C_IO, | |
3134 | .group = FIO_OPT_G_IO_BUF, | |
3135 | }, | |
9c42684e JA |
3136 | { |
3137 | .name = "buffer_compress_percentage", | |
e8b0e958 | 3138 | .lname = "Buffer compression percentage", |
9c42684e | 3139 | .type = FIO_OPT_INT, |
bedc9dc2 | 3140 | .cb = str_buffer_compress_cb, |
9c42684e | 3141 | .maxval = 100, |
e7f5de90 | 3142 | .minval = 0, |
9c42684e | 3143 | .help = "How compressible the buffer is (approximately)", |
20eb06bd | 3144 | .interval = 5, |
e8b0e958 | 3145 | .category = FIO_OPT_C_IO, |
3ceb458f | 3146 | .group = FIO_OPT_G_IO_BUF, |
9c42684e | 3147 | }, |
f97a43a1 JA |
3148 | { |
3149 | .name = "buffer_compress_chunk", | |
e8b0e958 | 3150 | .lname = "Buffer compression chunk size", |
f97a43a1 JA |
3151 | .type = FIO_OPT_INT, |
3152 | .off1 = td_var_offset(compress_chunk), | |
207b18e4 | 3153 | .parent = "buffer_compress_percentage", |
d71c154c | 3154 | .hide = 1, |
f97a43a1 | 3155 | .help = "Size of compressible region in buffer", |
20eb06bd | 3156 | .interval = 256, |
e8b0e958 | 3157 | .category = FIO_OPT_C_IO, |
3ceb458f | 3158 | .group = FIO_OPT_G_IO_BUF, |
f97a43a1 | 3159 | }, |
83349190 YH |
3160 | { |
3161 | .name = "clat_percentiles", | |
e8b0e958 | 3162 | .lname = "Completion latency percentiles", |
83349190 YH |
3163 | .type = FIO_OPT_BOOL, |
3164 | .off1 = td_var_offset(clat_percentiles), | |
3165 | .help = "Enable the reporting of completion latency percentiles", | |
467b35ed | 3166 | .def = "1", |
e8b0e958 JA |
3167 | .category = FIO_OPT_C_STAT, |
3168 | .group = FIO_OPT_G_INVALID, | |
83349190 YH |
3169 | }, |
3170 | { | |
3171 | .name = "percentile_list", | |
e8b0e958 | 3172 | .lname = "Completion latency percentile list", |
83349190 YH |
3173 | .type = FIO_OPT_FLOAT_LIST, |
3174 | .off1 = td_var_offset(percentile_list), | |
435d195a | 3175 | .off2 = td_var_offset(percentile_precision), |
83349190 | 3176 | .help = "Specify a custom list of percentiles to report", |
fd112d34 | 3177 | .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99", |
83349190 YH |
3178 | .maxlen = FIO_IO_U_LIST_MAX_LEN, |
3179 | .minfp = 0.0, | |
3180 | .maxfp = 100.0, | |
e8b0e958 JA |
3181 | .category = FIO_OPT_C_STAT, |
3182 | .group = FIO_OPT_G_INVALID, | |
83349190 YH |
3183 | }, |
3184 | ||
0a839f30 JA |
3185 | #ifdef FIO_HAVE_DISK_UTIL |
3186 | { | |
3187 | .name = "disk_util", | |
e8b0e958 | 3188 | .lname = "Disk utilization", |
0a839f30 JA |
3189 | .type = FIO_OPT_BOOL, |
3190 | .off1 = td_var_offset(do_disk_util), | |
f66ab3c8 | 3191 | .help = "Log disk utilization statistics", |
0a839f30 | 3192 | .def = "1", |
e8b0e958 JA |
3193 | .category = FIO_OPT_C_STAT, |
3194 | .group = FIO_OPT_G_INVALID, | |
0a839f30 JA |
3195 | }, |
3196 | #endif | |
993bf48b JA |
3197 | { |
3198 | .name = "gtod_reduce", | |
e8b0e958 | 3199 | .lname = "Reduce gettimeofday() calls", |
993bf48b JA |
3200 | .type = FIO_OPT_BOOL, |
3201 | .help = "Greatly reduce number of gettimeofday() calls", | |
3202 | .cb = str_gtod_reduce_cb, | |
3203 | .def = "0", | |
a4ed77fe | 3204 | .hide_on_set = 1, |
e8b0e958 JA |
3205 | .category = FIO_OPT_C_STAT, |
3206 | .group = FIO_OPT_G_INVALID, | |
993bf48b | 3207 | }, |
02af0988 JA |
3208 | { |
3209 | .name = "disable_lat", | |
e8b0e958 | 3210 | .lname = "Disable all latency stats", |
02af0988 JA |
3211 | .type = FIO_OPT_BOOL, |
3212 | .off1 = td_var_offset(disable_lat), | |
3213 | .help = "Disable latency numbers", | |
3214 | .parent = "gtod_reduce", | |
d71c154c | 3215 | .hide = 1, |
02af0988 | 3216 | .def = "0", |
e8b0e958 JA |
3217 | .category = FIO_OPT_C_STAT, |
3218 | .group = FIO_OPT_G_INVALID, | |
02af0988 | 3219 | }, |
9520ebb9 JA |
3220 | { |
3221 | .name = "disable_clat", | |
e8b0e958 | 3222 | .lname = "Disable completion latency stats", |
9520ebb9 JA |
3223 | .type = FIO_OPT_BOOL, |
3224 | .off1 = td_var_offset(disable_clat), | |
3225 | .help = "Disable completion latency numbers", | |
993bf48b | 3226 | .parent = "gtod_reduce", |
d71c154c | 3227 | .hide = 1, |
9520ebb9 | 3228 | .def = "0", |
e8b0e958 JA |
3229 | .category = FIO_OPT_C_STAT, |
3230 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 JA |
3231 | }, |
3232 | { | |
3233 | .name = "disable_slat", | |
e8b0e958 | 3234 | .lname = "Disable submission latency stats", |
9520ebb9 JA |
3235 | .type = FIO_OPT_BOOL, |
3236 | .off1 = td_var_offset(disable_slat), | |
03e20d68 | 3237 | .help = "Disable submission latency numbers", |
993bf48b | 3238 | .parent = "gtod_reduce", |
d71c154c | 3239 | .hide = 1, |
9520ebb9 | 3240 | .def = "0", |
e8b0e958 JA |
3241 | .category = FIO_OPT_C_STAT, |
3242 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 JA |
3243 | }, |
3244 | { | |
3245 | .name = "disable_bw_measurement", | |
e8b0e958 | 3246 | .lname = "Disable bandwidth stats", |
9520ebb9 JA |
3247 | .type = FIO_OPT_BOOL, |
3248 | .off1 = td_var_offset(disable_bw), | |
3249 | .help = "Disable bandwidth logging", | |
993bf48b | 3250 | .parent = "gtod_reduce", |
d71c154c | 3251 | .hide = 1, |
9520ebb9 | 3252 | .def = "0", |
e8b0e958 JA |
3253 | .category = FIO_OPT_C_STAT, |
3254 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 | 3255 | }, |
be4ecfdf JA |
3256 | { |
3257 | .name = "gtod_cpu", | |
e8b0e958 | 3258 | .lname = "Dedicated gettimeofday() CPU", |
be4ecfdf JA |
3259 | .type = FIO_OPT_INT, |
3260 | .cb = str_gtod_cpu_cb, | |
03e20d68 | 3261 | .help = "Set up dedicated gettimeofday() thread on this CPU", |
29d43ff9 | 3262 | .verify = gtod_cpu_verify, |
e8b0e958 | 3263 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3264 | .group = FIO_OPT_G_CLOCK, |
be4ecfdf | 3265 | }, |
771e58be JA |
3266 | { |
3267 | .name = "unified_rw_reporting", | |
3268 | .type = FIO_OPT_BOOL, | |
3269 | .off1 = td_var_offset(unified_rw_rep), | |
3270 | .help = "Unify reporting across data direction", | |
3271 | .def = "0", | |
90b7a96d JA |
3272 | .category = FIO_OPT_C_GENERAL, |
3273 | .group = FIO_OPT_G_INVALID, | |
771e58be | 3274 | }, |
f2bba182 RR |
3275 | { |
3276 | .name = "continue_on_error", | |
e8b0e958 | 3277 | .lname = "Continue on error", |
06842027 | 3278 | .type = FIO_OPT_STR, |
f2bba182 | 3279 | .off1 = td_var_offset(continue_on_error), |
03e20d68 | 3280 | .help = "Continue on non-fatal errors during IO", |
06842027 | 3281 | .def = "none", |
e8b0e958 | 3282 | .category = FIO_OPT_C_GENERAL, |
bc3f552f | 3283 | .group = FIO_OPT_G_ERR, |
06842027 SL |
3284 | .posval = { |
3285 | { .ival = "none", | |
3286 | .oval = ERROR_TYPE_NONE, | |
3287 | .help = "Exit when an error is encountered", | |
3288 | }, | |
3289 | { .ival = "read", | |
3290 | .oval = ERROR_TYPE_READ, | |
3291 | .help = "Continue on read errors only", | |
3292 | }, | |
3293 | { .ival = "write", | |
3294 | .oval = ERROR_TYPE_WRITE, | |
3295 | .help = "Continue on write errors only", | |
3296 | }, | |
3297 | { .ival = "io", | |
3298 | .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE, | |
3299 | .help = "Continue on any IO errors", | |
3300 | }, | |
3301 | { .ival = "verify", | |
3302 | .oval = ERROR_TYPE_VERIFY, | |
3303 | .help = "Continue on verify errors only", | |
3304 | }, | |
3305 | { .ival = "all", | |
3306 | .oval = ERROR_TYPE_ANY, | |
3307 | .help = "Continue on all io and verify errors", | |
3308 | }, | |
3309 | { .ival = "0", | |
3310 | .oval = ERROR_TYPE_NONE, | |
3311 | .help = "Alias for 'none'", | |
3312 | }, | |
3313 | { .ival = "1", | |
3314 | .oval = ERROR_TYPE_ANY, | |
3315 | .help = "Alias for 'all'", | |
3316 | }, | |
3317 | }, | |
f2bba182 | 3318 | }, |
8b28bd41 DM |
3319 | { |
3320 | .name = "ignore_error", | |
3321 | .type = FIO_OPT_STR, | |
3322 | .cb = str_ignore_error_cb, | |
3323 | .help = "Set a specific list of errors to ignore", | |
3324 | .parent = "rw", | |
a94eb99a | 3325 | .category = FIO_OPT_C_GENERAL, |
bc3f552f | 3326 | .group = FIO_OPT_G_ERR, |
8b28bd41 DM |
3327 | }, |
3328 | { | |
3329 | .name = "error_dump", | |
3330 | .type = FIO_OPT_BOOL, | |
3331 | .off1 = td_var_offset(error_dump), | |
3332 | .def = "0", | |
3333 | .help = "Dump info on each error", | |
a94eb99a | 3334 | .category = FIO_OPT_C_GENERAL, |
bc3f552f | 3335 | .group = FIO_OPT_G_ERR, |
8b28bd41 | 3336 | }, |
9ac8a797 JA |
3337 | { |
3338 | .name = "profile", | |
e8b0e958 | 3339 | .lname = "Profile", |
79d16311 | 3340 | .type = FIO_OPT_STR_STORE, |
9ac8a797 | 3341 | .off1 = td_var_offset(profile), |
9ac8a797 | 3342 | .help = "Select a specific builtin performance test", |
13fca827 | 3343 | .category = FIO_OPT_C_PROFILE, |
e8b0e958 | 3344 | .group = FIO_OPT_G_INVALID, |
9ac8a797 | 3345 | }, |
a696fa2a JA |
3346 | { |
3347 | .name = "cgroup", | |
e8b0e958 | 3348 | .lname = "Cgroup", |
a696fa2a JA |
3349 | .type = FIO_OPT_STR_STORE, |
3350 | .off1 = td_var_offset(cgroup), | |
3351 | .help = "Add job to cgroup of this name", | |
e8b0e958 | 3352 | .category = FIO_OPT_C_GENERAL, |
a1f6afec JA |
3353 | .group = FIO_OPT_G_CGROUP, |
3354 | }, | |
3355 | { | |
3356 | .name = "cgroup_nodelete", | |
3357 | .lname = "Cgroup no-delete", | |
3358 | .type = FIO_OPT_BOOL, | |
3359 | .off1 = td_var_offset(cgroup_nodelete), | |
3360 | .help = "Do not delete cgroups after job completion", | |
3361 | .def = "0", | |
3362 | .parent = "cgroup", | |
3363 | .category = FIO_OPT_C_GENERAL, | |
3364 | .group = FIO_OPT_G_CGROUP, | |
a696fa2a JA |
3365 | }, |
3366 | { | |
3367 | .name = "cgroup_weight", | |
e8b0e958 | 3368 | .lname = "Cgroup weight", |
a696fa2a JA |
3369 | .type = FIO_OPT_INT, |
3370 | .off1 = td_var_offset(cgroup_weight), | |
3371 | .help = "Use given weight for cgroup", | |
3372 | .minval = 100, | |
3373 | .maxval = 1000, | |
a1f6afec | 3374 | .parent = "cgroup", |
e8b0e958 | 3375 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 3376 | .group = FIO_OPT_G_CGROUP, |
7de87099 | 3377 | }, |
e0b0d892 JA |
3378 | { |
3379 | .name = "uid", | |
e8b0e958 | 3380 | .lname = "User ID", |
e0b0d892 JA |
3381 | .type = FIO_OPT_INT, |
3382 | .off1 = td_var_offset(uid), | |
3383 | .help = "Run job with this user ID", | |
e8b0e958 | 3384 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3385 | .group = FIO_OPT_G_CRED, |
e0b0d892 JA |
3386 | }, |
3387 | { | |
3388 | .name = "gid", | |
e8b0e958 | 3389 | .lname = "Group ID", |
e0b0d892 JA |
3390 | .type = FIO_OPT_INT, |
3391 | .off1 = td_var_offset(gid), | |
3392 | .help = "Run job with this group ID", | |
e8b0e958 | 3393 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3394 | .group = FIO_OPT_G_CRED, |
e0b0d892 | 3395 | }, |
a1f6afec JA |
3396 | { |
3397 | .name = "kb_base", | |
3398 | .lname = "KB Base", | |
3399 | .type = FIO_OPT_INT, | |
3400 | .off1 = td_var_offset(kb_base), | |
a1f6afec JA |
3401 | .prio = 1, |
3402 | .def = "1024", | |
ba9c7219 JA |
3403 | .posval = { |
3404 | { .ival = "1024", | |
3405 | .oval = 1024, | |
3406 | .help = "Use 1024 as the K base", | |
3407 | }, | |
3408 | { .ival = "1000", | |
3409 | .oval = 1000, | |
3410 | .help = "Use 1000 as the K base", | |
3411 | }, | |
3412 | }, | |
a1f6afec JA |
3413 | .help = "How many bytes per KB for reporting (1000 or 1024)", |
3414 | .category = FIO_OPT_C_GENERAL, | |
3415 | .group = FIO_OPT_G_INVALID, | |
3416 | }, | |
cf3a0518 JA |
3417 | { |
3418 | .name = "unit_base", | |
ba9c7219 | 3419 | .lname = "Base unit for reporting (Bits or Bytes)", |
cf3a0518 JA |
3420 | .type = FIO_OPT_INT, |
3421 | .off1 = td_var_offset(unit_base), | |
cf3a0518 | 3422 | .prio = 1, |
71a08258 JA |
3423 | .posval = { |
3424 | { .ival = "0", | |
3425 | .oval = 0, | |
3426 | .help = "Auto-detect", | |
3427 | }, | |
3428 | { .ival = "8", | |
3429 | .oval = 8, | |
3430 | .help = "Normal (byte based)", | |
3431 | }, | |
3432 | { .ival = "1", | |
3433 | .oval = 1, | |
3434 | .help = "Bit based", | |
3435 | }, | |
3436 | }, | |
cf3a0518 JA |
3437 | .help = "Bit multiple of result summary data (8 for byte, 1 for bit)", |
3438 | .category = FIO_OPT_C_GENERAL, | |
3439 | .group = FIO_OPT_G_INVALID, | |
3440 | }, | |
3ceb458f JA |
3441 | { |
3442 | .name = "hugepage-size", | |
3443 | .lname = "Hugepage size", | |
3444 | .type = FIO_OPT_INT, | |
3445 | .off1 = td_var_offset(hugepage_size), | |
3446 | .help = "When using hugepages, specify size of each page", | |
3447 | .def = __fio_stringify(FIO_HUGE_PAGE), | |
3448 | .interval = 1024 * 1024, | |
3449 | .category = FIO_OPT_C_GENERAL, | |
3450 | .group = FIO_OPT_G_INVALID, | |
3451 | }, | |
9e684a49 DE |
3452 | { |
3453 | .name = "flow_id", | |
e8b0e958 | 3454 | .lname = "I/O flow ID", |
9e684a49 DE |
3455 | .type = FIO_OPT_INT, |
3456 | .off1 = td_var_offset(flow_id), | |
3457 | .help = "The flow index ID to use", | |
3458 | .def = "0", | |
e8b0e958 JA |
3459 | .category = FIO_OPT_C_IO, |
3460 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
3461 | }, |
3462 | { | |
3463 | .name = "flow", | |
e8b0e958 | 3464 | .lname = "I/O flow weight", |
9e684a49 DE |
3465 | .type = FIO_OPT_INT, |
3466 | .off1 = td_var_offset(flow), | |
3467 | .help = "Weight for flow control of this job", | |
3468 | .parent = "flow_id", | |
d71c154c | 3469 | .hide = 1, |
9e684a49 | 3470 | .def = "0", |
e8b0e958 JA |
3471 | .category = FIO_OPT_C_IO, |
3472 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
3473 | }, |
3474 | { | |
3475 | .name = "flow_watermark", | |
e8b0e958 | 3476 | .lname = "I/O flow watermark", |
9e684a49 DE |
3477 | .type = FIO_OPT_INT, |
3478 | .off1 = td_var_offset(flow_watermark), | |
3479 | .help = "High watermark for flow control. This option" | |
3480 | " should be set to the same value for all threads" | |
3481 | " with non-zero flow.", | |
3482 | .parent = "flow_id", | |
d71c154c | 3483 | .hide = 1, |
9e684a49 | 3484 | .def = "1024", |
e8b0e958 JA |
3485 | .category = FIO_OPT_C_IO, |
3486 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
3487 | }, |
3488 | { | |
3489 | .name = "flow_sleep", | |
e8b0e958 | 3490 | .lname = "I/O flow sleep", |
9e684a49 DE |
3491 | .type = FIO_OPT_INT, |
3492 | .off1 = td_var_offset(flow_sleep), | |
3493 | .help = "How many microseconds to sleep after being held" | |
3494 | " back by the flow control mechanism", | |
3495 | .parent = "flow_id", | |
d71c154c | 3496 | .hide = 1, |
9e684a49 | 3497 | .def = "0", |
e8b0e958 JA |
3498 | .category = FIO_OPT_C_IO, |
3499 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 | 3500 | }, |
214e1eca JA |
3501 | { |
3502 | .name = NULL, | |
3503 | }, | |
3504 | }; | |
3505 | ||
17af15d4 | 3506 | static void add_to_lopt(struct option *lopt, struct fio_option *o, |
de890a1e | 3507 | const char *name, int val) |
9f81736c | 3508 | { |
17af15d4 | 3509 | lopt->name = (char *) name; |
de890a1e | 3510 | lopt->val = val; |
9f81736c | 3511 | if (o->type == FIO_OPT_STR_SET) |
ff52be3d | 3512 | lopt->has_arg = optional_argument; |
9f81736c JA |
3513 | else |
3514 | lopt->has_arg = required_argument; | |
3515 | } | |
3516 | ||
de890a1e SL |
3517 | static void options_to_lopts(struct fio_option *opts, |
3518 | struct option *long_options, | |
3519 | int i, int option_type) | |
214e1eca | 3520 | { |
de890a1e | 3521 | struct fio_option *o = &opts[0]; |
214e1eca | 3522 | while (o->name) { |
de890a1e | 3523 | add_to_lopt(&long_options[i], o, o->name, option_type); |
17af15d4 JA |
3524 | if (o->alias) { |
3525 | i++; | |
de890a1e | 3526 | add_to_lopt(&long_options[i], o, o->alias, option_type); |
17af15d4 | 3527 | } |
214e1eca JA |
3528 | |
3529 | i++; | |
3530 | o++; | |
3531 | assert(i < FIO_NR_OPTIONS); | |
3532 | } | |
3533 | } | |
3534 | ||
de890a1e SL |
3535 | void fio_options_set_ioengine_opts(struct option *long_options, |
3536 | struct thread_data *td) | |
3537 | { | |
3538 | unsigned int i; | |
3539 | ||
3540 | i = 0; | |
3541 | while (long_options[i].name) { | |
3542 | if (long_options[i].val == FIO_GETOPT_IOENGINE) { | |
3543 | memset(&long_options[i], 0, sizeof(*long_options)); | |
3544 | break; | |
3545 | } | |
3546 | i++; | |
3547 | } | |
3548 | ||
3549 | /* | |
3550 | * Just clear out the prior ioengine options. | |
3551 | */ | |
3552 | if (!td || !td->eo) | |
3553 | return; | |
3554 | ||
3555 | options_to_lopts(td->io_ops->options, long_options, i, | |
3556 | FIO_GETOPT_IOENGINE); | |
3557 | } | |
3558 | ||
3559 | void fio_options_dup_and_init(struct option *long_options) | |
3560 | { | |
3561 | unsigned int i; | |
3562 | ||
9af4a244 | 3563 | options_init(fio_options); |
de890a1e SL |
3564 | |
3565 | i = 0; | |
3566 | while (long_options[i].name) | |
3567 | i++; | |
3568 | ||
9af4a244 | 3569 | options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB); |
de890a1e SL |
3570 | } |
3571 | ||
74929ac2 JA |
3572 | struct fio_keyword { |
3573 | const char *word; | |
3574 | const char *desc; | |
3575 | char *replace; | |
3576 | }; | |
3577 | ||
3578 | static struct fio_keyword fio_keywords[] = { | |
3579 | { | |
3580 | .word = "$pagesize", | |
3581 | .desc = "Page size in the system", | |
3582 | }, | |
3583 | { | |
3584 | .word = "$mb_memory", | |
3585 | .desc = "Megabytes of memory online", | |
3586 | }, | |
3587 | { | |
3588 | .word = "$ncpus", | |
3589 | .desc = "Number of CPUs online in the system", | |
3590 | }, | |
3591 | { | |
3592 | .word = NULL, | |
3593 | }, | |
3594 | }; | |
3595 | ||
3596 | void fio_keywords_init(void) | |
3597 | { | |
3b2e1464 | 3598 | unsigned long long mb_memory; |
74929ac2 JA |
3599 | char buf[128]; |
3600 | long l; | |
3601 | ||
a4cfc477 | 3602 | sprintf(buf, "%lu", (unsigned long) page_size); |
74929ac2 JA |
3603 | fio_keywords[0].replace = strdup(buf); |
3604 | ||
8eb016d3 | 3605 | mb_memory = os_phys_mem() / (1024 * 1024); |
3b2e1464 | 3606 | sprintf(buf, "%llu", mb_memory); |
74929ac2 JA |
3607 | fio_keywords[1].replace = strdup(buf); |
3608 | ||
c00a2289 | 3609 | l = cpus_online(); |
74929ac2 JA |
3610 | sprintf(buf, "%lu", l); |
3611 | fio_keywords[2].replace = strdup(buf); | |
3612 | } | |
3613 | ||
892a6ffc JA |
3614 | #define BC_APP "bc" |
3615 | ||
3616 | static char *bc_calc(char *str) | |
3617 | { | |
d0c814ec | 3618 | char buf[128], *tmp; |
892a6ffc JA |
3619 | FILE *f; |
3620 | int ret; | |
3621 | ||
3622 | /* | |
3623 | * No math, just return string | |
3624 | */ | |
d0c814ec SL |
3625 | if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') && |
3626 | !strchr(str, '/')) || strchr(str, '\'')) | |
892a6ffc JA |
3627 | return str; |
3628 | ||
3629 | /* | |
3630 | * Split option from value, we only need to calculate the value | |
3631 | */ | |
3632 | tmp = strchr(str, '='); | |
3633 | if (!tmp) | |
3634 | return str; | |
3635 | ||
3636 | tmp++; | |
892a6ffc | 3637 | |
d0c814ec SL |
3638 | /* |
3639 | * Prevent buffer overflows; such a case isn't reasonable anyway | |
3640 | */ | |
3641 | if (strlen(str) >= 128 || strlen(tmp) > 100) | |
3642 | return str; | |
892a6ffc JA |
3643 | |
3644 | sprintf(buf, "which %s > /dev/null", BC_APP); | |
3645 | if (system(buf)) { | |
3646 | log_err("fio: bc is needed for performing math\n"); | |
892a6ffc JA |
3647 | return NULL; |
3648 | } | |
3649 | ||
d0c814ec | 3650 | sprintf(buf, "echo '%s' | %s", tmp, BC_APP); |
892a6ffc | 3651 | f = popen(buf, "r"); |
3c3ed070 | 3652 | if (!f) |
892a6ffc | 3653 | return NULL; |
892a6ffc | 3654 | |
d0c814ec | 3655 | ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f); |
3c3ed070 | 3656 | if (ret <= 0) |
892a6ffc | 3657 | return NULL; |
892a6ffc | 3658 | |
892a6ffc | 3659 | pclose(f); |
d0c814ec SL |
3660 | buf[(tmp - str) + ret - 1] = '\0'; |
3661 | memcpy(buf, str, tmp - str); | |
892a6ffc | 3662 | free(str); |
d0c814ec SL |
3663 | return strdup(buf); |
3664 | } | |
3665 | ||
3666 | /* | |
3667 | * Return a copy of the input string with substrings of the form ${VARNAME} | |
3668 | * substituted with the value of the environment variable VARNAME. The | |
3669 | * substitution always occurs, even if VARNAME is empty or the corresponding | |
3670 | * environment variable undefined. | |
3671 | */ | |
3672 | static char *option_dup_subs(const char *opt) | |
3673 | { | |
3674 | char out[OPT_LEN_MAX+1]; | |
3675 | char in[OPT_LEN_MAX+1]; | |
3676 | char *outptr = out; | |
3677 | char *inptr = in; | |
3678 | char *ch1, *ch2, *env; | |
3679 | ssize_t nchr = OPT_LEN_MAX; | |
3680 | size_t envlen; | |
3681 | ||
3682 | if (strlen(opt) + 1 > OPT_LEN_MAX) { | |
3683 | log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX); | |
3684 | return NULL; | |
3685 | } | |
3686 | ||
3687 | in[OPT_LEN_MAX] = '\0'; | |
3688 | strncpy(in, opt, OPT_LEN_MAX); | |
3689 | ||
3690 | while (*inptr && nchr > 0) { | |
3691 | if (inptr[0] == '$' && inptr[1] == '{') { | |
3692 | ch2 = strchr(inptr, '}'); | |
3693 | if (ch2 && inptr+1 < ch2) { | |
3694 | ch1 = inptr+2; | |
3695 | inptr = ch2+1; | |
3696 | *ch2 = '\0'; | |
3697 | ||
3698 | env = getenv(ch1); | |
3699 | if (env) { | |
3700 | envlen = strlen(env); | |
3701 | if (envlen <= nchr) { | |
3702 | memcpy(outptr, env, envlen); | |
3703 | outptr += envlen; | |
3704 | nchr -= envlen; | |
3705 | } | |
3706 | } | |
3707 | ||
3708 | continue; | |
3709 | } | |
3710 | } | |
3711 | ||
3712 | *outptr++ = *inptr++; | |
3713 | --nchr; | |
3714 | } | |
3715 | ||
3716 | *outptr = '\0'; | |
3717 | return strdup(out); | |
892a6ffc JA |
3718 | } |
3719 | ||
74929ac2 JA |
3720 | /* |
3721 | * Look for reserved variable names and replace them with real values | |
3722 | */ | |
3723 | static char *fio_keyword_replace(char *opt) | |
3724 | { | |
3725 | char *s; | |
3726 | int i; | |
d0c814ec | 3727 | int docalc = 0; |
74929ac2 JA |
3728 | |
3729 | for (i = 0; fio_keywords[i].word != NULL; i++) { | |
3730 | struct fio_keyword *kw = &fio_keywords[i]; | |
3731 | ||
3732 | while ((s = strstr(opt, kw->word)) != NULL) { | |
3733 | char *new = malloc(strlen(opt) + 1); | |
3734 | char *o_org = opt; | |
3735 | int olen = s - opt; | |
3736 | int len; | |
3737 | ||
3738 | /* | |
3739 | * Copy part of the string before the keyword and | |
3740 | * sprintf() the replacement after it. | |
3741 | */ | |
3742 | memcpy(new, opt, olen); | |
3743 | len = sprintf(new + olen, "%s", kw->replace); | |
3744 | ||
3745 | /* | |
3746 | * If there's more in the original string, copy that | |
3747 | * in too | |
3748 | */ | |
3749 | opt += strlen(kw->word) + olen; | |
3750 | if (strlen(opt)) | |
3751 | memcpy(new + olen + len, opt, opt - o_org - 1); | |
3752 | ||
3753 | /* | |
3754 | * replace opt and free the old opt | |
3755 | */ | |
3756 | opt = new; | |
d0c814ec | 3757 | free(o_org); |
7a958bd5 | 3758 | |
d0c814ec | 3759 | docalc = 1; |
74929ac2 JA |
3760 | } |
3761 | } | |
3762 | ||
d0c814ec SL |
3763 | /* |
3764 | * Check for potential math and invoke bc, if possible | |
3765 | */ | |
3766 | if (docalc) | |
3767 | opt = bc_calc(opt); | |
3768 | ||
7a958bd5 | 3769 | return opt; |
74929ac2 JA |
3770 | } |
3771 | ||
d0c814ec SL |
3772 | static char **dup_and_sub_options(char **opts, int num_opts) |
3773 | { | |
3774 | int i; | |
3775 | char **opts_copy = malloc(num_opts * sizeof(*opts)); | |
3776 | for (i = 0; i < num_opts; i++) { | |
3777 | opts_copy[i] = option_dup_subs(opts[i]); | |
3778 | if (!opts_copy[i]) | |
3779 | continue; | |
3780 | opts_copy[i] = fio_keyword_replace(opts_copy[i]); | |
3781 | } | |
3782 | return opts_copy; | |
3783 | } | |
3784 | ||
292cc475 JA |
3785 | int fio_options_parse(struct thread_data *td, char **opts, int num_opts, |
3786 | int dump_cmdline) | |
214e1eca | 3787 | { |
de890a1e | 3788 | int i, ret, unknown; |
d0c814ec | 3789 | char **opts_copy; |
3b8b7135 | 3790 | |
9af4a244 | 3791 | sort_options(opts, fio_options, num_opts); |
d0c814ec | 3792 | opts_copy = dup_and_sub_options(opts, num_opts); |
3b8b7135 | 3793 | |
de890a1e SL |
3794 | for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) { |
3795 | struct fio_option *o; | |
9af4a244 | 3796 | int newret = parse_option(opts_copy[i], opts[i], fio_options, |
292cc475 | 3797 | &o, td, dump_cmdline); |
d0c814ec | 3798 | |
de890a1e SL |
3799 | if (opts_copy[i]) { |
3800 | if (newret && !o) { | |
3801 | unknown++; | |
3802 | continue; | |
3803 | } | |
d0c814ec | 3804 | free(opts_copy[i]); |
de890a1e SL |
3805 | opts_copy[i] = NULL; |
3806 | } | |
3807 | ||
3808 | ret |= newret; | |
3809 | } | |
3810 | ||
3811 | if (unknown) { | |
3812 | ret |= ioengine_load(td); | |
3813 | if (td->eo) { | |
3814 | sort_options(opts_copy, td->io_ops->options, num_opts); | |
3815 | opts = opts_copy; | |
3816 | } | |
3817 | for (i = 0; i < num_opts; i++) { | |
3818 | struct fio_option *o = NULL; | |
3819 | int newret = 1; | |
3820 | if (!opts_copy[i]) | |
3821 | continue; | |
3822 | ||
3823 | if (td->eo) | |
3824 | newret = parse_option(opts_copy[i], opts[i], | |
3825 | td->io_ops->options, &o, | |
292cc475 | 3826 | td->eo, dump_cmdline); |
de890a1e SL |
3827 | |
3828 | ret |= newret; | |
3829 | if (!o) | |
3830 | log_err("Bad option <%s>\n", opts[i]); | |
3831 | ||
3832 | free(opts_copy[i]); | |
3833 | opts_copy[i] = NULL; | |
3834 | } | |
74929ac2 | 3835 | } |
3b8b7135 | 3836 | |
d0c814ec | 3837 | free(opts_copy); |
3b8b7135 | 3838 | return ret; |
214e1eca JA |
3839 | } |
3840 | ||
3841 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) | |
3842 | { | |
9af4a244 | 3843 | return parse_cmd_option(opt, val, fio_options, td); |
214e1eca JA |
3844 | } |
3845 | ||
de890a1e SL |
3846 | int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt, |
3847 | char *val) | |
3848 | { | |
8a96c80e | 3849 | return parse_cmd_option(opt, val, td->io_ops->options, td->eo); |
de890a1e SL |
3850 | } |
3851 | ||
214e1eca JA |
3852 | void fio_fill_default_options(struct thread_data *td) |
3853 | { | |
cb1402d6 | 3854 | td->o.magic = OPT_MAGIC; |
9af4a244 | 3855 | fill_default_options(td, fio_options); |
214e1eca JA |
3856 | } |
3857 | ||
3858 | int fio_show_option_help(const char *opt) | |
3859 | { | |
9af4a244 | 3860 | return show_cmd_help(fio_options, opt); |
214e1eca | 3861 | } |
d23bb327 | 3862 | |
de890a1e | 3863 | void options_mem_dupe(void *data, struct fio_option *options) |
d23bb327 | 3864 | { |
de890a1e | 3865 | struct fio_option *o; |
d23bb327 | 3866 | char **ptr; |
d23bb327 | 3867 | |
de890a1e SL |
3868 | for (o = &options[0]; o->name; o++) { |
3869 | if (o->type != FIO_OPT_STR_STORE) | |
d23bb327 JA |
3870 | continue; |
3871 | ||
f0fdbcaf | 3872 | ptr = td_var(data, o, o->off1); |
7e356b2d JA |
3873 | if (*ptr) |
3874 | *ptr = strdup(*ptr); | |
d23bb327 JA |
3875 | } |
3876 | } | |
3877 | ||
de890a1e SL |
3878 | /* |
3879 | * dupe FIO_OPT_STR_STORE options | |
3880 | */ | |
3881 | void fio_options_mem_dupe(struct thread_data *td) | |
3882 | { | |
9af4a244 | 3883 | options_mem_dupe(&td->o, fio_options); |
1647f592 JA |
3884 | |
3885 | if (td->eo && td->io_ops) { | |
de890a1e | 3886 | void *oldeo = td->eo; |
1647f592 | 3887 | |
de890a1e SL |
3888 | td->eo = malloc(td->io_ops->option_struct_size); |
3889 | memcpy(td->eo, oldeo, td->io_ops->option_struct_size); | |
3890 | options_mem_dupe(td->eo, td->io_ops->options); | |
3891 | } | |
3892 | } | |
3893 | ||
d6978a32 JA |
3894 | unsigned int fio_get_kb_base(void *data) |
3895 | { | |
83ea422a | 3896 | struct thread_options *o = data; |
d6978a32 JA |
3897 | unsigned int kb_base = 0; |
3898 | ||
cb1402d6 JA |
3899 | /* |
3900 | * This is a hack... For private options, *data is not holding | |
3901 | * a pointer to the thread_options, but to private data. This means | |
3902 | * we can't safely dereference it, but magic is first so mem wise | |
3903 | * it is valid. But this also means that if the job first sets | |
3904 | * kb_base and expects that to be honored by private options, | |
3905 | * it will be disappointed. We will return the global default | |
3906 | * for this. | |
3907 | */ | |
3908 | if (o && o->magic == OPT_MAGIC) | |
83ea422a | 3909 | kb_base = o->kb_base; |
d6978a32 JA |
3910 | if (!kb_base) |
3911 | kb_base = 1024; | |
3912 | ||
3913 | return kb_base; | |
3914 | } | |
9f988e2e | 3915 | |
07b3232d | 3916 | int add_option(struct fio_option *o) |
9f988e2e | 3917 | { |
07b3232d JA |
3918 | struct fio_option *__o; |
3919 | int opt_index = 0; | |
3920 | ||
9af4a244 | 3921 | __o = fio_options; |
07b3232d JA |
3922 | while (__o->name) { |
3923 | opt_index++; | |
3924 | __o++; | |
3925 | } | |
3926 | ||
7b504edd JA |
3927 | if (opt_index + 1 == FIO_MAX_OPTS) { |
3928 | log_err("fio: FIO_MAX_OPTS is too small\n"); | |
3929 | return 1; | |
3930 | } | |
3931 | ||
9af4a244 | 3932 | memcpy(&fio_options[opt_index], o, sizeof(*o)); |
7b504edd | 3933 | fio_options[opt_index + 1].name = NULL; |
07b3232d | 3934 | return 0; |
9f988e2e | 3935 | } |
e2de69da | 3936 | |
07b3232d | 3937 | void invalidate_profile_options(const char *prof_name) |
e2de69da | 3938 | { |
07b3232d | 3939 | struct fio_option *o; |
e2de69da | 3940 | |
9af4a244 | 3941 | o = fio_options; |
07b3232d JA |
3942 | while (o->name) { |
3943 | if (o->prof_name && !strcmp(o->prof_name, prof_name)) { | |
3944 | o->type = FIO_OPT_INVALID; | |
3945 | o->prof_name = NULL; | |
3946 | } | |
3947 | o++; | |
e2de69da JA |
3948 | } |
3949 | } | |
f5b6bb85 JA |
3950 | |
3951 | void add_opt_posval(const char *optname, const char *ival, const char *help) | |
3952 | { | |
3953 | struct fio_option *o; | |
3954 | unsigned int i; | |
3955 | ||
9af4a244 | 3956 | o = find_option(fio_options, optname); |
f5b6bb85 JA |
3957 | if (!o) |
3958 | return; | |
3959 | ||
3960 | for (i = 0; i < PARSE_MAX_VP; i++) { | |
3961 | if (o->posval[i].ival) | |
3962 | continue; | |
3963 | ||
3964 | o->posval[i].ival = ival; | |
3965 | o->posval[i].help = help; | |
3966 | break; | |
3967 | } | |
3968 | } | |
3969 | ||
3970 | void del_opt_posval(const char *optname, const char *ival) | |
3971 | { | |
3972 | struct fio_option *o; | |
3973 | unsigned int i; | |
3974 | ||
9af4a244 | 3975 | o = find_option(fio_options, optname); |
f5b6bb85 JA |
3976 | if (!o) |
3977 | return; | |
3978 | ||
3979 | for (i = 0; i < PARSE_MAX_VP; i++) { | |
3980 | if (!o->posval[i].ival) | |
3981 | continue; | |
3982 | if (strcmp(o->posval[i].ival, ival)) | |
3983 | continue; | |
3984 | ||
3985 | o->posval[i].ival = NULL; | |
3986 | o->posval[i].help = NULL; | |
3987 | } | |
3988 | } | |
7e356b2d JA |
3989 | |
3990 | void fio_options_free(struct thread_data *td) | |
3991 | { | |
9af4a244 | 3992 | options_free(fio_options, td); |
de890a1e SL |
3993 | if (td->eo && td->io_ops && td->io_ops->options) { |
3994 | options_free(td->io_ops->options, td->eo); | |
3995 | free(td->eo); | |
3996 | td->eo = NULL; | |
3997 | } | |
7e356b2d | 3998 | } |
c504ee55 JA |
3999 | |
4000 | struct fio_option *fio_option_find(const char *name) | |
4001 | { | |
4002 | return find_option(fio_options, name); | |
4003 | } | |
4004 |