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