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