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