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