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