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