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