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