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; | |
872e0415 JA |
1474 | dprint(FD_PARSE, "SET start_offset_percent %d\n", |
1475 | td->o.start_offset_percent); | |
89978a6b BW |
1476 | } else |
1477 | td->o.start_offset = v; | |
1478 | ||
1479 | return 0; | |
1480 | } | |
1481 | ||
0b288ba1 VF |
1482 | static int str_offset_increment_cb(void *data, unsigned long long *__val) |
1483 | { | |
1484 | struct thread_data *td = cb_data_to_td(data); | |
1485 | unsigned long long v = *__val; | |
1486 | ||
1487 | if (parse_is_percent(v)) { | |
1488 | td->o.offset_increment = 0; | |
1489 | td->o.offset_increment_percent = -1ULL - v; | |
1490 | dprint(FD_PARSE, "SET offset_increment_percent %d\n", | |
1491 | td->o.offset_increment_percent); | |
1492 | } else | |
1493 | td->o.offset_increment = v; | |
1494 | ||
1495 | return 0; | |
1496 | } | |
1497 | ||
7bb59102 JA |
1498 | static int str_size_cb(void *data, unsigned long long *__val) |
1499 | { | |
a609f12a | 1500 | struct thread_data *td = cb_data_to_td(data); |
7bb59102 JA |
1501 | unsigned long long v = *__val; |
1502 | ||
1503 | if (parse_is_percent(v)) { | |
1504 | td->o.size = 0; | |
1505 | td->o.size_percent = -1ULL - v; | |
24e4321c TK |
1506 | dprint(FD_PARSE, "SET size_percent %d\n", |
1507 | td->o.size_percent); | |
7bb59102 JA |
1508 | } else |
1509 | td->o.size = v; | |
1510 | ||
1511 | return 0; | |
1512 | } | |
1513 | ||
8b38f401 AD |
1514 | static int str_io_size_cb(void *data, unsigned long long *__val) |
1515 | { | |
1516 | struct thread_data *td = cb_data_to_td(data); | |
1517 | unsigned long long v = *__val; | |
1518 | ||
f248a525 | 1519 | if (parse_is_percent_uncapped(v)) { |
8b38f401 AD |
1520 | td->o.io_size = 0; |
1521 | td->o.io_size_percent = -1ULL - v; | |
f248a525 AD |
1522 | if (td->o.io_size_percent > 100) { |
1523 | log_err("fio: io_size values greater than 100%% aren't supported\n"); | |
1524 | return 1; | |
1525 | } | |
8b38f401 AD |
1526 | dprint(FD_PARSE, "SET io_size_percent %d\n", |
1527 | td->o.io_size_percent); | |
1528 | } else | |
1529 | td->o.io_size = v; | |
1530 | ||
1531 | return 0; | |
1532 | } | |
1533 | ||
dded427c OS |
1534 | static int str_write_bw_log_cb(void *data, const char *str) |
1535 | { | |
1536 | struct thread_data *td = cb_data_to_td(data); | |
1537 | ||
1538 | if (str) | |
1539 | td->o.bw_log_file = strdup(str); | |
1540 | ||
1541 | td->o.write_bw_log = 1; | |
1542 | return 0; | |
1543 | } | |
1544 | ||
1545 | static int str_write_lat_log_cb(void *data, const char *str) | |
1546 | { | |
1547 | struct thread_data *td = cb_data_to_td(data); | |
1548 | ||
1549 | if (str) | |
1550 | td->o.lat_log_file = strdup(str); | |
1551 | ||
1552 | td->o.write_lat_log = 1; | |
1553 | return 0; | |
1554 | } | |
1555 | ||
1556 | static int str_write_iops_log_cb(void *data, const char *str) | |
1557 | { | |
1558 | struct thread_data *td = cb_data_to_td(data); | |
1559 | ||
1560 | if (str) | |
1561 | td->o.iops_log_file = strdup(str); | |
1562 | ||
1563 | td->o.write_iops_log = 1; | |
1564 | return 0; | |
1565 | } | |
1566 | ||
1567 | static int str_write_hist_log_cb(void *data, const char *str) | |
1568 | { | |
1569 | struct thread_data *td = cb_data_to_td(data); | |
1570 | ||
1571 | if (str) | |
1572 | td->o.hist_log_file = strdup(str); | |
1573 | ||
1574 | td->o.write_hist_log = 1; | |
1575 | return 0; | |
1576 | } | |
1577 | ||
6730b40f TK |
1578 | /* |
1579 | * str is supposed to be a substring of the strdup'd original string, | |
1580 | * and is valid only if it's a regular file path. | |
1581 | * This function keeps the pointer to the path as needed later. | |
1582 | * | |
1583 | * "external:/path/to/so\0" <- original pointer updated with strdup'd | |
1584 | * "external\0" <- above pointer after parsed, i.e. ->ioengine | |
1585 | * "/path/to/so\0" <- str argument, i.e. ->ioengine_so_path | |
1586 | */ | |
1587 | static int str_ioengine_external_cb(void *data, const char *str) | |
1588 | { | |
1589 | struct thread_data *td = cb_data_to_td(data); | |
1590 | struct stat sb; | |
1591 | char *p; | |
1592 | ||
1593 | if (!str) { | |
1594 | log_err("fio: null external ioengine path\n"); | |
1595 | return 1; | |
1596 | } | |
1597 | ||
1598 | p = (char *)str; /* str is mutable */ | |
1599 | strip_blank_front(&p); | |
1600 | strip_blank_end(p); | |
1601 | ||
1602 | if (stat(p, &sb) || !S_ISREG(sb.st_mode)) { | |
1603 | log_err("fio: invalid external ioengine path \"%s\"\n", p); | |
1604 | return 1; | |
1605 | } | |
1606 | ||
1607 | td->o.ioengine_so_path = p; | |
1608 | return 0; | |
1609 | } | |
1610 | ||
9109883a | 1611 | static int rw_verify(const struct fio_option *o, void *data) |
896cac2a | 1612 | { |
a609f12a | 1613 | struct thread_data *td = cb_data_to_td(data); |
896cac2a | 1614 | |
d81d0f99 VF |
1615 | if (read_only && (td_write(td) || td_trim(td))) { |
1616 | log_err("fio: job <%s> has write or trim bit set, but" | |
1617 | " fio is in read-only mode\n", td->o.name); | |
896cac2a JA |
1618 | return 1; |
1619 | } | |
1620 | ||
1621 | return 0; | |
1622 | } | |
1623 | ||
9109883a | 1624 | static int gtod_cpu_verify(const struct fio_option *o, void *data) |
29d43ff9 | 1625 | { |
276ca4f7 | 1626 | #ifndef FIO_HAVE_CPU_AFFINITY |
a609f12a | 1627 | struct thread_data *td = cb_data_to_td(data); |
29d43ff9 | 1628 | |
29d43ff9 JA |
1629 | if (td->o.gtod_cpu) { |
1630 | log_err("fio: platform must support CPU affinity for" | |
1631 | "gettimeofday() offloading\n"); | |
1632 | return 1; | |
1633 | } | |
1634 | #endif | |
1635 | ||
1636 | return 0; | |
1637 | } | |
1638 | ||
214e1eca JA |
1639 | /* |
1640 | * Map of job/command line options | |
1641 | */ | |
9af4a244 | 1642 | struct fio_option fio_options[FIO_MAX_OPTS] = { |
214e1eca JA |
1643 | { |
1644 | .name = "description", | |
e8b0e958 | 1645 | .lname = "Description of job", |
214e1eca | 1646 | .type = FIO_OPT_STR_STORE, |
a609f12a | 1647 | .off1 = offsetof(struct thread_options, description), |
214e1eca | 1648 | .help = "Text job description", |
e8b0e958 | 1649 | .category = FIO_OPT_C_GENERAL, |
0626037e | 1650 | .group = FIO_OPT_G_DESC, |
214e1eca JA |
1651 | }, |
1652 | { | |
1653 | .name = "name", | |
e8b0e958 | 1654 | .lname = "Job name", |
214e1eca | 1655 | .type = FIO_OPT_STR_STORE, |
a609f12a | 1656 | .off1 = offsetof(struct thread_options, name), |
214e1eca | 1657 | .help = "Name of this job", |
e8b0e958 | 1658 | .category = FIO_OPT_C_GENERAL, |
0626037e | 1659 | .group = FIO_OPT_G_DESC, |
214e1eca | 1660 | }, |
9cc8cb91 AK |
1661 | { |
1662 | .name = "wait_for", | |
1663 | .lname = "Waitee name", | |
1664 | .type = FIO_OPT_STR_STORE, | |
a609f12a | 1665 | .off1 = offsetof(struct thread_options, wait_for), |
9cc8cb91 AK |
1666 | .help = "Name of the job this one wants to wait for before starting", |
1667 | .category = FIO_OPT_C_GENERAL, | |
1668 | .group = FIO_OPT_G_DESC, | |
1669 | }, | |
214e1eca JA |
1670 | { |
1671 | .name = "filename", | |
e8b0e958 | 1672 | .lname = "Filename(s)", |
214e1eca | 1673 | .type = FIO_OPT_STR_STORE, |
a609f12a | 1674 | .off1 = offsetof(struct thread_options, filename), |
46576743 | 1675 | .maxlen = PATH_MAX, |
214e1eca | 1676 | .cb = str_filename_cb, |
f0d524b0 | 1677 | .prio = -1, /* must come after "directory" */ |
214e1eca | 1678 | .help = "File(s) to use for the workload", |
e8b0e958 | 1679 | .category = FIO_OPT_C_FILE, |
0626037e | 1680 | .group = FIO_OPT_G_FILENAME, |
214e1eca | 1681 | }, |
90fef2d1 | 1682 | { |
e8b0e958 JA |
1683 | .name = "directory", |
1684 | .lname = "Directory", | |
1685 | .type = FIO_OPT_STR_STORE, | |
a609f12a | 1686 | .off1 = offsetof(struct thread_options, directory), |
e8b0e958 JA |
1687 | .cb = str_directory_cb, |
1688 | .help = "Directory to store files in", | |
1689 | .category = FIO_OPT_C_FILE, | |
0626037e | 1690 | .group = FIO_OPT_G_FILENAME, |
90fef2d1 | 1691 | }, |
de98bd30 JA |
1692 | { |
1693 | .name = "filename_format", | |
922a5be8 | 1694 | .lname = "Filename Format", |
de98bd30 | 1695 | .type = FIO_OPT_STR_STORE, |
a609f12a | 1696 | .off1 = offsetof(struct thread_options, filename_format), |
de98bd30 JA |
1697 | .prio = -1, /* must come after "directory" */ |
1698 | .help = "Override default $jobname.$jobnum.$filenum naming", | |
1699 | .def = "$jobname.$jobnum.$filenum", | |
93bb626a JA |
1700 | .category = FIO_OPT_C_FILE, |
1701 | .group = FIO_OPT_G_FILENAME, | |
ad705bcb | 1702 | }, |
922a5be8 JA |
1703 | { |
1704 | .name = "unique_filename", | |
1705 | .lname = "Unique Filename", | |
1706 | .type = FIO_OPT_BOOL, | |
a609f12a | 1707 | .off1 = offsetof(struct thread_options, unique_filename), |
922a5be8 JA |
1708 | .help = "For network clients, prefix file with source IP", |
1709 | .def = "1", | |
1710 | .category = FIO_OPT_C_FILE, | |
1711 | .group = FIO_OPT_G_FILENAME, | |
1712 | }, | |
29c1349f JA |
1713 | { |
1714 | .name = "lockfile", | |
e8b0e958 | 1715 | .lname = "Lockfile", |
4d4e80f2 | 1716 | .type = FIO_OPT_STR, |
a609f12a | 1717 | .off1 = offsetof(struct thread_options, file_lock_mode), |
29c1349f | 1718 | .help = "Lock file when doing IO to it", |
bc6a0a5d | 1719 | .prio = 1, |
29c1349f | 1720 | .parent = "filename", |
d71c154c | 1721 | .hide = 0, |
4d4e80f2 | 1722 | .def = "none", |
e8b0e958 | 1723 | .category = FIO_OPT_C_FILE, |
0626037e | 1724 | .group = FIO_OPT_G_FILENAME, |
4d4e80f2 JA |
1725 | .posval = { |
1726 | { .ival = "none", | |
1727 | .oval = FILE_LOCK_NONE, | |
1728 | .help = "No file locking", | |
1729 | }, | |
1730 | { .ival = "exclusive", | |
1731 | .oval = FILE_LOCK_EXCLUSIVE, | |
1732 | .help = "Exclusive file lock", | |
1733 | }, | |
1734 | { | |
1735 | .ival = "readwrite", | |
1736 | .oval = FILE_LOCK_READWRITE, | |
1737 | .help = "Read vs write lock", | |
1738 | }, | |
1739 | }, | |
29c1349f | 1740 | }, |
214e1eca JA |
1741 | { |
1742 | .name = "opendir", | |
e8b0e958 | 1743 | .lname = "Open directory", |
214e1eca | 1744 | .type = FIO_OPT_STR_STORE, |
a609f12a | 1745 | .off1 = offsetof(struct thread_options, opendir), |
214e1eca JA |
1746 | .cb = str_opendir_cb, |
1747 | .help = "Recursively add files from this directory and down", | |
e8b0e958 | 1748 | .category = FIO_OPT_C_FILE, |
0626037e | 1749 | .group = FIO_OPT_G_FILENAME, |
214e1eca JA |
1750 | }, |
1751 | { | |
1752 | .name = "rw", | |
e8b0e958 | 1753 | .lname = "Read/write", |
d3aad8f2 | 1754 | .alias = "readwrite", |
214e1eca | 1755 | .type = FIO_OPT_STR, |
211097b2 | 1756 | .cb = str_rw_cb, |
a609f12a | 1757 | .off1 = offsetof(struct thread_options, td_ddir), |
214e1eca JA |
1758 | .help = "IO direction", |
1759 | .def = "read", | |
896cac2a | 1760 | .verify = rw_verify, |
e8b0e958 | 1761 | .category = FIO_OPT_C_IO, |
0626037e | 1762 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1763 | .posval = { |
1764 | { .ival = "read", | |
1765 | .oval = TD_DDIR_READ, | |
1766 | .help = "Sequential read", | |
1767 | }, | |
1768 | { .ival = "write", | |
1769 | .oval = TD_DDIR_WRITE, | |
1770 | .help = "Sequential write", | |
1771 | }, | |
6eaf09d6 SL |
1772 | { .ival = "trim", |
1773 | .oval = TD_DDIR_TRIM, | |
1774 | .help = "Sequential trim", | |
1775 | }, | |
214e1eca JA |
1776 | { .ival = "randread", |
1777 | .oval = TD_DDIR_RANDREAD, | |
1778 | .help = "Random read", | |
1779 | }, | |
1780 | { .ival = "randwrite", | |
1781 | .oval = TD_DDIR_RANDWRITE, | |
1782 | .help = "Random write", | |
1783 | }, | |
6eaf09d6 SL |
1784 | { .ival = "randtrim", |
1785 | .oval = TD_DDIR_RANDTRIM, | |
1786 | .help = "Random trim", | |
1787 | }, | |
214e1eca JA |
1788 | { .ival = "rw", |
1789 | .oval = TD_DDIR_RW, | |
1790 | .help = "Sequential read and write mix", | |
1791 | }, | |
10b023db JA |
1792 | { .ival = "readwrite", |
1793 | .oval = TD_DDIR_RW, | |
1794 | .help = "Sequential read and write mix", | |
1795 | }, | |
214e1eca JA |
1796 | { .ival = "randrw", |
1797 | .oval = TD_DDIR_RANDRW, | |
1798 | .help = "Random read and write mix" | |
1799 | }, | |
82a90686 JA |
1800 | { .ival = "trimwrite", |
1801 | .oval = TD_DDIR_TRIMWRITE, | |
1802 | .help = "Trim and write mix, trims preceding writes" | |
0e4dd95c | 1803 | }, |
214e1eca JA |
1804 | }, |
1805 | }, | |
38dad62d JA |
1806 | { |
1807 | .name = "rw_sequencer", | |
e8b0e958 | 1808 | .lname = "RW Sequencer", |
38dad62d | 1809 | .type = FIO_OPT_STR, |
a609f12a | 1810 | .off1 = offsetof(struct thread_options, rw_seq), |
38dad62d JA |
1811 | .help = "IO offset generator modifier", |
1812 | .def = "sequential", | |
e8b0e958 | 1813 | .category = FIO_OPT_C_IO, |
0626037e | 1814 | .group = FIO_OPT_G_IO_BASIC, |
38dad62d JA |
1815 | .posval = { |
1816 | { .ival = "sequential", | |
1817 | .oval = RW_SEQ_SEQ, | |
1818 | .help = "Generate sequential offsets", | |
1819 | }, | |
1820 | { .ival = "identical", | |
1821 | .oval = RW_SEQ_IDENT, | |
1822 | .help = "Generate identical offsets", | |
1823 | }, | |
1824 | }, | |
1825 | }, | |
1826 | ||
214e1eca JA |
1827 | { |
1828 | .name = "ioengine", | |
e8b0e958 | 1829 | .lname = "IO Engine", |
214e1eca | 1830 | .type = FIO_OPT_STR_STORE, |
a609f12a | 1831 | .off1 = offsetof(struct thread_options, ioengine), |
214e1eca | 1832 | .help = "IO engine to use", |
58483fa4 | 1833 | .def = FIO_PREFERRED_ENGINE, |
e8b0e958 | 1834 | .category = FIO_OPT_C_IO, |
0626037e | 1835 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1836 | .posval = { |
1837 | { .ival = "sync", | |
1838 | .help = "Use read/write", | |
1839 | }, | |
a31041ea | 1840 | { .ival = "psync", |
1841 | .help = "Use pread/pwrite", | |
1842 | }, | |
1d2af02a | 1843 | { .ival = "vsync", |
03e20d68 | 1844 | .help = "Use readv/writev", |
1d2af02a | 1845 | }, |
07fc0acd JA |
1846 | #ifdef CONFIG_PWRITEV |
1847 | { .ival = "pvsync", | |
1848 | .help = "Use preadv/pwritev", | |
1849 | }, | |
1850 | #endif | |
6562685f | 1851 | #ifdef FIO_HAVE_PWRITEV2 |
2cafffbe JA |
1852 | { .ival = "pvsync2", |
1853 | .help = "Use preadv2/pwritev2", | |
1854 | }, | |
1855 | #endif | |
67bf9823 | 1856 | #ifdef CONFIG_LIBAIO |
214e1eca JA |
1857 | { .ival = "libaio", |
1858 | .help = "Linux native asynchronous IO", | |
1859 | }, | |
1860 | #endif | |
bffad86f JA |
1861 | #ifdef ARCH_HAVE_IOURING |
1862 | { .ival = "io_uring", | |
1863 | .help = "Fast Linux native aio", | |
52885fa2 JA |
1864 | }, |
1865 | #endif | |
67bf9823 | 1866 | #ifdef CONFIG_POSIXAIO |
214e1eca JA |
1867 | { .ival = "posixaio", |
1868 | .help = "POSIX asynchronous IO", | |
1869 | }, | |
417f0068 | 1870 | #endif |
997843cb | 1871 | #ifdef CONFIG_SOLARISAIO |
417f0068 JA |
1872 | { .ival = "solarisaio", |
1873 | .help = "Solaris native asynchronous IO", | |
1874 | }, | |
214e1eca | 1875 | #endif |
4700b234 | 1876 | #ifdef CONFIG_WINDOWSAIO |
03e20d68 | 1877 | { .ival = "windowsaio", |
3be80071 | 1878 | .help = "Windows native asynchronous IO" |
de890a1e | 1879 | }, |
fc5c0345 DG |
1880 | #endif |
1881 | #ifdef CONFIG_RBD | |
1882 | { .ival = "rbd", | |
1883 | .help = "Rados Block Device asynchronous IO" | |
1884 | }, | |
3be80071 | 1885 | #endif |
214e1eca | 1886 | { .ival = "mmap", |
03e20d68 | 1887 | .help = "Memory mapped IO" |
214e1eca | 1888 | }, |
67bf9823 | 1889 | #ifdef CONFIG_LINUX_SPLICE |
214e1eca JA |
1890 | { .ival = "splice", |
1891 | .help = "splice/vmsplice based IO", | |
1892 | }, | |
9cce02e8 JA |
1893 | { .ival = "netsplice", |
1894 | .help = "splice/vmsplice to/from the network", | |
1895 | }, | |
214e1eca JA |
1896 | #endif |
1897 | #ifdef FIO_HAVE_SGIO | |
1898 | { .ival = "sg", | |
1899 | .help = "SCSI generic v3 IO", | |
1900 | }, | |
1901 | #endif | |
1902 | { .ival = "null", | |
1903 | .help = "Testing engine (no data transfer)", | |
1904 | }, | |
1905 | { .ival = "net", | |
1906 | .help = "Network IO", | |
1907 | }, | |
214e1eca | 1908 | { .ival = "cpuio", |
03e20d68 | 1909 | .help = "CPU cycle burner engine", |
214e1eca | 1910 | }, |
67bf9823 | 1911 | #ifdef CONFIG_RDMA |
21b8aee8 | 1912 | { .ival = "rdma", |
1913 | .help = "RDMA IO engine", | |
1914 | }, | |
8200b8c7 | 1915 | #endif |
997843cb | 1916 | #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT |
1ecc95ca JA |
1917 | { .ival = "e4defrag", |
1918 | .help = "ext4 defrag engine", | |
1919 | }, | |
1920 | #endif | |
997843cb | 1921 | #ifdef CONFIG_LINUX_FALLOCATE |
1ecc95ca JA |
1922 | { .ival = "falloc", |
1923 | .help = "fallocate() file based engine", | |
1924 | }, | |
b8c82a46 | 1925 | #endif |
a7c386f4 | 1926 | #ifdef CONFIG_GFAPI |
1927 | { .ival = "gfapi", | |
cc47f094 | 1928 | .help = "Glusterfs libgfapi(sync) based engine" |
1929 | }, | |
1930 | { .ival = "gfapi_async", | |
1931 | .help = "Glusterfs libgfapi(async) based engine" | |
a7c386f4 | 1932 | }, |
1933 | #endif | |
1b10477b | 1934 | #ifdef CONFIG_LIBHDFS |
b74e419e | 1935 | { .ival = "libhdfs", |
1b10477b MM |
1936 | .help = "Hadoop Distributed Filesystem (HDFS) engine" |
1937 | }, | |
5c4ef02e JA |
1938 | #endif |
1939 | #ifdef CONFIG_PMEMBLK | |
1940 | { .ival = "pmemblk", | |
363a5f65 | 1941 | .help = "PMDK libpmemblk based IO engine", |
5c4ef02e JA |
1942 | }, |
1943 | ||
104ee4de | 1944 | #endif |
a40e7a59 GB |
1945 | #ifdef CONFIG_IME |
1946 | { .ival = "ime_psync", | |
1947 | .help = "DDN's IME synchronous IO engine", | |
1948 | }, | |
1949 | { .ival = "ime_psyncv", | |
1950 | .help = "DDN's IME synchronous IO engine using iovecs", | |
1951 | }, | |
1952 | { .ival = "ime_aio", | |
1953 | .help = "DDN's IME asynchronous IO engine", | |
1954 | }, | |
1955 | #endif | |
104ee4de DJ |
1956 | #ifdef CONFIG_LINUX_DEVDAX |
1957 | { .ival = "dev-dax", | |
1958 | .help = "DAX Device based IO engine", | |
1959 | }, | |
1b10477b | 1960 | #endif |
edc5fa12 JA |
1961 | { |
1962 | .ival = "filecreate", | |
1963 | .help = "File creation engine", | |
1964 | }, | |
214e1eca JA |
1965 | { .ival = "external", |
1966 | .help = "Load external engine (append name)", | |
6730b40f | 1967 | .cb = str_ioengine_external_cb, |
214e1eca | 1968 | }, |
ae0db592 TI |
1969 | #ifdef CONFIG_LIBPMEM |
1970 | { .ival = "libpmem", | |
363a5f65 | 1971 | .help = "PMDK libpmem based IO engine", |
ae0db592 | 1972 | }, |
c2f6a13d LMB |
1973 | #endif |
1974 | #ifdef CONFIG_HTTP | |
1975 | { .ival = "http", | |
1976 | .help = "HTTP (WebDAV/S3) IO engine", | |
1977 | }, | |
ae0db592 | 1978 | #endif |
d643a1e2 RJ |
1979 | { .ival = "nbd", |
1980 | .help = "Network Block Device (NBD) IO engine" | |
1981 | }, | |
214e1eca JA |
1982 | }, |
1983 | }, | |
1984 | { | |
1985 | .name = "iodepth", | |
e8b0e958 | 1986 | .lname = "IO Depth", |
214e1eca | 1987 | .type = FIO_OPT_INT, |
a609f12a | 1988 | .off1 = offsetof(struct thread_options, iodepth), |
03e20d68 | 1989 | .help = "Number of IO buffers to keep in flight", |
757aff4f | 1990 | .minval = 1, |
20eb06bd | 1991 | .interval = 1, |
214e1eca | 1992 | .def = "1", |
e8b0e958 | 1993 | .category = FIO_OPT_C_IO, |
0626037e | 1994 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca JA |
1995 | }, |
1996 | { | |
1997 | .name = "iodepth_batch", | |
e8b0e958 | 1998 | .lname = "IO Depth batch", |
4950421a | 1999 | .alias = "iodepth_batch_submit", |
214e1eca | 2000 | .type = FIO_OPT_INT, |
a609f12a | 2001 | .off1 = offsetof(struct thread_options, iodepth_batch), |
d65db441 | 2002 | .help = "Number of IO buffers to submit in one go", |
afdf9352 | 2003 | .parent = "iodepth", |
d71c154c | 2004 | .hide = 1, |
20eb06bd | 2005 | .interval = 1, |
a2e6f8ac | 2006 | .def = "1", |
e8b0e958 | 2007 | .category = FIO_OPT_C_IO, |
0626037e | 2008 | .group = FIO_OPT_G_IO_BASIC, |
4950421a JA |
2009 | }, |
2010 | { | |
82407585 RP |
2011 | .name = "iodepth_batch_complete_min", |
2012 | .lname = "Min IO depth batch complete", | |
2013 | .alias = "iodepth_batch_complete", | |
4950421a | 2014 | .type = FIO_OPT_INT, |
a609f12a | 2015 | .off1 = offsetof(struct thread_options, iodepth_batch_complete_min), |
82407585 | 2016 | .help = "Min number of IO buffers to retrieve in one go", |
4950421a | 2017 | .parent = "iodepth", |
d71c154c | 2018 | .hide = 1, |
4950421a | 2019 | .minval = 0, |
20eb06bd | 2020 | .interval = 1, |
4950421a | 2021 | .def = "1", |
e8b0e958 | 2022 | .category = FIO_OPT_C_IO, |
0626037e | 2023 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca | 2024 | }, |
82407585 RP |
2025 | { |
2026 | .name = "iodepth_batch_complete_max", | |
2027 | .lname = "Max IO depth batch complete", | |
2028 | .type = FIO_OPT_INT, | |
a609f12a | 2029 | .off1 = offsetof(struct thread_options, iodepth_batch_complete_max), |
82407585 RP |
2030 | .help = "Max number of IO buffers to retrieve in one go", |
2031 | .parent = "iodepth", | |
2032 | .hide = 1, | |
2033 | .minval = 0, | |
2034 | .interval = 1, | |
2035 | .category = FIO_OPT_C_IO, | |
2036 | .group = FIO_OPT_G_IO_BASIC, | |
2037 | }, | |
214e1eca JA |
2038 | { |
2039 | .name = "iodepth_low", | |
e8b0e958 | 2040 | .lname = "IO Depth batch low", |
214e1eca | 2041 | .type = FIO_OPT_INT, |
a609f12a | 2042 | .off1 = offsetof(struct thread_options, iodepth_low), |
214e1eca | 2043 | .help = "Low water mark for queuing depth", |
afdf9352 | 2044 | .parent = "iodepth", |
d71c154c | 2045 | .hide = 1, |
20eb06bd | 2046 | .interval = 1, |
e8b0e958 | 2047 | .category = FIO_OPT_C_IO, |
0626037e | 2048 | .group = FIO_OPT_G_IO_BASIC, |
214e1eca | 2049 | }, |
997b5680 SW |
2050 | { |
2051 | .name = "serialize_overlap", | |
2052 | .lname = "Serialize overlap", | |
2053 | .off1 = offsetof(struct thread_options, serialize_overlap), | |
2054 | .type = FIO_OPT_BOOL, | |
2055 | .help = "Wait for in-flight IOs that collide to complete", | |
2056 | .parent = "iodepth", | |
2057 | .def = "0", | |
2058 | .category = FIO_OPT_C_IO, | |
2059 | .group = FIO_OPT_G_IO_BASIC, | |
2060 | }, | |
a9da8ab2 JA |
2061 | { |
2062 | .name = "io_submit_mode", | |
2063 | .lname = "IO submit mode", | |
2064 | .type = FIO_OPT_STR, | |
a609f12a | 2065 | .off1 = offsetof(struct thread_options, io_submit_mode), |
a9da8ab2 JA |
2066 | .help = "How IO submissions and completions are done", |
2067 | .def = "inline", | |
2068 | .category = FIO_OPT_C_IO, | |
2069 | .group = FIO_OPT_G_IO_BASIC, | |
2070 | .posval = { | |
2071 | { .ival = "inline", | |
2072 | .oval = IO_MODE_INLINE, | |
2073 | .help = "Submit and complete IO inline", | |
2074 | }, | |
2075 | { .ival = "offload", | |
2076 | .oval = IO_MODE_OFFLOAD, | |
2077 | .help = "Offload submit and complete to threads", | |
2078 | }, | |
2079 | }, | |
2080 | }, | |
214e1eca JA |
2081 | { |
2082 | .name = "size", | |
e8b0e958 | 2083 | .lname = "Size", |
214e1eca | 2084 | .type = FIO_OPT_STR_VAL, |
7bb59102 | 2085 | .cb = str_size_cb, |
a609f12a | 2086 | .off1 = offsetof(struct thread_options, size), |
214e1eca | 2087 | .help = "Total size of device or files", |
20eb06bd | 2088 | .interval = 1024 * 1024, |
e8b0e958 JA |
2089 | .category = FIO_OPT_C_IO, |
2090 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2091 | }, |
77731b29 | 2092 | { |
a4d3b4db JA |
2093 | .name = "io_size", |
2094 | .alias = "io_limit", | |
2095 | .lname = "IO Size", | |
77731b29 | 2096 | .type = FIO_OPT_STR_VAL, |
8b38f401 | 2097 | .cb = str_io_size_cb, |
5be9bf09 | 2098 | .off1 = offsetof(struct thread_options, io_size), |
1684f7fd | 2099 | .help = "Total size of I/O to be performed", |
77731b29 JA |
2100 | .interval = 1024 * 1024, |
2101 | .category = FIO_OPT_C_IO, | |
2102 | .group = FIO_OPT_G_INVALID, | |
2103 | }, | |
aa31f1f1 SL |
2104 | { |
2105 | .name = "fill_device", | |
e8b0e958 | 2106 | .lname = "Fill device", |
74586c1e | 2107 | .alias = "fill_fs", |
aa31f1f1 | 2108 | .type = FIO_OPT_BOOL, |
a609f12a | 2109 | .off1 = offsetof(struct thread_options, fill_device), |
aa31f1f1 SL |
2110 | .help = "Write until an ENOSPC error occurs", |
2111 | .def = "0", | |
e8b0e958 JA |
2112 | .category = FIO_OPT_C_FILE, |
2113 | .group = FIO_OPT_G_INVALID, | |
aa31f1f1 | 2114 | }, |
214e1eca JA |
2115 | { |
2116 | .name = "filesize", | |
e8b0e958 | 2117 | .lname = "File size", |
214e1eca | 2118 | .type = FIO_OPT_STR_VAL, |
a609f12a JA |
2119 | .off1 = offsetof(struct thread_options, file_size_low), |
2120 | .off2 = offsetof(struct thread_options, file_size_high), | |
c3edbdba | 2121 | .minval = 1, |
214e1eca | 2122 | .help = "Size of individual files", |
20eb06bd | 2123 | .interval = 1024 * 1024, |
e8b0e958 JA |
2124 | .category = FIO_OPT_C_FILE, |
2125 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2126 | }, |
bedc9dc2 JA |
2127 | { |
2128 | .name = "file_append", | |
2129 | .lname = "File append", | |
2130 | .type = FIO_OPT_BOOL, | |
a609f12a | 2131 | .off1 = offsetof(struct thread_options, file_append), |
bedc9dc2 JA |
2132 | .help = "IO will start at the end of the file(s)", |
2133 | .def = "0", | |
2134 | .category = FIO_OPT_C_FILE, | |
2135 | .group = FIO_OPT_G_INVALID, | |
2136 | }, | |
67a1000f JA |
2137 | { |
2138 | .name = "offset", | |
e8b0e958 | 2139 | .lname = "IO offset", |
67a1000f JA |
2140 | .alias = "fileoffset", |
2141 | .type = FIO_OPT_STR_VAL, | |
89978a6b | 2142 | .cb = str_offset_cb, |
a609f12a | 2143 | .off1 = offsetof(struct thread_options, start_offset), |
67a1000f JA |
2144 | .help = "Start IO from this offset", |
2145 | .def = "0", | |
20eb06bd | 2146 | .interval = 1024 * 1024, |
e8b0e958 JA |
2147 | .category = FIO_OPT_C_IO, |
2148 | .group = FIO_OPT_G_INVALID, | |
67a1000f | 2149 | }, |
83c8b093 JF |
2150 | { |
2151 | .name = "offset_align", | |
2152 | .lname = "IO offset alignment", | |
2153 | .type = FIO_OPT_INT, | |
2154 | .off1 = offsetof(struct thread_options, start_offset_align), | |
2155 | .help = "Start IO from this offset alignment", | |
2156 | .def = "0", | |
2157 | .interval = 512, | |
2158 | .category = FIO_OPT_C_IO, | |
2159 | .group = FIO_OPT_G_INVALID, | |
2160 | }, | |
2d7cd868 JA |
2161 | { |
2162 | .name = "offset_increment", | |
e8b0e958 | 2163 | .lname = "IO offset increment", |
2d7cd868 | 2164 | .type = FIO_OPT_STR_VAL, |
0b288ba1 | 2165 | .cb = str_offset_increment_cb, |
a609f12a | 2166 | .off1 = offsetof(struct thread_options, offset_increment), |
2d7cd868 JA |
2167 | .help = "What is the increment from one offset to the next", |
2168 | .parent = "offset", | |
d71c154c | 2169 | .hide = 1, |
2d7cd868 | 2170 | .def = "0", |
20eb06bd | 2171 | .interval = 1024 * 1024, |
e8b0e958 JA |
2172 | .category = FIO_OPT_C_IO, |
2173 | .group = FIO_OPT_G_INVALID, | |
2d7cd868 | 2174 | }, |
ddf24e42 JA |
2175 | { |
2176 | .name = "number_ios", | |
2177 | .lname = "Number of IOs to perform", | |
2178 | .type = FIO_OPT_STR_VAL, | |
a609f12a | 2179 | .off1 = offsetof(struct thread_options, number_ios), |
be3fec7d | 2180 | .help = "Force job completion after this number of IOs", |
ddf24e42 JA |
2181 | .def = "0", |
2182 | .category = FIO_OPT_C_IO, | |
2183 | .group = FIO_OPT_G_INVALID, | |
2184 | }, | |
214e1eca JA |
2185 | { |
2186 | .name = "bs", | |
e8b0e958 | 2187 | .lname = "Block size", |
d3aad8f2 | 2188 | .alias = "blocksize", |
5fff9543 | 2189 | .type = FIO_OPT_ULL, |
a609f12a JA |
2190 | .off1 = offsetof(struct thread_options, bs[DDIR_READ]), |
2191 | .off2 = offsetof(struct thread_options, bs[DDIR_WRITE]), | |
2192 | .off3 = offsetof(struct thread_options, bs[DDIR_TRIM]), | |
c3edbdba | 2193 | .minval = 1, |
214e1eca | 2194 | .help = "Block size unit", |
2b9136a3 | 2195 | .def = "4096", |
67a1000f | 2196 | .parent = "rw", |
d71c154c | 2197 | .hide = 1, |
20eb06bd | 2198 | .interval = 512, |
e8b0e958 JA |
2199 | .category = FIO_OPT_C_IO, |
2200 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2201 | }, |
2b7a01d0 JA |
2202 | { |
2203 | .name = "ba", | |
e8b0e958 | 2204 | .lname = "Block size align", |
2b7a01d0 | 2205 | .alias = "blockalign", |
5fff9543 | 2206 | .type = FIO_OPT_ULL, |
a609f12a JA |
2207 | .off1 = offsetof(struct thread_options, ba[DDIR_READ]), |
2208 | .off2 = offsetof(struct thread_options, ba[DDIR_WRITE]), | |
2209 | .off3 = offsetof(struct thread_options, ba[DDIR_TRIM]), | |
2b7a01d0 JA |
2210 | .minval = 1, |
2211 | .help = "IO block offset alignment", | |
2212 | .parent = "rw", | |
d71c154c | 2213 | .hide = 1, |
20eb06bd | 2214 | .interval = 512, |
e8b0e958 JA |
2215 | .category = FIO_OPT_C_IO, |
2216 | .group = FIO_OPT_G_INVALID, | |
2b7a01d0 | 2217 | }, |
214e1eca JA |
2218 | { |
2219 | .name = "bsrange", | |
e8b0e958 | 2220 | .lname = "Block size range", |
d3aad8f2 | 2221 | .alias = "blocksize_range", |
214e1eca | 2222 | .type = FIO_OPT_RANGE, |
a609f12a JA |
2223 | .off1 = offsetof(struct thread_options, min_bs[DDIR_READ]), |
2224 | .off2 = offsetof(struct thread_options, max_bs[DDIR_READ]), | |
2225 | .off3 = offsetof(struct thread_options, min_bs[DDIR_WRITE]), | |
2226 | .off4 = offsetof(struct thread_options, max_bs[DDIR_WRITE]), | |
2227 | .off5 = offsetof(struct thread_options, min_bs[DDIR_TRIM]), | |
2228 | .off6 = offsetof(struct thread_options, max_bs[DDIR_TRIM]), | |
c3edbdba | 2229 | .minval = 1, |
214e1eca | 2230 | .help = "Set block size range (in more detail than bs)", |
67a1000f | 2231 | .parent = "rw", |
d71c154c | 2232 | .hide = 1, |
20eb06bd | 2233 | .interval = 4096, |
e8b0e958 JA |
2234 | .category = FIO_OPT_C_IO, |
2235 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2236 | }, |
564ca972 JA |
2237 | { |
2238 | .name = "bssplit", | |
e8b0e958 | 2239 | .lname = "Block size split", |
5fff9543 | 2240 | .type = FIO_OPT_STR_ULL, |
564ca972 | 2241 | .cb = str_bssplit_cb, |
a609f12a | 2242 | .off1 = offsetof(struct thread_options, bssplit), |
564ca972 JA |
2243 | .help = "Set a specific mix of block sizes", |
2244 | .parent = "rw", | |
d71c154c | 2245 | .hide = 1, |
e8b0e958 JA |
2246 | .category = FIO_OPT_C_IO, |
2247 | .group = FIO_OPT_G_INVALID, | |
564ca972 | 2248 | }, |
214e1eca JA |
2249 | { |
2250 | .name = "bs_unaligned", | |
e8b0e958 | 2251 | .lname = "Block size unaligned", |
d3aad8f2 | 2252 | .alias = "blocksize_unaligned", |
214e1eca | 2253 | .type = FIO_OPT_STR_SET, |
a609f12a | 2254 | .off1 = offsetof(struct thread_options, bs_unaligned), |
214e1eca | 2255 | .help = "Don't sector align IO buffer sizes", |
67a1000f | 2256 | .parent = "rw", |
d71c154c | 2257 | .hide = 1, |
e8b0e958 JA |
2258 | .category = FIO_OPT_C_IO, |
2259 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2260 | }, |
6aca9b3d JA |
2261 | { |
2262 | .name = "bs_is_seq_rand", | |
2263 | .lname = "Block size division is seq/random (not read/write)", | |
2264 | .type = FIO_OPT_BOOL, | |
a609f12a | 2265 | .off1 = offsetof(struct thread_options, bs_is_seq_rand), |
86d59660 | 2266 | .help = "Consider any blocksize setting to be sequential,random", |
6aca9b3d JA |
2267 | .def = "0", |
2268 | .parent = "blocksize", | |
2269 | .category = FIO_OPT_C_IO, | |
2270 | .group = FIO_OPT_G_INVALID, | |
2271 | }, | |
214e1eca JA |
2272 | { |
2273 | .name = "randrepeat", | |
e8b0e958 | 2274 | .lname = "Random repeatable", |
214e1eca | 2275 | .type = FIO_OPT_BOOL, |
a609f12a | 2276 | .off1 = offsetof(struct thread_options, rand_repeatable), |
214e1eca JA |
2277 | .help = "Use repeatable random IO pattern", |
2278 | .def = "1", | |
67a1000f | 2279 | .parent = "rw", |
d71c154c | 2280 | .hide = 1, |
e8b0e958 | 2281 | .category = FIO_OPT_C_IO, |
3ceb458f | 2282 | .group = FIO_OPT_G_RANDOM, |
214e1eca | 2283 | }, |
04778baf JA |
2284 | { |
2285 | .name = "randseed", | |
2286 | .lname = "The random generator seed", | |
363cffa7 | 2287 | .type = FIO_OPT_STR_VAL, |
a609f12a | 2288 | .off1 = offsetof(struct thread_options, rand_seed), |
04778baf | 2289 | .help = "Set the random generator seed value", |
40fe5e7b | 2290 | .def = "0x89", |
04778baf JA |
2291 | .parent = "rw", |
2292 | .category = FIO_OPT_C_IO, | |
2293 | .group = FIO_OPT_G_RANDOM, | |
2294 | }, | |
214e1eca JA |
2295 | { |
2296 | .name = "norandommap", | |
e8b0e958 | 2297 | .lname = "No randommap", |
214e1eca | 2298 | .type = FIO_OPT_STR_SET, |
a609f12a | 2299 | .off1 = offsetof(struct thread_options, norandommap), |
214e1eca | 2300 | .help = "Accept potential duplicate random blocks", |
67a1000f | 2301 | .parent = "rw", |
d71c154c | 2302 | .hide = 1, |
b2452a43 | 2303 | .hide_on_set = 1, |
e8b0e958 | 2304 | .category = FIO_OPT_C_IO, |
3ceb458f | 2305 | .group = FIO_OPT_G_RANDOM, |
214e1eca | 2306 | }, |
2b386d25 JA |
2307 | { |
2308 | .name = "softrandommap", | |
e8b0e958 | 2309 | .lname = "Soft randommap", |
2b386d25 | 2310 | .type = FIO_OPT_BOOL, |
a609f12a | 2311 | .off1 = offsetof(struct thread_options, softrandommap), |
f66ab3c8 | 2312 | .help = "Set norandommap if randommap allocation fails", |
2b386d25 | 2313 | .parent = "norandommap", |
d71c154c | 2314 | .hide = 1, |
2b386d25 | 2315 | .def = "0", |
e8b0e958 | 2316 | .category = FIO_OPT_C_IO, |
3ceb458f | 2317 | .group = FIO_OPT_G_RANDOM, |
2b386d25 | 2318 | }, |
8055e41d JA |
2319 | { |
2320 | .name = "random_generator", | |
cce2fdfe | 2321 | .lname = "Random Generator", |
8055e41d | 2322 | .type = FIO_OPT_STR, |
a609f12a | 2323 | .off1 = offsetof(struct thread_options, random_generator), |
8055e41d JA |
2324 | .help = "Type of random number generator to use", |
2325 | .def = "tausworthe", | |
2326 | .posval = { | |
2327 | { .ival = "tausworthe", | |
2328 | .oval = FIO_RAND_GEN_TAUSWORTHE, | |
2329 | .help = "Strong Tausworthe generator", | |
2330 | }, | |
2331 | { .ival = "lfsr", | |
2332 | .oval = FIO_RAND_GEN_LFSR, | |
2333 | .help = "Variable length LFSR", | |
2334 | }, | |
c3546b53 JA |
2335 | { |
2336 | .ival = "tausworthe64", | |
2337 | .oval = FIO_RAND_GEN_TAUSWORTHE64, | |
2338 | .help = "64-bit Tausworthe variant", | |
2339 | }, | |
8055e41d | 2340 | }, |
48107598 JA |
2341 | .category = FIO_OPT_C_IO, |
2342 | .group = FIO_OPT_G_RANDOM, | |
8055e41d | 2343 | }, |
e25839d4 JA |
2344 | { |
2345 | .name = "random_distribution", | |
cce2fdfe | 2346 | .lname = "Random Distribution", |
e25839d4 | 2347 | .type = FIO_OPT_STR, |
a609f12a | 2348 | .off1 = offsetof(struct thread_options, random_distribution), |
e25839d4 JA |
2349 | .cb = str_random_distribution_cb, |
2350 | .help = "Random offset distribution generator", | |
2351 | .def = "random", | |
2352 | .posval = { | |
2353 | { .ival = "random", | |
2354 | .oval = FIO_RAND_DIST_RANDOM, | |
2355 | .help = "Completely random", | |
2356 | }, | |
2357 | { .ival = "zipf", | |
2358 | .oval = FIO_RAND_DIST_ZIPF, | |
2359 | .help = "Zipf distribution", | |
2360 | }, | |
925fee33 JA |
2361 | { .ival = "pareto", |
2362 | .oval = FIO_RAND_DIST_PARETO, | |
2363 | .help = "Pareto distribution", | |
2364 | }, | |
56d9fa4b JA |
2365 | { .ival = "normal", |
2366 | .oval = FIO_RAND_DIST_GAUSS, | |
ba2b3b07 | 2367 | .help = "Normal (Gaussian) distribution", |
56d9fa4b | 2368 | }, |
e0a04ac1 JA |
2369 | { .ival = "zoned", |
2370 | .oval = FIO_RAND_DIST_ZONED, | |
2371 | .help = "Zoned random distribution", | |
2372 | }, | |
59466396 JA |
2373 | { .ival = "zoned_abs", |
2374 | .oval = FIO_RAND_DIST_ZONED_ABS, | |
2375 | .help = "Zoned absolute random distribution", | |
2376 | }, | |
e25839d4 | 2377 | }, |
48107598 JA |
2378 | .category = FIO_OPT_C_IO, |
2379 | .group = FIO_OPT_G_RANDOM, | |
e25839d4 | 2380 | }, |
211c9b89 JA |
2381 | { |
2382 | .name = "percentage_random", | |
2383 | .lname = "Percentage Random", | |
2384 | .type = FIO_OPT_INT, | |
a609f12a JA |
2385 | .off1 = offsetof(struct thread_options, perc_rand[DDIR_READ]), |
2386 | .off2 = offsetof(struct thread_options, perc_rand[DDIR_WRITE]), | |
2387 | .off3 = offsetof(struct thread_options, perc_rand[DDIR_TRIM]), | |
211c9b89 JA |
2388 | .maxval = 100, |
2389 | .help = "Percentage of seq/random mix that should be random", | |
d9472271 | 2390 | .def = "100,100,100", |
211c9b89 JA |
2391 | .interval = 5, |
2392 | .inverse = "percentage_sequential", | |
2393 | .category = FIO_OPT_C_IO, | |
2394 | .group = FIO_OPT_G_RANDOM, | |
2395 | }, | |
2396 | { | |
2397 | .name = "percentage_sequential", | |
2398 | .lname = "Percentage Sequential", | |
d9472271 | 2399 | .type = FIO_OPT_DEPRECATED, |
211c9b89 JA |
2400 | .category = FIO_OPT_C_IO, |
2401 | .group = FIO_OPT_G_RANDOM, | |
2402 | }, | |
56e2a5fc CE |
2403 | { |
2404 | .name = "allrandrepeat", | |
cce2fdfe | 2405 | .lname = "All Random Repeat", |
56e2a5fc | 2406 | .type = FIO_OPT_BOOL, |
a609f12a | 2407 | .off1 = offsetof(struct thread_options, allrand_repeatable), |
56e2a5fc CE |
2408 | .help = "Use repeatable random numbers for everything", |
2409 | .def = "0", | |
a869d9c6 JA |
2410 | .category = FIO_OPT_C_IO, |
2411 | .group = FIO_OPT_G_RANDOM, | |
56e2a5fc | 2412 | }, |
214e1eca JA |
2413 | { |
2414 | .name = "nrfiles", | |
e8b0e958 | 2415 | .lname = "Number of files", |
d7c8be03 | 2416 | .alias = "nr_files", |
214e1eca | 2417 | .type = FIO_OPT_INT, |
a609f12a | 2418 | .off1 = offsetof(struct thread_options, nr_files), |
214e1eca JA |
2419 | .help = "Split job workload between this number of files", |
2420 | .def = "1", | |
20eb06bd | 2421 | .interval = 1, |
e8b0e958 JA |
2422 | .category = FIO_OPT_C_FILE, |
2423 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2424 | }, |
2425 | { | |
2426 | .name = "openfiles", | |
e8b0e958 | 2427 | .lname = "Number of open files", |
214e1eca | 2428 | .type = FIO_OPT_INT, |
a609f12a | 2429 | .off1 = offsetof(struct thread_options, open_files), |
214e1eca | 2430 | .help = "Number of files to keep open at the same time", |
e8b0e958 JA |
2431 | .category = FIO_OPT_C_FILE, |
2432 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2433 | }, |
2434 | { | |
2435 | .name = "file_service_type", | |
e8b0e958 | 2436 | .lname = "File service type", |
214e1eca JA |
2437 | .type = FIO_OPT_STR, |
2438 | .cb = str_fst_cb, | |
a609f12a | 2439 | .off1 = offsetof(struct thread_options, file_service_type), |
214e1eca JA |
2440 | .help = "How to select which file to service next", |
2441 | .def = "roundrobin", | |
e8b0e958 JA |
2442 | .category = FIO_OPT_C_FILE, |
2443 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2444 | .posval = { |
2445 | { .ival = "random", | |
2446 | .oval = FIO_FSERVICE_RANDOM, | |
8c07860d JA |
2447 | .help = "Choose a file at random (uniform)", |
2448 | }, | |
2449 | { .ival = "zipf", | |
2450 | .oval = FIO_FSERVICE_ZIPF, | |
2451 | .help = "Zipf randomized", | |
2452 | }, | |
2453 | { .ival = "pareto", | |
2454 | .oval = FIO_FSERVICE_PARETO, | |
2455 | .help = "Pareto randomized", | |
2456 | }, | |
dd3503d3 SW |
2457 | { .ival = "normal", |
2458 | .oval = FIO_FSERVICE_GAUSS, | |
2459 | .help = "Normal (Gaussian) randomized", | |
2460 | }, | |
8c07860d JA |
2461 | { .ival = "gauss", |
2462 | .oval = FIO_FSERVICE_GAUSS, | |
dd3503d3 | 2463 | .help = "Alias for normal", |
214e1eca JA |
2464 | }, |
2465 | { .ival = "roundrobin", | |
2466 | .oval = FIO_FSERVICE_RR, | |
2467 | .help = "Round robin select files", | |
2468 | }, | |
a086c257 JA |
2469 | { .ival = "sequential", |
2470 | .oval = FIO_FSERVICE_SEQ, | |
2471 | .help = "Finish one file before moving to the next", | |
2472 | }, | |
214e1eca | 2473 | }, |
67a1000f | 2474 | .parent = "nrfiles", |
d71c154c | 2475 | .hide = 1, |
67a1000f | 2476 | }, |
7bc8c2cf JA |
2477 | { |
2478 | .name = "fallocate", | |
e8b0e958 | 2479 | .lname = "Fallocate", |
a596f047 | 2480 | .type = FIO_OPT_STR, |
a609f12a | 2481 | .off1 = offsetof(struct thread_options, fallocate_mode), |
a596f047 | 2482 | .help = "Whether pre-allocation is performed when laying out files", |
38ca5f03 | 2483 | #ifdef FIO_HAVE_DEFAULT_FALLOCATE |
2c3e17be | 2484 | .def = "native", |
38ca5f03 TV |
2485 | #else |
2486 | .def = "none", | |
2487 | #endif | |
e8b0e958 JA |
2488 | .category = FIO_OPT_C_FILE, |
2489 | .group = FIO_OPT_G_INVALID, | |
a596f047 EG |
2490 | .posval = { |
2491 | { .ival = "none", | |
2492 | .oval = FIO_FALLOCATE_NONE, | |
2493 | .help = "Do not pre-allocate space", | |
2494 | }, | |
2c3e17be SW |
2495 | { .ival = "native", |
2496 | .oval = FIO_FALLOCATE_NATIVE, | |
2497 | .help = "Use native pre-allocation if possible", | |
2498 | }, | |
2499 | #ifdef CONFIG_POSIX_FALLOCATE | |
a596f047 EG |
2500 | { .ival = "posix", |
2501 | .oval = FIO_FALLOCATE_POSIX, | |
2502 | .help = "Use posix_fallocate()", | |
2503 | }, | |
2c3e17be | 2504 | #endif |
97ac992c | 2505 | #ifdef CONFIG_LINUX_FALLOCATE |
a596f047 EG |
2506 | { .ival = "keep", |
2507 | .oval = FIO_FALLOCATE_KEEP_SIZE, | |
2508 | .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)", | |
2509 | }, | |
7bc8c2cf | 2510 | #endif |
38ca5f03 TV |
2511 | { .ival = "truncate", |
2512 | .oval = FIO_FALLOCATE_TRUNCATE, | |
2513 | .help = "Truncate file to final size instead of allocating" | |
2514 | }, | |
a596f047 EG |
2515 | /* Compatibility with former boolean values */ |
2516 | { .ival = "0", | |
2517 | .oval = FIO_FALLOCATE_NONE, | |
2518 | .help = "Alias for 'none'", | |
2519 | }, | |
2c3e17be | 2520 | #ifdef CONFIG_POSIX_FALLOCATE |
a596f047 EG |
2521 | { .ival = "1", |
2522 | .oval = FIO_FALLOCATE_POSIX, | |
2523 | .help = "Alias for 'posix'", | |
2524 | }, | |
2c3e17be | 2525 | #endif |
a596f047 EG |
2526 | }, |
2527 | }, | |
67a1000f JA |
2528 | { |
2529 | .name = "fadvise_hint", | |
e8b0e958 | 2530 | .lname = "Fadvise hint", |
ecb2083d | 2531 | .type = FIO_OPT_STR, |
a609f12a | 2532 | .off1 = offsetof(struct thread_options, fadvise_hint), |
ecb2083d JA |
2533 | .posval = { |
2534 | { .ival = "0", | |
2535 | .oval = F_ADV_NONE, | |
c712c97a | 2536 | .help = "Don't issue fadvise/madvise", |
ecb2083d JA |
2537 | }, |
2538 | { .ival = "1", | |
2539 | .oval = F_ADV_TYPE, | |
2540 | .help = "Advise using fio IO pattern", | |
2541 | }, | |
2542 | { .ival = "random", | |
2543 | .oval = F_ADV_RANDOM, | |
2544 | .help = "Advise using FADV_RANDOM", | |
2545 | }, | |
2546 | { .ival = "sequential", | |
2547 | .oval = F_ADV_SEQUENTIAL, | |
2548 | .help = "Advise using FADV_SEQUENTIAL", | |
2549 | }, | |
2550 | }, | |
67a1000f JA |
2551 | .help = "Use fadvise() to advise the kernel on IO pattern", |
2552 | .def = "1", | |
e8b0e958 JA |
2553 | .category = FIO_OPT_C_FILE, |
2554 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2555 | }, |
2556 | { | |
2557 | .name = "fsync", | |
e8b0e958 | 2558 | .lname = "Fsync", |
214e1eca | 2559 | .type = FIO_OPT_INT, |
a609f12a | 2560 | .off1 = offsetof(struct thread_options, fsync_blocks), |
214e1eca JA |
2561 | .help = "Issue fsync for writes every given number of blocks", |
2562 | .def = "0", | |
20eb06bd | 2563 | .interval = 1, |
e8b0e958 JA |
2564 | .category = FIO_OPT_C_FILE, |
2565 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 2566 | }, |
5f9099ea JA |
2567 | { |
2568 | .name = "fdatasync", | |
e8b0e958 | 2569 | .lname = "Fdatasync", |
5f9099ea | 2570 | .type = FIO_OPT_INT, |
a609f12a | 2571 | .off1 = offsetof(struct thread_options, fdatasync_blocks), |
5f9099ea JA |
2572 | .help = "Issue fdatasync for writes every given number of blocks", |
2573 | .def = "0", | |
20eb06bd | 2574 | .interval = 1, |
e8b0e958 JA |
2575 | .category = FIO_OPT_C_FILE, |
2576 | .group = FIO_OPT_G_INVALID, | |
5f9099ea | 2577 | }, |
1ef2b6be JA |
2578 | { |
2579 | .name = "write_barrier", | |
e8b0e958 | 2580 | .lname = "Write barrier", |
1ef2b6be | 2581 | .type = FIO_OPT_INT, |
a609f12a | 2582 | .off1 = offsetof(struct thread_options, barrier_blocks), |
1ef2b6be JA |
2583 | .help = "Make every Nth write a barrier write", |
2584 | .def = "0", | |
20eb06bd | 2585 | .interval = 1, |
e8b0e958 JA |
2586 | .category = FIO_OPT_C_IO, |
2587 | .group = FIO_OPT_G_INVALID, | |
1ef2b6be | 2588 | }, |
67bf9823 | 2589 | #ifdef CONFIG_SYNC_FILE_RANGE |
44f29692 JA |
2590 | { |
2591 | .name = "sync_file_range", | |
e8b0e958 | 2592 | .lname = "Sync file range", |
44f29692 JA |
2593 | .posval = { |
2594 | { .ival = "wait_before", | |
2595 | .oval = SYNC_FILE_RANGE_WAIT_BEFORE, | |
2596 | .help = "SYNC_FILE_RANGE_WAIT_BEFORE", | |
ebadc0ce | 2597 | .orval = 1, |
44f29692 JA |
2598 | }, |
2599 | { .ival = "write", | |
2600 | .oval = SYNC_FILE_RANGE_WRITE, | |
2601 | .help = "SYNC_FILE_RANGE_WRITE", | |
ebadc0ce | 2602 | .orval = 1, |
44f29692 JA |
2603 | }, |
2604 | { | |
2605 | .ival = "wait_after", | |
2606 | .oval = SYNC_FILE_RANGE_WAIT_AFTER, | |
2607 | .help = "SYNC_FILE_RANGE_WAIT_AFTER", | |
ebadc0ce | 2608 | .orval = 1, |
44f29692 JA |
2609 | }, |
2610 | }, | |
3843deb3 | 2611 | .type = FIO_OPT_STR_MULTI, |
44f29692 | 2612 | .cb = str_sfr_cb, |
a609f12a | 2613 | .off1 = offsetof(struct thread_options, sync_file_range), |
44f29692 | 2614 | .help = "Use sync_file_range()", |
e8b0e958 JA |
2615 | .category = FIO_OPT_C_FILE, |
2616 | .group = FIO_OPT_G_INVALID, | |
44f29692 | 2617 | }, |
a275c37a | 2618 | #else |
54d0a315 | 2619 | { |
a275c37a JA |
2620 | .name = "sync_file_range", |
2621 | .lname = "Sync file range", | |
2622 | .type = FIO_OPT_UNSUPPORTED, | |
2623 | .help = "Your platform does not support sync_file_range", | |
2624 | }, | |
44f29692 | 2625 | #endif |
214e1eca JA |
2626 | { |
2627 | .name = "direct", | |
e8b0e958 | 2628 | .lname = "Direct I/O", |
214e1eca | 2629 | .type = FIO_OPT_BOOL, |
a609f12a | 2630 | .off1 = offsetof(struct thread_options, odirect), |
214e1eca JA |
2631 | .help = "Use O_DIRECT IO (negates buffered)", |
2632 | .def = "0", | |
a01a1bc5 | 2633 | .inverse = "buffered", |
e8b0e958 | 2634 | .category = FIO_OPT_C_IO, |
3ceb458f | 2635 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca | 2636 | }, |
d01612f3 CM |
2637 | { |
2638 | .name = "atomic", | |
2639 | .lname = "Atomic I/O", | |
2640 | .type = FIO_OPT_BOOL, | |
a609f12a | 2641 | .off1 = offsetof(struct thread_options, oatomic), |
d01612f3 CM |
2642 | .help = "Use Atomic IO with O_DIRECT (implies O_DIRECT)", |
2643 | .def = "0", | |
2644 | .category = FIO_OPT_C_IO, | |
2645 | .group = FIO_OPT_G_IO_TYPE, | |
2646 | }, | |
214e1eca JA |
2647 | { |
2648 | .name = "buffered", | |
e8b0e958 | 2649 | .lname = "Buffered I/O", |
214e1eca | 2650 | .type = FIO_OPT_BOOL, |
a609f12a | 2651 | .off1 = offsetof(struct thread_options, odirect), |
214e1eca JA |
2652 | .neg = 1, |
2653 | .help = "Use buffered IO (negates direct)", | |
2654 | .def = "1", | |
a01a1bc5 | 2655 | .inverse = "direct", |
e8b0e958 | 2656 | .category = FIO_OPT_C_IO, |
3ceb458f | 2657 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
2658 | }, |
2659 | { | |
2660 | .name = "overwrite", | |
e8b0e958 | 2661 | .lname = "Overwrite", |
214e1eca | 2662 | .type = FIO_OPT_BOOL, |
a609f12a | 2663 | .off1 = offsetof(struct thread_options, overwrite), |
214e1eca JA |
2664 | .help = "When writing, set whether to overwrite current data", |
2665 | .def = "0", | |
e8b0e958 JA |
2666 | .category = FIO_OPT_C_FILE, |
2667 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2668 | }, |
2669 | { | |
2670 | .name = "loops", | |
e8b0e958 | 2671 | .lname = "Loops", |
214e1eca | 2672 | .type = FIO_OPT_INT, |
a609f12a | 2673 | .off1 = offsetof(struct thread_options, loops), |
214e1eca JA |
2674 | .help = "Number of times to run the job", |
2675 | .def = "1", | |
20eb06bd | 2676 | .interval = 1, |
e8b0e958 | 2677 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2678 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
2679 | }, |
2680 | { | |
2681 | .name = "numjobs", | |
e8b0e958 | 2682 | .lname = "Number of jobs", |
214e1eca | 2683 | .type = FIO_OPT_INT, |
a609f12a | 2684 | .off1 = offsetof(struct thread_options, numjobs), |
214e1eca JA |
2685 | .help = "Duplicate this job this many times", |
2686 | .def = "1", | |
20eb06bd | 2687 | .interval = 1, |
e8b0e958 | 2688 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2689 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
2690 | }, |
2691 | { | |
2692 | .name = "startdelay", | |
e8b0e958 | 2693 | .lname = "Start delay", |
a5737c93 | 2694 | .type = FIO_OPT_STR_VAL_TIME, |
a609f12a JA |
2695 | .off1 = offsetof(struct thread_options, start_delay), |
2696 | .off2 = offsetof(struct thread_options, start_delay_high), | |
214e1eca JA |
2697 | .help = "Only start job when this period has passed", |
2698 | .def = "0", | |
0de5b26f | 2699 | .is_seconds = 1, |
88038bc7 | 2700 | .is_time = 1, |
e8b0e958 | 2701 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2702 | .group = FIO_OPT_G_RUNTIME, |
214e1eca JA |
2703 | }, |
2704 | { | |
2705 | .name = "runtime", | |
e8b0e958 | 2706 | .lname = "Runtime", |
214e1eca JA |
2707 | .alias = "timeout", |
2708 | .type = FIO_OPT_STR_VAL_TIME, | |
a609f12a | 2709 | .off1 = offsetof(struct thread_options, timeout), |
214e1eca JA |
2710 | .help = "Stop workload when this amount of time has passed", |
2711 | .def = "0", | |
0de5b26f | 2712 | .is_seconds = 1, |
88038bc7 | 2713 | .is_time = 1, |
e8b0e958 | 2714 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2715 | .group = FIO_OPT_G_RUNTIME, |
214e1eca | 2716 | }, |
cf4464ca JA |
2717 | { |
2718 | .name = "time_based", | |
e8b0e958 | 2719 | .lname = "Time based", |
cf4464ca | 2720 | .type = FIO_OPT_STR_SET, |
a609f12a | 2721 | .off1 = offsetof(struct thread_options, time_based), |
cf4464ca | 2722 | .help = "Keep running until runtime/timeout is met", |
e8b0e958 | 2723 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2724 | .group = FIO_OPT_G_RUNTIME, |
cf4464ca | 2725 | }, |
62167762 JC |
2726 | { |
2727 | .name = "verify_only", | |
2728 | .lname = "Verify only", | |
2729 | .type = FIO_OPT_STR_SET, | |
a609f12a | 2730 | .off1 = offsetof(struct thread_options, verify_only), |
62167762 JC |
2731 | .help = "Verifies previously written data is still valid", |
2732 | .category = FIO_OPT_C_GENERAL, | |
2733 | .group = FIO_OPT_G_RUNTIME, | |
2734 | }, | |
721938ae JA |
2735 | { |
2736 | .name = "ramp_time", | |
e8b0e958 | 2737 | .lname = "Ramp time", |
721938ae | 2738 | .type = FIO_OPT_STR_VAL_TIME, |
a609f12a | 2739 | .off1 = offsetof(struct thread_options, ramp_time), |
721938ae | 2740 | .help = "Ramp up time before measuring performance", |
0de5b26f | 2741 | .is_seconds = 1, |
88038bc7 | 2742 | .is_time = 1, |
e8b0e958 | 2743 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 2744 | .group = FIO_OPT_G_RUNTIME, |
721938ae | 2745 | }, |
c223da83 JA |
2746 | { |
2747 | .name = "clocksource", | |
e8b0e958 | 2748 | .lname = "Clock source", |
c223da83 JA |
2749 | .type = FIO_OPT_STR, |
2750 | .cb = fio_clock_source_cb, | |
a609f12a | 2751 | .off1 = offsetof(struct thread_options, clocksource), |
c223da83 | 2752 | .help = "What type of timing source to use", |
e8b0e958 | 2753 | .category = FIO_OPT_C_GENERAL, |
10860056 | 2754 | .group = FIO_OPT_G_CLOCK, |
c223da83 | 2755 | .posval = { |
67bf9823 | 2756 | #ifdef CONFIG_GETTIMEOFDAY |
c223da83 JA |
2757 | { .ival = "gettimeofday", |
2758 | .oval = CS_GTOD, | |
2759 | .help = "Use gettimeofday(2) for timing", | |
2760 | }, | |
67bf9823 JA |
2761 | #endif |
2762 | #ifdef CONFIG_CLOCK_GETTIME | |
c223da83 JA |
2763 | { .ival = "clock_gettime", |
2764 | .oval = CS_CGETTIME, | |
2765 | .help = "Use clock_gettime(2) for timing", | |
2766 | }, | |
67bf9823 | 2767 | #endif |
c223da83 JA |
2768 | #ifdef ARCH_HAVE_CPU_CLOCK |
2769 | { .ival = "cpu", | |
2770 | .oval = CS_CPUCLOCK, | |
2771 | .help = "Use CPU private clock", | |
2772 | }, | |
2773 | #endif | |
2774 | }, | |
2775 | }, | |
214e1eca JA |
2776 | { |
2777 | .name = "mem", | |
d3aad8f2 | 2778 | .alias = "iomem", |
e8b0e958 | 2779 | .lname = "I/O Memory", |
214e1eca JA |
2780 | .type = FIO_OPT_STR, |
2781 | .cb = str_mem_cb, | |
a609f12a | 2782 | .off1 = offsetof(struct thread_options, mem_type), |
214e1eca JA |
2783 | .help = "Backing type for IO buffers", |
2784 | .def = "malloc", | |
e8b0e958 JA |
2785 | .category = FIO_OPT_C_IO, |
2786 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
2787 | .posval = { |
2788 | { .ival = "malloc", | |
2789 | .oval = MEM_MALLOC, | |
2790 | .help = "Use malloc(3) for IO buffers", | |
2791 | }, | |
c8931876 | 2792 | #ifndef CONFIG_NO_SHM |
37c8cdfe JA |
2793 | { .ival = "shm", |
2794 | .oval = MEM_SHM, | |
2795 | .help = "Use shared memory segments for IO buffers", | |
2796 | }, | |
214e1eca JA |
2797 | #ifdef FIO_HAVE_HUGETLB |
2798 | { .ival = "shmhuge", | |
2799 | .oval = MEM_SHMHUGE, | |
2800 | .help = "Like shm, but use huge pages", | |
2801 | }, | |
c8931876 | 2802 | #endif |
b370e46a | 2803 | #endif |
37c8cdfe JA |
2804 | { .ival = "mmap", |
2805 | .oval = MEM_MMAP, | |
2806 | .help = "Use mmap(2) (file or anon) for IO buffers", | |
2807 | }, | |
217b0f1d LG |
2808 | { .ival = "mmapshared", |
2809 | .oval = MEM_MMAPSHARED, | |
2810 | .help = "Like mmap, but use the shared flag", | |
2811 | }, | |
214e1eca JA |
2812 | #ifdef FIO_HAVE_HUGETLB |
2813 | { .ival = "mmaphuge", | |
2814 | .oval = MEM_MMAPHUGE, | |
2815 | .help = "Like mmap, but use huge pages", | |
2816 | }, | |
03553853 YR |
2817 | #endif |
2818 | #ifdef CONFIG_CUDA | |
2819 | { .ival = "cudamalloc", | |
2820 | .oval = MEM_CUDA_MALLOC, | |
2821 | .help = "Allocate GPU device memory for GPUDirect RDMA", | |
2822 | }, | |
214e1eca JA |
2823 | #endif |
2824 | }, | |
2825 | }, | |
d529ee19 JA |
2826 | { |
2827 | .name = "iomem_align", | |
2828 | .alias = "mem_align", | |
e8b0e958 | 2829 | .lname = "I/O memory alignment", |
d529ee19 | 2830 | .type = FIO_OPT_INT, |
a609f12a | 2831 | .off1 = offsetof(struct thread_options, mem_align), |
d529ee19 JA |
2832 | .minval = 0, |
2833 | .help = "IO memory buffer offset alignment", | |
2834 | .def = "0", | |
2835 | .parent = "iomem", | |
d71c154c | 2836 | .hide = 1, |
e8b0e958 JA |
2837 | .category = FIO_OPT_C_IO, |
2838 | .group = FIO_OPT_G_INVALID, | |
d529ee19 | 2839 | }, |
214e1eca JA |
2840 | { |
2841 | .name = "verify", | |
e8b0e958 | 2842 | .lname = "Verify", |
214e1eca | 2843 | .type = FIO_OPT_STR, |
a609f12a | 2844 | .off1 = offsetof(struct thread_options, verify), |
214e1eca JA |
2845 | .help = "Verify data written", |
2846 | .def = "0", | |
e8b0e958 | 2847 | .category = FIO_OPT_C_IO, |
3ceb458f | 2848 | .group = FIO_OPT_G_VERIFY, |
214e1eca JA |
2849 | .posval = { |
2850 | { .ival = "0", | |
2851 | .oval = VERIFY_NONE, | |
2852 | .help = "Don't do IO verification", | |
2853 | }, | |
fcca4b58 JA |
2854 | { .ival = "md5", |
2855 | .oval = VERIFY_MD5, | |
2856 | .help = "Use md5 checksums for verification", | |
2857 | }, | |
d77a7af3 JA |
2858 | { .ival = "crc64", |
2859 | .oval = VERIFY_CRC64, | |
2860 | .help = "Use crc64 checksums for verification", | |
2861 | }, | |
214e1eca JA |
2862 | { .ival = "crc32", |
2863 | .oval = VERIFY_CRC32, | |
2864 | .help = "Use crc32 checksums for verification", | |
2865 | }, | |
af497e6a | 2866 | { .ival = "crc32c-intel", |
e3aaafc4 JA |
2867 | .oval = VERIFY_CRC32C, |
2868 | .help = "Use crc32c checksums for verification (hw assisted, if available)", | |
af497e6a | 2869 | }, |
bac39e0e JA |
2870 | { .ival = "crc32c", |
2871 | .oval = VERIFY_CRC32C, | |
e3aaafc4 | 2872 | .help = "Use crc32c checksums for verification (hw assisted, if available)", |
bac39e0e | 2873 | }, |
969f7ed3 JA |
2874 | { .ival = "crc16", |
2875 | .oval = VERIFY_CRC16, | |
2876 | .help = "Use crc16 checksums for verification", | |
2877 | }, | |
1e154bdb JA |
2878 | { .ival = "crc7", |
2879 | .oval = VERIFY_CRC7, | |
2880 | .help = "Use crc7 checksums for verification", | |
2881 | }, | |
7c353ceb JA |
2882 | { .ival = "sha1", |
2883 | .oval = VERIFY_SHA1, | |
2884 | .help = "Use sha1 checksums for verification", | |
2885 | }, | |
cd14cc10 JA |
2886 | { .ival = "sha256", |
2887 | .oval = VERIFY_SHA256, | |
2888 | .help = "Use sha256 checksums for verification", | |
2889 | }, | |
2890 | { .ival = "sha512", | |
2891 | .oval = VERIFY_SHA512, | |
2892 | .help = "Use sha512 checksums for verification", | |
ae3a5acc JA |
2893 | }, |
2894 | { .ival = "sha3-224", | |
2895 | .oval = VERIFY_SHA3_224, | |
2896 | .help = "Use sha3-224 checksums for verification", | |
2897 | }, | |
2898 | { .ival = "sha3-256", | |
2899 | .oval = VERIFY_SHA3_256, | |
2900 | .help = "Use sha3-256 checksums for verification", | |
2901 | }, | |
2902 | { .ival = "sha3-384", | |
2903 | .oval = VERIFY_SHA3_384, | |
2904 | .help = "Use sha3-384 checksums for verification", | |
2905 | }, | |
2906 | { .ival = "sha3-512", | |
2907 | .oval = VERIFY_SHA3_512, | |
2908 | .help = "Use sha3-512 checksums for verification", | |
cd14cc10 | 2909 | }, |
844ea602 JA |
2910 | { .ival = "xxhash", |
2911 | .oval = VERIFY_XXHASH, | |
2912 | .help = "Use xxhash checksums for verification", | |
2913 | }, | |
b638d82f RP |
2914 | /* Meta information was included into verify_header, |
2915 | * 'meta' verification is implied by default. */ | |
7437ee87 | 2916 | { .ival = "meta", |
b638d82f RP |
2917 | .oval = VERIFY_HDR_ONLY, |
2918 | .help = "Use io information for verification. " | |
2919 | "Now is implied by default, thus option is obsolete, " | |
2920 | "don't use it", | |
7437ee87 | 2921 | }, |
59245381 JA |
2922 | { .ival = "pattern", |
2923 | .oval = VERIFY_PATTERN_NO_HDR, | |
2924 | .help = "Verify strict pattern", | |
2925 | }, | |
36690c9b JA |
2926 | { |
2927 | .ival = "null", | |
2928 | .oval = VERIFY_NULL, | |
2929 | .help = "Pretend to verify", | |
2930 | }, | |
214e1eca JA |
2931 | }, |
2932 | }, | |
005c565a JA |
2933 | { |
2934 | .name = "do_verify", | |
e8b0e958 | 2935 | .lname = "Perform verify step", |
68e1f29a | 2936 | .type = FIO_OPT_BOOL, |
a609f12a | 2937 | .off1 = offsetof(struct thread_options, do_verify), |
005c565a JA |
2938 | .help = "Run verification stage after write", |
2939 | .def = "1", | |
2940 | .parent = "verify", | |
d71c154c | 2941 | .hide = 1, |
e8b0e958 JA |
2942 | .category = FIO_OPT_C_IO, |
2943 | .group = FIO_OPT_G_VERIFY, | |
005c565a | 2944 | }, |
160b966d JA |
2945 | { |
2946 | .name = "verifysort", | |
e8b0e958 | 2947 | .lname = "Verify sort", |
f31feaa2 | 2948 | .type = FIO_OPT_SOFT_DEPRECATED, |
e8b0e958 JA |
2949 | .category = FIO_OPT_C_IO, |
2950 | .group = FIO_OPT_G_VERIFY, | |
160b966d | 2951 | }, |
1ae83d45 JA |
2952 | { |
2953 | .name = "verifysort_nr", | |
cce2fdfe | 2954 | .lname = "Verify Sort Nr", |
f31feaa2 | 2955 | .type = FIO_OPT_SOFT_DEPRECATED, |
836fcc0f JA |
2956 | .category = FIO_OPT_C_IO, |
2957 | .group = FIO_OPT_G_VERIFY, | |
1ae83d45 | 2958 | }, |
3f9f4e26 | 2959 | { |
a59e170d | 2960 | .name = "verify_interval", |
e8b0e958 | 2961 | .lname = "Verify interval", |
e01b22b8 | 2962 | .type = FIO_OPT_INT, |
a609f12a | 2963 | .off1 = offsetof(struct thread_options, verify_interval), |
819a9680 | 2964 | .minval = 2 * sizeof(struct verify_header), |
a59e170d | 2965 | .help = "Store verify buffer header every N bytes", |
afdf9352 | 2966 | .parent = "verify", |
d71c154c | 2967 | .hide = 1, |
20eb06bd | 2968 | .interval = 2 * sizeof(struct verify_header), |
e8b0e958 JA |
2969 | .category = FIO_OPT_C_IO, |
2970 | .group = FIO_OPT_G_VERIFY, | |
3f9f4e26 | 2971 | }, |
546a9142 | 2972 | { |
a59e170d | 2973 | .name = "verify_offset", |
e8b0e958 | 2974 | .lname = "Verify offset", |
e01b22b8 | 2975 | .type = FIO_OPT_INT, |
a59e170d | 2976 | .help = "Offset verify header location by N bytes", |
a609f12a | 2977 | .off1 = offsetof(struct thread_options, verify_offset), |
203160d5 | 2978 | .minval = sizeof(struct verify_header), |
afdf9352 | 2979 | .parent = "verify", |
d71c154c | 2980 | .hide = 1, |
e8b0e958 JA |
2981 | .category = FIO_OPT_C_IO, |
2982 | .group = FIO_OPT_G_VERIFY, | |
546a9142 | 2983 | }, |
e28218f3 SL |
2984 | { |
2985 | .name = "verify_pattern", | |
e8b0e958 | 2986 | .lname = "Verify pattern", |
0e92f873 | 2987 | .type = FIO_OPT_STR, |
e28218f3 | 2988 | .cb = str_verify_pattern_cb, |
a609f12a | 2989 | .off1 = offsetof(struct thread_options, verify_pattern), |
e28218f3 SL |
2990 | .help = "Fill pattern for IO buffers", |
2991 | .parent = "verify", | |
d71c154c | 2992 | .hide = 1, |
e8b0e958 JA |
2993 | .category = FIO_OPT_C_IO, |
2994 | .group = FIO_OPT_G_VERIFY, | |
e28218f3 | 2995 | }, |
a12a3b4d JA |
2996 | { |
2997 | .name = "verify_fatal", | |
e8b0e958 | 2998 | .lname = "Verify fatal", |
68e1f29a | 2999 | .type = FIO_OPT_BOOL, |
a609f12a | 3000 | .off1 = offsetof(struct thread_options, verify_fatal), |
a12a3b4d JA |
3001 | .def = "0", |
3002 | .help = "Exit on a single verify failure, don't continue", | |
3003 | .parent = "verify", | |
d71c154c | 3004 | .hide = 1, |
e8b0e958 JA |
3005 | .category = FIO_OPT_C_IO, |
3006 | .group = FIO_OPT_G_VERIFY, | |
a12a3b4d | 3007 | }, |
b463e936 JA |
3008 | { |
3009 | .name = "verify_dump", | |
e8b0e958 | 3010 | .lname = "Verify dump", |
b463e936 | 3011 | .type = FIO_OPT_BOOL, |
a609f12a | 3012 | .off1 = offsetof(struct thread_options, verify_dump), |
ef71e317 | 3013 | .def = "0", |
b463e936 JA |
3014 | .help = "Dump contents of good and bad blocks on failure", |
3015 | .parent = "verify", | |
d71c154c | 3016 | .hide = 1, |
e8b0e958 JA |
3017 | .category = FIO_OPT_C_IO, |
3018 | .group = FIO_OPT_G_VERIFY, | |
b463e936 | 3019 | }, |
e8462bd8 JA |
3020 | { |
3021 | .name = "verify_async", | |
e8b0e958 | 3022 | .lname = "Verify asynchronously", |
e8462bd8 | 3023 | .type = FIO_OPT_INT, |
a609f12a | 3024 | .off1 = offsetof(struct thread_options, verify_async), |
e8462bd8 JA |
3025 | .def = "0", |
3026 | .help = "Number of async verifier threads to use", | |
3027 | .parent = "verify", | |
d71c154c | 3028 | .hide = 1, |
e8b0e958 JA |
3029 | .category = FIO_OPT_C_IO, |
3030 | .group = FIO_OPT_G_VERIFY, | |
e8462bd8 | 3031 | }, |
9e144189 JA |
3032 | { |
3033 | .name = "verify_backlog", | |
e8b0e958 | 3034 | .lname = "Verify backlog", |
9e144189 | 3035 | .type = FIO_OPT_STR_VAL, |
a609f12a | 3036 | .off1 = offsetof(struct thread_options, verify_backlog), |
9e144189 JA |
3037 | .help = "Verify after this number of blocks are written", |
3038 | .parent = "verify", | |
d71c154c | 3039 | .hide = 1, |
e8b0e958 JA |
3040 | .category = FIO_OPT_C_IO, |
3041 | .group = FIO_OPT_G_VERIFY, | |
9e144189 JA |
3042 | }, |
3043 | { | |
3044 | .name = "verify_backlog_batch", | |
e8b0e958 | 3045 | .lname = "Verify backlog batch", |
9e144189 | 3046 | .type = FIO_OPT_INT, |
a609f12a | 3047 | .off1 = offsetof(struct thread_options, verify_batch), |
9e144189 | 3048 | .help = "Verify this number of IO blocks", |
0d29de83 | 3049 | .parent = "verify", |
d71c154c | 3050 | .hide = 1, |
e8b0e958 JA |
3051 | .category = FIO_OPT_C_IO, |
3052 | .group = FIO_OPT_G_VERIFY, | |
9e144189 | 3053 | }, |
e8462bd8 JA |
3054 | #ifdef FIO_HAVE_CPU_AFFINITY |
3055 | { | |
3056 | .name = "verify_async_cpus", | |
e8b0e958 | 3057 | .lname = "Async verify CPUs", |
e8462bd8 JA |
3058 | .type = FIO_OPT_STR, |
3059 | .cb = str_verify_cpus_allowed_cb, | |
a609f12a | 3060 | .off1 = offsetof(struct thread_options, verify_cpumask), |
e8462bd8 JA |
3061 | .help = "Set CPUs allowed for async verify threads", |
3062 | .parent = "verify_async", | |
d71c154c | 3063 | .hide = 1, |
e8b0e958 JA |
3064 | .category = FIO_OPT_C_IO, |
3065 | .group = FIO_OPT_G_VERIFY, | |
e8462bd8 | 3066 | }, |
a275c37a JA |
3067 | #else |
3068 | { | |
3069 | .name = "verify_async_cpus", | |
3070 | .lname = "Async verify CPUs", | |
3071 | .type = FIO_OPT_UNSUPPORTED, | |
54d0a315 | 3072 | .help = "Your platform does not support CPU affinities", |
a275c37a | 3073 | }, |
0d29de83 | 3074 | #endif |
51aa2da8 JA |
3075 | { |
3076 | .name = "experimental_verify", | |
cce2fdfe | 3077 | .lname = "Experimental Verify", |
a609f12a | 3078 | .off1 = offsetof(struct thread_options, experimental_verify), |
51aa2da8 | 3079 | .type = FIO_OPT_BOOL, |
b31eaac9 | 3080 | .help = "Enable experimental verification", |
ca09be4b JA |
3081 | .parent = "verify", |
3082 | .category = FIO_OPT_C_IO, | |
3083 | .group = FIO_OPT_G_VERIFY, | |
3084 | }, | |
3085 | { | |
3086 | .name = "verify_state_load", | |
3087 | .lname = "Load verify state", | |
a609f12a | 3088 | .off1 = offsetof(struct thread_options, verify_state), |
ca09be4b JA |
3089 | .type = FIO_OPT_BOOL, |
3090 | .help = "Load verify termination state", | |
3091 | .parent = "verify", | |
3092 | .category = FIO_OPT_C_IO, | |
3093 | .group = FIO_OPT_G_VERIFY, | |
3094 | }, | |
3095 | { | |
3096 | .name = "verify_state_save", | |
3097 | .lname = "Save verify state", | |
a609f12a | 3098 | .off1 = offsetof(struct thread_options, verify_state_save), |
ca09be4b JA |
3099 | .type = FIO_OPT_BOOL, |
3100 | .def = "1", | |
3101 | .help = "Save verify state on termination", | |
3102 | .parent = "verify", | |
836fcc0f JA |
3103 | .category = FIO_OPT_C_IO, |
3104 | .group = FIO_OPT_G_VERIFY, | |
51aa2da8 | 3105 | }, |
0d29de83 JA |
3106 | #ifdef FIO_HAVE_TRIM |
3107 | { | |
3108 | .name = "trim_percentage", | |
e8b0e958 | 3109 | .lname = "Trim percentage", |
0d29de83 | 3110 | .type = FIO_OPT_INT, |
a609f12a | 3111 | .off1 = offsetof(struct thread_options, trim_percentage), |
20eb06bd | 3112 | .minval = 0, |
0d29de83 | 3113 | .maxval = 100, |
169c098d | 3114 | .help = "Number of verify blocks to trim (i.e., discard)", |
0d29de83 JA |
3115 | .parent = "verify", |
3116 | .def = "0", | |
20eb06bd | 3117 | .interval = 1, |
d71c154c | 3118 | .hide = 1, |
e8b0e958 JA |
3119 | .category = FIO_OPT_C_IO, |
3120 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
3121 | }, |
3122 | { | |
3123 | .name = "trim_verify_zero", | |
e8b0e958 | 3124 | .lname = "Verify trim zero", |
20eb06bd | 3125 | .type = FIO_OPT_BOOL, |
169c098d | 3126 | .help = "Verify that trimmed (i.e., discarded) blocks are returned as zeroes", |
a609f12a | 3127 | .off1 = offsetof(struct thread_options, trim_zero), |
0d29de83 | 3128 | .parent = "trim_percentage", |
d71c154c | 3129 | .hide = 1, |
0d29de83 | 3130 | .def = "1", |
e8b0e958 JA |
3131 | .category = FIO_OPT_C_IO, |
3132 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
3133 | }, |
3134 | { | |
3135 | .name = "trim_backlog", | |
e8b0e958 | 3136 | .lname = "Trim backlog", |
0d29de83 | 3137 | .type = FIO_OPT_STR_VAL, |
a609f12a | 3138 | .off1 = offsetof(struct thread_options, trim_backlog), |
0d29de83 JA |
3139 | .help = "Trim after this number of blocks are written", |
3140 | .parent = "trim_percentage", | |
d71c154c | 3141 | .hide = 1, |
20eb06bd | 3142 | .interval = 1, |
e8b0e958 JA |
3143 | .category = FIO_OPT_C_IO, |
3144 | .group = FIO_OPT_G_TRIM, | |
0d29de83 JA |
3145 | }, |
3146 | { | |
3147 | .name = "trim_backlog_batch", | |
e8b0e958 | 3148 | .lname = "Trim backlog batch", |
0d29de83 | 3149 | .type = FIO_OPT_INT, |
a609f12a | 3150 | .off1 = offsetof(struct thread_options, trim_batch), |
0d29de83 JA |
3151 | .help = "Trim this number of IO blocks", |
3152 | .parent = "trim_percentage", | |
d71c154c | 3153 | .hide = 1, |
20eb06bd | 3154 | .interval = 1, |
e8b0e958 JA |
3155 | .category = FIO_OPT_C_IO, |
3156 | .group = FIO_OPT_G_TRIM, | |
0d29de83 | 3157 | }, |
a275c37a JA |
3158 | #else |
3159 | { | |
3160 | .name = "trim_percentage", | |
3161 | .lname = "Trim percentage", | |
3162 | .type = FIO_OPT_UNSUPPORTED, | |
3163 | .help = "Fio does not support TRIM on your platform", | |
3164 | }, | |
3165 | { | |
3166 | .name = "trim_verify_zero", | |
3167 | .lname = "Verify trim zero", | |
3168 | .type = FIO_OPT_UNSUPPORTED, | |
3169 | .help = "Fio does not support TRIM on your platform", | |
3170 | }, | |
3171 | { | |
3172 | .name = "trim_backlog", | |
3173 | .lname = "Trim backlog", | |
3174 | .type = FIO_OPT_UNSUPPORTED, | |
3175 | .help = "Fio does not support TRIM on your platform", | |
3176 | }, | |
3177 | { | |
3178 | .name = "trim_backlog_batch", | |
3179 | .lname = "Trim backlog batch", | |
3180 | .type = FIO_OPT_UNSUPPORTED, | |
3181 | .help = "Fio does not support TRIM on your platform", | |
3182 | }, | |
e8462bd8 | 3183 | #endif |
214e1eca JA |
3184 | { |
3185 | .name = "write_iolog", | |
e8b0e958 | 3186 | .lname = "Write I/O log", |
214e1eca | 3187 | .type = FIO_OPT_STR_STORE, |
a609f12a | 3188 | .off1 = offsetof(struct thread_options, write_iolog_file), |
214e1eca | 3189 | .help = "Store IO pattern to file", |
e8b0e958 JA |
3190 | .category = FIO_OPT_C_IO, |
3191 | .group = FIO_OPT_G_IOLOG, | |
214e1eca JA |
3192 | }, |
3193 | { | |
3194 | .name = "read_iolog", | |
e8b0e958 | 3195 | .lname = "Read I/O log", |
214e1eca | 3196 | .type = FIO_OPT_STR_STORE, |
a609f12a | 3197 | .off1 = offsetof(struct thread_options, read_iolog_file), |
214e1eca | 3198 | .help = "Playback IO pattern from file", |
e8b0e958 JA |
3199 | .category = FIO_OPT_C_IO, |
3200 | .group = FIO_OPT_G_IOLOG, | |
214e1eca | 3201 | }, |
98e7161c AK |
3202 | { |
3203 | .name = "read_iolog_chunked", | |
3204 | .lname = "Read I/O log in parts", | |
3205 | .type = FIO_OPT_BOOL, | |
3206 | .off1 = offsetof(struct thread_options, read_iolog_chunked), | |
3207 | .def = "0", | |
3208 | .parent = "read_iolog", | |
3209 | .help = "Parse IO pattern in chunks", | |
3210 | .category = FIO_OPT_C_IO, | |
3211 | .group = FIO_OPT_G_IOLOG, | |
3212 | }, | |
64bbb865 DN |
3213 | { |
3214 | .name = "replay_no_stall", | |
e8b0e958 | 3215 | .lname = "Don't stall on replay", |
20eb06bd | 3216 | .type = FIO_OPT_BOOL, |
a609f12a | 3217 | .off1 = offsetof(struct thread_options, no_stall), |
64bbb865 | 3218 | .def = "0", |
87e7a972 | 3219 | .parent = "read_iolog", |
d71c154c | 3220 | .hide = 1, |
64bbb865 | 3221 | .help = "Playback IO pattern file as fast as possible without stalls", |
e8b0e958 JA |
3222 | .category = FIO_OPT_C_IO, |
3223 | .group = FIO_OPT_G_IOLOG, | |
64bbb865 | 3224 | }, |
d1c46c04 DN |
3225 | { |
3226 | .name = "replay_redirect", | |
e8b0e958 | 3227 | .lname = "Redirect device for replay", |
d1c46c04 | 3228 | .type = FIO_OPT_STR_STORE, |
a609f12a | 3229 | .off1 = offsetof(struct thread_options, replay_redirect), |
d1c46c04 | 3230 | .parent = "read_iolog", |
d71c154c | 3231 | .hide = 1, |
d1c46c04 | 3232 | .help = "Replay all I/O onto this device, regardless of trace device", |
e8b0e958 JA |
3233 | .category = FIO_OPT_C_IO, |
3234 | .group = FIO_OPT_G_IOLOG, | |
d1c46c04 | 3235 | }, |
0c63576e JA |
3236 | { |
3237 | .name = "replay_scale", | |
3238 | .lname = "Replace offset scale factor", | |
3239 | .type = FIO_OPT_INT, | |
a609f12a | 3240 | .off1 = offsetof(struct thread_options, replay_scale), |
0c63576e JA |
3241 | .parent = "read_iolog", |
3242 | .def = "1", | |
3243 | .help = "Align offsets to this blocksize", | |
3244 | .category = FIO_OPT_C_IO, | |
3245 | .group = FIO_OPT_G_IOLOG, | |
3246 | }, | |
3247 | { | |
3248 | .name = "replay_align", | |
3249 | .lname = "Replace alignment", | |
3250 | .type = FIO_OPT_INT, | |
a609f12a | 3251 | .off1 = offsetof(struct thread_options, replay_align), |
0c63576e JA |
3252 | .parent = "read_iolog", |
3253 | .help = "Scale offset down by this factor", | |
3254 | .category = FIO_OPT_C_IO, | |
3255 | .group = FIO_OPT_G_IOLOG, | |
3256 | .pow2 = 1, | |
3257 | }, | |
6dd7fa77 JA |
3258 | { |
3259 | .name = "replay_time_scale", | |
3260 | .lname = "Replay Time Scale", | |
3261 | .type = FIO_OPT_INT, | |
3262 | .off1 = offsetof(struct thread_options, replay_time_scale), | |
3263 | .def = "100", | |
3264 | .minval = 1, | |
3265 | .parent = "read_iolog", | |
3266 | .hide = 1, | |
3267 | .help = "Scale time for replay events", | |
3268 | .category = FIO_OPT_C_IO, | |
3269 | .group = FIO_OPT_G_IOLOG, | |
3270 | }, | |
d7235efb JA |
3271 | { |
3272 | .name = "replay_skip", | |
3273 | .lname = "Replay Skip", | |
3274 | .type = FIO_OPT_STR, | |
3275 | .cb = str_replay_skip_cb, | |
3276 | .off1 = offsetof(struct thread_options, replay_skip), | |
3277 | .parent = "read_iolog", | |
3278 | .help = "Skip certain IO types (read,write,trim,flush)", | |
3279 | .category = FIO_OPT_C_IO, | |
3280 | .group = FIO_OPT_G_IOLOG, | |
3281 | }, | |
b9921d1a DZ |
3282 | { |
3283 | .name = "merge_blktrace_file", | |
3284 | .lname = "Merged blktrace output filename", | |
3285 | .type = FIO_OPT_STR_STORE, | |
3286 | .off1 = offsetof(struct thread_options, merge_blktrace_file), | |
3287 | .help = "Merged blktrace output filename", | |
3288 | .category = FIO_OPT_C_IO, | |
3289 | .group = FIO_OPT_G_IOLOG, | |
3290 | }, | |
87a48ada DZ |
3291 | { |
3292 | .name = "merge_blktrace_scalars", | |
3293 | .lname = "Percentage to scale each trace", | |
3294 | .type = FIO_OPT_FLOAT_LIST, | |
3295 | .off1 = offsetof(struct thread_options, merge_blktrace_scalars), | |
3296 | .maxlen = FIO_IO_U_LIST_MAX_LEN, | |
3297 | .help = "Percentage to scale each trace", | |
3298 | .category = FIO_OPT_C_IO, | |
3299 | .group = FIO_OPT_G_IOLOG, | |
3300 | }, | |
55bfd8c8 DZ |
3301 | { |
3302 | .name = "merge_blktrace_iters", | |
3303 | .lname = "Number of iterations to run per trace", | |
3304 | .type = FIO_OPT_FLOAT_LIST, | |
3305 | .off1 = offsetof(struct thread_options, merge_blktrace_iters), | |
3306 | .maxlen = FIO_IO_U_LIST_MAX_LEN, | |
3307 | .help = "Number of iterations to run per trace", | |
3308 | .category = FIO_OPT_C_IO, | |
3309 | .group = FIO_OPT_G_IOLOG, | |
3310 | }, | |
214e1eca JA |
3311 | { |
3312 | .name = "exec_prerun", | |
e8b0e958 | 3313 | .lname = "Pre-execute runnable", |
214e1eca | 3314 | .type = FIO_OPT_STR_STORE, |
a609f12a | 3315 | .off1 = offsetof(struct thread_options, exec_prerun), |
214e1eca | 3316 | .help = "Execute this file prior to running job", |
e8b0e958 JA |
3317 | .category = FIO_OPT_C_GENERAL, |
3318 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
3319 | }, |
3320 | { | |
3321 | .name = "exec_postrun", | |
e8b0e958 | 3322 | .lname = "Post-execute runnable", |
214e1eca | 3323 | .type = FIO_OPT_STR_STORE, |
a609f12a | 3324 | .off1 = offsetof(struct thread_options, exec_postrun), |
214e1eca | 3325 | .help = "Execute this file after running job", |
e8b0e958 JA |
3326 | .category = FIO_OPT_C_GENERAL, |
3327 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
3328 | }, |
3329 | #ifdef FIO_HAVE_IOSCHED_SWITCH | |
3330 | { | |
3331 | .name = "ioscheduler", | |
e8b0e958 | 3332 | .lname = "I/O scheduler", |
214e1eca | 3333 | .type = FIO_OPT_STR_STORE, |
a609f12a | 3334 | .off1 = offsetof(struct thread_options, ioscheduler), |
214e1eca | 3335 | .help = "Use this IO scheduler on the backing device", |
e8b0e958 JA |
3336 | .category = FIO_OPT_C_FILE, |
3337 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 3338 | }, |
a275c37a JA |
3339 | #else |
3340 | { | |
3341 | .name = "ioscheduler", | |
3342 | .lname = "I/O scheduler", | |
3343 | .type = FIO_OPT_UNSUPPORTED, | |
3344 | .help = "Your platform does not support IO scheduler switching", | |
3345 | }, | |
214e1eca | 3346 | #endif |
7b865a2f BVA |
3347 | { |
3348 | .name = "zonemode", | |
3349 | .lname = "Zone mode", | |
3350 | .help = "Mode for the zonesize, zonerange and zoneskip parameters", | |
3351 | .type = FIO_OPT_STR, | |
3352 | .off1 = offsetof(struct thread_options, zone_mode), | |
3353 | .def = "none", | |
3354 | .category = FIO_OPT_C_IO, | |
3355 | .group = FIO_OPT_G_ZONE, | |
3356 | .posval = { | |
3357 | { .ival = "none", | |
3358 | .oval = ZONE_MODE_NONE, | |
3359 | .help = "no zoning", | |
3360 | }, | |
3361 | { .ival = "strided", | |
3362 | .oval = ZONE_MODE_STRIDED, | |
3363 | .help = "strided mode - random I/O is restricted to a single zone", | |
3364 | }, | |
3365 | { .ival = "zbd", | |
3366 | .oval = ZONE_MODE_ZBD, | |
3367 | .help = "zoned block device mode - random I/O selects one of multiple zones randomly", | |
3368 | }, | |
3369 | }, | |
3370 | }, | |
214e1eca JA |
3371 | { |
3372 | .name = "zonesize", | |
e8b0e958 | 3373 | .lname = "Zone size", |
214e1eca | 3374 | .type = FIO_OPT_STR_VAL, |
a609f12a | 3375 | .off1 = offsetof(struct thread_options, zone_size), |
ed335855 SN |
3376 | .help = "Amount of data to read per zone", |
3377 | .def = "0", | |
20eb06bd | 3378 | .interval = 1024 * 1024, |
e8b0e958 JA |
3379 | .category = FIO_OPT_C_IO, |
3380 | .group = FIO_OPT_G_ZONE, | |
ed335855 | 3381 | }, |
b8dd9750 HH |
3382 | { |
3383 | .name = "zonecapacity", | |
3384 | .lname = "Zone capacity", | |
3385 | .type = FIO_OPT_STR_VAL, | |
3386 | .off1 = offsetof(struct thread_options, zone_capacity), | |
3387 | .help = "Capacity per zone", | |
3388 | .def = "0", | |
3389 | .interval = 1024 * 1024, | |
3390 | .category = FIO_OPT_C_IO, | |
3391 | .group = FIO_OPT_G_ZONE, | |
3392 | }, | |
ed335855 SN |
3393 | { |
3394 | .name = "zonerange", | |
e8b0e958 | 3395 | .lname = "Zone range", |
ed335855 | 3396 | .type = FIO_OPT_STR_VAL, |
a609f12a | 3397 | .off1 = offsetof(struct thread_options, zone_range), |
214e1eca JA |
3398 | .help = "Give size of an IO zone", |
3399 | .def = "0", | |
20eb06bd | 3400 | .interval = 1024 * 1024, |
e8b0e958 JA |
3401 | .category = FIO_OPT_C_IO, |
3402 | .group = FIO_OPT_G_ZONE, | |
214e1eca JA |
3403 | }, |
3404 | { | |
3405 | .name = "zoneskip", | |
e8b0e958 | 3406 | .lname = "Zone skip", |
214e1eca | 3407 | .type = FIO_OPT_STR_VAL, |
a609f12a | 3408 | .off1 = offsetof(struct thread_options, zone_skip), |
214e1eca JA |
3409 | .help = "Space between IO zones", |
3410 | .def = "0", | |
20eb06bd | 3411 | .interval = 1024 * 1024, |
e8b0e958 JA |
3412 | .category = FIO_OPT_C_IO, |
3413 | .group = FIO_OPT_G_ZONE, | |
214e1eca | 3414 | }, |
bfbdd35b BVA |
3415 | { |
3416 | .name = "read_beyond_wp", | |
3417 | .lname = "Allow reads beyond the zone write pointer", | |
3418 | .type = FIO_OPT_BOOL, | |
3419 | .off1 = offsetof(struct thread_options, read_beyond_wp), | |
3420 | .help = "Allow reads beyond the zone write pointer", | |
3421 | .def = "0", | |
3422 | .category = FIO_OPT_C_IO, | |
3423 | .group = FIO_OPT_G_INVALID, | |
3424 | }, | |
59b07544 BVA |
3425 | { |
3426 | .name = "max_open_zones", | |
219c662d | 3427 | .lname = "Per device/file maximum number of open zones", |
59b07544 BVA |
3428 | .type = FIO_OPT_INT, |
3429 | .off1 = offsetof(struct thread_options, max_open_zones), | |
b7694961 | 3430 | .maxval = ZBD_MAX_OPEN_ZONES, |
219c662d AD |
3431 | .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd", |
3432 | .def = "0", | |
3433 | .category = FIO_OPT_C_IO, | |
3434 | .group = FIO_OPT_G_INVALID, | |
3435 | }, | |
3436 | { | |
3437 | .name = "job_max_open_zones", | |
3438 | .lname = "Job maximum number of open zones", | |
3439 | .type = FIO_OPT_INT, | |
3440 | .off1 = offsetof(struct thread_options, job_max_open_zones), | |
3441 | .maxval = ZBD_MAX_OPEN_ZONES, | |
3442 | .help = "Limit on the number of simultaneously opened sequential write zones with zonemode=zbd by one thread/process", | |
59b07544 BVA |
3443 | .def = "0", |
3444 | .category = FIO_OPT_C_IO, | |
3445 | .group = FIO_OPT_G_INVALID, | |
3446 | }, | |
a7c2b6fc BVA |
3447 | { |
3448 | .name = "zone_reset_threshold", | |
3449 | .lname = "Zone reset threshold", | |
3450 | .help = "Zoned block device reset threshold", | |
3451 | .type = FIO_OPT_FLOAT_LIST, | |
3452 | .maxlen = 1, | |
3453 | .off1 = offsetof(struct thread_options, zrt), | |
3454 | .minfp = 0, | |
3455 | .maxfp = 1, | |
3456 | .category = FIO_OPT_C_IO, | |
3457 | .group = FIO_OPT_G_ZONE, | |
3458 | }, | |
3459 | { | |
3460 | .name = "zone_reset_frequency", | |
3461 | .lname = "Zone reset frequency", | |
3462 | .help = "Zoned block device zone reset frequency in HZ", | |
3463 | .type = FIO_OPT_FLOAT_LIST, | |
3464 | .maxlen = 1, | |
3465 | .off1 = offsetof(struct thread_options, zrf), | |
3466 | .minfp = 0, | |
3467 | .maxfp = 1, | |
3468 | .category = FIO_OPT_C_IO, | |
3469 | .group = FIO_OPT_G_ZONE, | |
3470 | }, | |
214e1eca JA |
3471 | { |
3472 | .name = "lockmem", | |
e8b0e958 | 3473 | .lname = "Lock memory", |
214e1eca | 3474 | .type = FIO_OPT_STR_VAL, |
a609f12a | 3475 | .off1 = offsetof(struct thread_options, lockmem), |
81c6b6cd | 3476 | .help = "Lock down this amount of memory (per worker)", |
214e1eca | 3477 | .def = "0", |
20eb06bd | 3478 | .interval = 1024 * 1024, |
e8b0e958 JA |
3479 | .category = FIO_OPT_C_GENERAL, |
3480 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 3481 | }, |
214e1eca JA |
3482 | { |
3483 | .name = "rwmixread", | |
e8b0e958 | 3484 | .lname = "Read/write mix read", |
214e1eca | 3485 | .type = FIO_OPT_INT, |
cb499fc4 | 3486 | .cb = str_rwmix_read_cb, |
a609f12a | 3487 | .off1 = offsetof(struct thread_options, rwmix[DDIR_READ]), |
214e1eca JA |
3488 | .maxval = 100, |
3489 | .help = "Percentage of mixed workload that is reads", | |
3490 | .def = "50", | |
20eb06bd | 3491 | .interval = 5, |
90265353 | 3492 | .inverse = "rwmixwrite", |
e8b0e958 JA |
3493 | .category = FIO_OPT_C_IO, |
3494 | .group = FIO_OPT_G_RWMIX, | |
214e1eca JA |
3495 | }, |
3496 | { | |
3497 | .name = "rwmixwrite", | |
e8b0e958 | 3498 | .lname = "Read/write mix write", |
214e1eca | 3499 | .type = FIO_OPT_INT, |
cb499fc4 | 3500 | .cb = str_rwmix_write_cb, |
a609f12a | 3501 | .off1 = offsetof(struct thread_options, rwmix[DDIR_WRITE]), |
214e1eca JA |
3502 | .maxval = 100, |
3503 | .help = "Percentage of mixed workload that is writes", | |
3504 | .def = "50", | |
20eb06bd | 3505 | .interval = 5, |
90265353 | 3506 | .inverse = "rwmixread", |
e8b0e958 JA |
3507 | .category = FIO_OPT_C_IO, |
3508 | .group = FIO_OPT_G_RWMIX, | |
214e1eca | 3509 | }, |
afdf9352 JA |
3510 | { |
3511 | .name = "rwmixcycle", | |
e8b0e958 | 3512 | .lname = "Read/write mix cycle", |
15ca150e | 3513 | .type = FIO_OPT_DEPRECATED, |
e8b0e958 JA |
3514 | .category = FIO_OPT_C_IO, |
3515 | .group = FIO_OPT_G_RWMIX, | |
afdf9352 | 3516 | }, |
214e1eca JA |
3517 | { |
3518 | .name = "nice", | |
e8b0e958 | 3519 | .lname = "Nice", |
214e1eca | 3520 | .type = FIO_OPT_INT, |
a609f12a | 3521 | .off1 = offsetof(struct thread_options, nice), |
214e1eca | 3522 | .help = "Set job CPU nice value", |
11fd6aa8 RC |
3523 | .minval = -20, |
3524 | .maxval = 19, | |
214e1eca | 3525 | .def = "0", |
20eb06bd | 3526 | .interval = 1, |
e8b0e958 | 3527 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3528 | .group = FIO_OPT_G_CRED, |
214e1eca JA |
3529 | }, |
3530 | #ifdef FIO_HAVE_IOPRIO | |
3531 | { | |
3532 | .name = "prio", | |
e8b0e958 | 3533 | .lname = "I/O nice priority", |
214e1eca | 3534 | .type = FIO_OPT_INT, |
a609f12a | 3535 | .off1 = offsetof(struct thread_options, ioprio), |
214e1eca | 3536 | .help = "Set job IO priority value", |
1767bd34 TK |
3537 | .minval = IOPRIO_MIN_PRIO, |
3538 | .maxval = IOPRIO_MAX_PRIO, | |
20eb06bd | 3539 | .interval = 1, |
e8b0e958 | 3540 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3541 | .group = FIO_OPT_G_CRED, |
214e1eca | 3542 | }, |
32ef447a TK |
3543 | #else |
3544 | { | |
3545 | .name = "prio", | |
3546 | .lname = "I/O nice priority", | |
3547 | .type = FIO_OPT_UNSUPPORTED, | |
3548 | .help = "Your platform does not support IO priorities", | |
3549 | }, | |
3550 | #endif | |
3551 | #ifdef FIO_HAVE_IOPRIO_CLASS | |
3552 | #ifndef FIO_HAVE_IOPRIO | |
3553 | #error "FIO_HAVE_IOPRIO_CLASS requires FIO_HAVE_IOPRIO" | |
3554 | #endif | |
214e1eca JA |
3555 | { |
3556 | .name = "prioclass", | |
e8b0e958 | 3557 | .lname = "I/O nice priority class", |
214e1eca | 3558 | .type = FIO_OPT_INT, |
a609f12a | 3559 | .off1 = offsetof(struct thread_options, ioprio_class), |
214e1eca | 3560 | .help = "Set job IO priority class", |
1767bd34 TK |
3561 | .minval = IOPRIO_MIN_PRIO_CLASS, |
3562 | .maxval = IOPRIO_MAX_PRIO_CLASS, | |
20eb06bd | 3563 | .interval = 1, |
e8b0e958 | 3564 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3565 | .group = FIO_OPT_G_CRED, |
214e1eca | 3566 | }, |
a275c37a | 3567 | #else |
a275c37a JA |
3568 | { |
3569 | .name = "prioclass", | |
3570 | .lname = "I/O nice priority class", | |
3571 | .type = FIO_OPT_UNSUPPORTED, | |
32ef447a | 3572 | .help = "Your platform does not support IO priority classes", |
a275c37a | 3573 | }, |
214e1eca JA |
3574 | #endif |
3575 | { | |
3576 | .name = "thinktime", | |
e8b0e958 | 3577 | .lname = "Thinktime", |
214e1eca | 3578 | .type = FIO_OPT_INT, |
a609f12a | 3579 | .off1 = offsetof(struct thread_options, thinktime), |
214e1eca JA |
3580 | .help = "Idle time between IO buffers (usec)", |
3581 | .def = "0", | |
88038bc7 | 3582 | .is_time = 1, |
e8b0e958 | 3583 | .category = FIO_OPT_C_IO, |
3ceb458f | 3584 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
3585 | }, |
3586 | { | |
3587 | .name = "thinktime_spin", | |
e8b0e958 | 3588 | .lname = "Thinktime spin", |
214e1eca | 3589 | .type = FIO_OPT_INT, |
a609f12a | 3590 | .off1 = offsetof(struct thread_options, thinktime_spin), |
214e1eca JA |
3591 | .help = "Start think time by spinning this amount (usec)", |
3592 | .def = "0", | |
88038bc7 | 3593 | .is_time = 1, |
afdf9352 | 3594 | .parent = "thinktime", |
d71c154c | 3595 | .hide = 1, |
e8b0e958 | 3596 | .category = FIO_OPT_C_IO, |
3ceb458f | 3597 | .group = FIO_OPT_G_THINKTIME, |
214e1eca JA |
3598 | }, |
3599 | { | |
3600 | .name = "thinktime_blocks", | |
e8b0e958 | 3601 | .lname = "Thinktime blocks", |
214e1eca | 3602 | .type = FIO_OPT_INT, |
a609f12a | 3603 | .off1 = offsetof(struct thread_options, thinktime_blocks), |
214e1eca JA |
3604 | .help = "IO buffer period between 'thinktime'", |
3605 | .def = "1", | |
afdf9352 | 3606 | .parent = "thinktime", |
d71c154c | 3607 | .hide = 1, |
e8b0e958 | 3608 | .category = FIO_OPT_C_IO, |
3ceb458f | 3609 | .group = FIO_OPT_G_THINKTIME, |
214e1eca | 3610 | }, |
33f42c20 HQ |
3611 | { |
3612 | .name = "thinktime_blocks_type", | |
3613 | .lname = "Thinktime blocks type", | |
3614 | .type = FIO_OPT_STR, | |
3615 | .off1 = offsetof(struct thread_options, thinktime_blocks_type), | |
3616 | .help = "How thinktime_blocks takes effect", | |
3617 | .def = "complete", | |
3618 | .category = FIO_OPT_C_IO, | |
3619 | .group = FIO_OPT_G_THINKTIME, | |
3620 | .posval = { | |
3621 | { .ival = "complete", | |
3622 | .oval = THINKTIME_BLOCKS_TYPE_COMPLETE, | |
3623 | .help = "thinktime_blocks takes effect at the completion side", | |
3624 | }, | |
3625 | { | |
3626 | .ival = "issue", | |
3627 | .oval = THINKTIME_BLOCKS_TYPE_ISSUE, | |
3628 | .help = "thinktime_blocks takes effect at the issue side", | |
3629 | }, | |
3630 | }, | |
3631 | .parent = "thinktime", | |
3632 | }, | |
214e1eca JA |
3633 | { |
3634 | .name = "rate", | |
e8b0e958 | 3635 | .lname = "I/O rate", |
140a6888 | 3636 | .type = FIO_OPT_ULL, |
a609f12a JA |
3637 | .off1 = offsetof(struct thread_options, rate[DDIR_READ]), |
3638 | .off2 = offsetof(struct thread_options, rate[DDIR_WRITE]), | |
3639 | .off3 = offsetof(struct thread_options, rate[DDIR_TRIM]), | |
214e1eca | 3640 | .help = "Set bandwidth rate", |
e8b0e958 JA |
3641 | .category = FIO_OPT_C_IO, |
3642 | .group = FIO_OPT_G_RATE, | |
214e1eca JA |
3643 | }, |
3644 | { | |
6d428bcd JA |
3645 | .name = "rate_min", |
3646 | .alias = "ratemin", | |
e8b0e958 | 3647 | .lname = "I/O min rate", |
140a6888 | 3648 | .type = FIO_OPT_ULL, |
a609f12a JA |
3649 | .off1 = offsetof(struct thread_options, ratemin[DDIR_READ]), |
3650 | .off2 = offsetof(struct thread_options, ratemin[DDIR_WRITE]), | |
3651 | .off3 = offsetof(struct thread_options, ratemin[DDIR_TRIM]), | |
4e991c23 | 3652 | .help = "Job must meet this rate or it will be shutdown", |
afdf9352 | 3653 | .parent = "rate", |
d71c154c | 3654 | .hide = 1, |
e8b0e958 JA |
3655 | .category = FIO_OPT_C_IO, |
3656 | .group = FIO_OPT_G_RATE, | |
4e991c23 JA |
3657 | }, |
3658 | { | |
3659 | .name = "rate_iops", | |
e8b0e958 | 3660 | .lname = "I/O rate IOPS", |
e01b22b8 | 3661 | .type = FIO_OPT_INT, |
a609f12a JA |
3662 | .off1 = offsetof(struct thread_options, rate_iops[DDIR_READ]), |
3663 | .off2 = offsetof(struct thread_options, rate_iops[DDIR_WRITE]), | |
3664 | .off3 = offsetof(struct thread_options, rate_iops[DDIR_TRIM]), | |
4e991c23 | 3665 | .help = "Limit IO used to this number of IO operations/sec", |
d71c154c | 3666 | .hide = 1, |
e8b0e958 JA |
3667 | .category = FIO_OPT_C_IO, |
3668 | .group = FIO_OPT_G_RATE, | |
4e991c23 JA |
3669 | }, |
3670 | { | |
3671 | .name = "rate_iops_min", | |
e8b0e958 | 3672 | .lname = "I/O min rate IOPS", |
e01b22b8 | 3673 | .type = FIO_OPT_INT, |
a609f12a JA |
3674 | .off1 = offsetof(struct thread_options, rate_iops_min[DDIR_READ]), |
3675 | .off2 = offsetof(struct thread_options, rate_iops_min[DDIR_WRITE]), | |
3676 | .off3 = offsetof(struct thread_options, rate_iops_min[DDIR_TRIM]), | |
03e20d68 | 3677 | .help = "Job must meet this rate or it will be shut down", |
afdf9352 | 3678 | .parent = "rate_iops", |
d71c154c | 3679 | .hide = 1, |
e8b0e958 JA |
3680 | .category = FIO_OPT_C_IO, |
3681 | .group = FIO_OPT_G_RATE, | |
214e1eca | 3682 | }, |
ff6bb260 | 3683 | { |
6de65959 JA |
3684 | .name = "rate_process", |
3685 | .lname = "Rate Process", | |
3686 | .type = FIO_OPT_STR, | |
a609f12a | 3687 | .off1 = offsetof(struct thread_options, rate_process), |
6de65959 JA |
3688 | .help = "What process controls how rated IO is managed", |
3689 | .def = "linear", | |
ff6bb260 SL |
3690 | .category = FIO_OPT_C_IO, |
3691 | .group = FIO_OPT_G_RATE, | |
6de65959 JA |
3692 | .posval = { |
3693 | { .ival = "linear", | |
3694 | .oval = RATE_PROCESS_LINEAR, | |
3695 | .help = "Linear rate of IO", | |
3696 | }, | |
3697 | { | |
3698 | .ival = "poisson", | |
3699 | .oval = RATE_PROCESS_POISSON, | |
3700 | .help = "Rate follows Poisson process", | |
3701 | }, | |
3702 | }, | |
3703 | .parent = "rate", | |
ff6bb260 | 3704 | }, |
214e1eca | 3705 | { |
6d428bcd JA |
3706 | .name = "rate_cycle", |
3707 | .alias = "ratecycle", | |
e8b0e958 | 3708 | .lname = "I/O rate cycle", |
214e1eca | 3709 | .type = FIO_OPT_INT, |
a609f12a | 3710 | .off1 = offsetof(struct thread_options, ratecycle), |
214e1eca JA |
3711 | .help = "Window average for rate limits (msec)", |
3712 | .def = "1000", | |
afdf9352 | 3713 | .parent = "rate", |
d71c154c | 3714 | .hide = 1, |
e8b0e958 JA |
3715 | .category = FIO_OPT_C_IO, |
3716 | .group = FIO_OPT_G_RATE, | |
214e1eca | 3717 | }, |
1a9bf814 JA |
3718 | { |
3719 | .name = "rate_ignore_thinktime", | |
3720 | .lname = "Rate ignore thinktime", | |
3721 | .type = FIO_OPT_BOOL, | |
3722 | .off1 = offsetof(struct thread_options, rate_ign_think), | |
3723 | .help = "Rated IO ignores thinktime settings", | |
3724 | .parent = "rate", | |
3725 | .category = FIO_OPT_C_IO, | |
3726 | .group = FIO_OPT_G_RATE, | |
3727 | }, | |
15501535 JA |
3728 | { |
3729 | .name = "max_latency", | |
dd97d866 | 3730 | .lname = "Max Latency (usec)", |
6c3fb04c | 3731 | .type = FIO_OPT_STR_VAL_TIME, |
a609f12a | 3732 | .off1 = offsetof(struct thread_options, max_latency), |
15501535 | 3733 | .help = "Maximum tolerated IO latency (usec)", |
88038bc7 | 3734 | .is_time = 1, |
1e5324e7 | 3735 | .category = FIO_OPT_C_IO, |
3e260a46 JA |
3736 | .group = FIO_OPT_G_LATPROF, |
3737 | }, | |
3738 | { | |
3739 | .name = "latency_target", | |
3740 | .lname = "Latency Target (usec)", | |
3741 | .type = FIO_OPT_STR_VAL_TIME, | |
a609f12a | 3742 | .off1 = offsetof(struct thread_options, latency_target), |
3e260a46 | 3743 | .help = "Ramp to max queue depth supporting this latency", |
88038bc7 | 3744 | .is_time = 1, |
3e260a46 JA |
3745 | .category = FIO_OPT_C_IO, |
3746 | .group = FIO_OPT_G_LATPROF, | |
3747 | }, | |
3748 | { | |
3749 | .name = "latency_window", | |
3750 | .lname = "Latency Window (usec)", | |
3751 | .type = FIO_OPT_STR_VAL_TIME, | |
a609f12a | 3752 | .off1 = offsetof(struct thread_options, latency_window), |
3e260a46 | 3753 | .help = "Time to sustain latency_target", |
88038bc7 | 3754 | .is_time = 1, |
3e260a46 JA |
3755 | .category = FIO_OPT_C_IO, |
3756 | .group = FIO_OPT_G_LATPROF, | |
3757 | }, | |
3758 | { | |
3759 | .name = "latency_percentile", | |
3760 | .lname = "Latency Percentile", | |
3761 | .type = FIO_OPT_FLOAT_LIST, | |
a609f12a | 3762 | .off1 = offsetof(struct thread_options, latency_percentile), |
3e260a46 JA |
3763 | .help = "Percentile of IOs must be below latency_target", |
3764 | .def = "100", | |
3765 | .maxlen = 1, | |
3766 | .minfp = 0.0, | |
3767 | .maxfp = 100.0, | |
3768 | .category = FIO_OPT_C_IO, | |
3769 | .group = FIO_OPT_G_LATPROF, | |
15501535 | 3770 | }, |
e1bcd541 SL |
3771 | { |
3772 | .name = "latency_run", | |
3773 | .lname = "Latency Run", | |
3774 | .type = FIO_OPT_BOOL, | |
3775 | .off1 = offsetof(struct thread_options, latency_run), | |
3776 | .help = "Keep adjusting queue depth to match latency_target", | |
3777 | .def = "0", | |
3778 | .category = FIO_OPT_C_IO, | |
3779 | .group = FIO_OPT_G_LATPROF, | |
3780 | }, | |
214e1eca JA |
3781 | { |
3782 | .name = "invalidate", | |
e8b0e958 | 3783 | .lname = "Cache invalidate", |
214e1eca | 3784 | .type = FIO_OPT_BOOL, |
a609f12a | 3785 | .off1 = offsetof(struct thread_options, invalidate_cache), |
214e1eca JA |
3786 | .help = "Invalidate buffer/page cache prior to running job", |
3787 | .def = "1", | |
e8b0e958 | 3788 | .category = FIO_OPT_C_IO, |
3ceb458f | 3789 | .group = FIO_OPT_G_IO_TYPE, |
214e1eca JA |
3790 | }, |
3791 | { | |
3792 | .name = "sync", | |
e8b0e958 | 3793 | .lname = "Synchronous I/O", |
eb9f8d7f | 3794 | .type = FIO_OPT_STR, |
a609f12a | 3795 | .off1 = offsetof(struct thread_options, sync_io), |
eb9f8d7f AF |
3796 | .help = "Use synchronous write IO", |
3797 | .def = "none", | |
d71c154c | 3798 | .hide = 1, |
e8b0e958 | 3799 | .category = FIO_OPT_C_IO, |
3ceb458f | 3800 | .group = FIO_OPT_G_IO_TYPE, |
eb9f8d7f AF |
3801 | .posval = { |
3802 | { .ival = "none", | |
3803 | .oval = 0, | |
3804 | }, | |
3805 | { .ival = "0", | |
3806 | .oval = 0, | |
3807 | }, | |
3808 | { .ival = "sync", | |
3809 | .oval = O_SYNC, | |
3810 | }, | |
3811 | { .ival = "1", | |
3812 | .oval = O_SYNC, | |
3813 | }, | |
3814 | #ifdef O_DSYNC | |
3815 | { .ival = "dsync", | |
3816 | .oval = O_DSYNC, | |
3817 | }, | |
3818 | #endif | |
3819 | }, | |
214e1eca | 3820 | }, |
ae8e559e JA |
3821 | #ifdef FIO_HAVE_WRITE_HINT |
3822 | { | |
3823 | .name = "write_hint", | |
3824 | .lname = "Write hint", | |
3825 | .type = FIO_OPT_STR, | |
3826 | .off1 = offsetof(struct thread_options, write_hint), | |
3827 | .help = "Set expected write life time", | |
3828 | .category = FIO_OPT_C_ENGINE, | |
3829 | .group = FIO_OPT_G_INVALID, | |
3830 | .posval = { | |
3831 | { .ival = "none", | |
3832 | .oval = RWH_WRITE_LIFE_NONE, | |
3833 | }, | |
3834 | { .ival = "short", | |
3835 | .oval = RWH_WRITE_LIFE_SHORT, | |
3836 | }, | |
3837 | { .ival = "medium", | |
3838 | .oval = RWH_WRITE_LIFE_MEDIUM, | |
3839 | }, | |
3840 | { .ival = "long", | |
3841 | .oval = RWH_WRITE_LIFE_LONG, | |
3842 | }, | |
3843 | { .ival = "extreme", | |
3844 | .oval = RWH_WRITE_LIFE_EXTREME, | |
3845 | }, | |
3846 | }, | |
3847 | }, | |
3848 | #endif | |
214e1eca JA |
3849 | { |
3850 | .name = "create_serialize", | |
e8b0e958 | 3851 | .lname = "Create serialize", |
214e1eca | 3852 | .type = FIO_OPT_BOOL, |
a609f12a | 3853 | .off1 = offsetof(struct thread_options, create_serialize), |
c2b8035f | 3854 | .help = "Serialize creation of job files", |
214e1eca | 3855 | .def = "1", |
e8b0e958 JA |
3856 | .category = FIO_OPT_C_FILE, |
3857 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
3858 | }, |
3859 | { | |
3860 | .name = "create_fsync", | |
e8b0e958 | 3861 | .lname = "Create fsync", |
214e1eca | 3862 | .type = FIO_OPT_BOOL, |
a609f12a | 3863 | .off1 = offsetof(struct thread_options, create_fsync), |
03e20d68 | 3864 | .help = "fsync file after creation", |
214e1eca | 3865 | .def = "1", |
e8b0e958 JA |
3866 | .category = FIO_OPT_C_FILE, |
3867 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 3868 | }, |
814452bd JA |
3869 | { |
3870 | .name = "create_on_open", | |
e8b0e958 | 3871 | .lname = "Create on open", |
814452bd | 3872 | .type = FIO_OPT_BOOL, |
a609f12a | 3873 | .off1 = offsetof(struct thread_options, create_on_open), |
814452bd JA |
3874 | .help = "Create files when they are opened for IO", |
3875 | .def = "0", | |
e8b0e958 JA |
3876 | .category = FIO_OPT_C_FILE, |
3877 | .group = FIO_OPT_G_INVALID, | |
814452bd | 3878 | }, |
25460cf6 JA |
3879 | { |
3880 | .name = "create_only", | |
cce2fdfe | 3881 | .lname = "Create Only", |
25460cf6 | 3882 | .type = FIO_OPT_BOOL, |
a609f12a | 3883 | .off1 = offsetof(struct thread_options, create_only), |
25460cf6 | 3884 | .help = "Only perform file creation phase", |
d17fda71 | 3885 | .category = FIO_OPT_C_FILE, |
25460cf6 JA |
3886 | .def = "0", |
3887 | }, | |
2378826d JA |
3888 | { |
3889 | .name = "allow_file_create", | |
e81ecca3 | 3890 | .lname = "Allow file create", |
2378826d | 3891 | .type = FIO_OPT_BOOL, |
a609f12a | 3892 | .off1 = offsetof(struct thread_options, allow_create), |
2378826d JA |
3893 | .help = "Permit fio to create files, if they don't exist", |
3894 | .def = "1", | |
3895 | .category = FIO_OPT_C_FILE, | |
3896 | .group = FIO_OPT_G_FILENAME, | |
3897 | }, | |
e81ecca3 JA |
3898 | { |
3899 | .name = "allow_mounted_write", | |
3900 | .lname = "Allow mounted write", | |
3901 | .type = FIO_OPT_BOOL, | |
a609f12a | 3902 | .off1 = offsetof(struct thread_options, allow_mounted_write), |
e81ecca3 JA |
3903 | .help = "Allow writes to a mounted partition", |
3904 | .def = "0", | |
3905 | .category = FIO_OPT_C_FILE, | |
3906 | .group = FIO_OPT_G_FILENAME, | |
3907 | }, | |
0b9d69ec | 3908 | { |
afad68f7 | 3909 | .name = "pre_read", |
e8b0e958 | 3910 | .lname = "Pre-read files", |
afad68f7 | 3911 | .type = FIO_OPT_BOOL, |
a609f12a | 3912 | .off1 = offsetof(struct thread_options, pre_read), |
03e20d68 | 3913 | .help = "Pre-read files before starting official testing", |
afad68f7 | 3914 | .def = "0", |
e8b0e958 JA |
3915 | .category = FIO_OPT_C_FILE, |
3916 | .group = FIO_OPT_G_INVALID, | |
afad68f7 | 3917 | }, |
214e1eca JA |
3918 | #ifdef FIO_HAVE_CPU_AFFINITY |
3919 | { | |
3920 | .name = "cpumask", | |
e8b0e958 | 3921 | .lname = "CPU mask", |
214e1eca JA |
3922 | .type = FIO_OPT_INT, |
3923 | .cb = str_cpumask_cb, | |
a609f12a | 3924 | .off1 = offsetof(struct thread_options, cpumask), |
214e1eca | 3925 | .help = "CPU affinity mask", |
e8b0e958 | 3926 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3927 | .group = FIO_OPT_G_CRED, |
214e1eca | 3928 | }, |
d2e268b0 JA |
3929 | { |
3930 | .name = "cpus_allowed", | |
e8b0e958 | 3931 | .lname = "CPUs allowed", |
d2e268b0 JA |
3932 | .type = FIO_OPT_STR, |
3933 | .cb = str_cpus_allowed_cb, | |
a609f12a | 3934 | .off1 = offsetof(struct thread_options, cpumask), |
d2e268b0 | 3935 | .help = "Set CPUs allowed", |
e8b0e958 | 3936 | .category = FIO_OPT_C_GENERAL, |
10860056 | 3937 | .group = FIO_OPT_G_CRED, |
d2e268b0 | 3938 | }, |
c2acfbac JA |
3939 | { |
3940 | .name = "cpus_allowed_policy", | |
3941 | .lname = "CPUs allowed distribution policy", | |
3942 | .type = FIO_OPT_STR, | |
a609f12a | 3943 | .off1 = offsetof(struct thread_options, cpus_allowed_policy), |
c2acfbac JA |
3944 | .help = "Distribution policy for cpus_allowed", |
3945 | .parent = "cpus_allowed", | |
3946 | .prio = 1, | |
3947 | .posval = { | |
3948 | { .ival = "shared", | |
3949 | .oval = FIO_CPUS_SHARED, | |
3950 | .help = "Mask shared between threads", | |
3951 | }, | |
3952 | { .ival = "split", | |
3953 | .oval = FIO_CPUS_SPLIT, | |
3954 | .help = "Mask split between threads", | |
3955 | }, | |
3956 | }, | |
3957 | .category = FIO_OPT_C_GENERAL, | |
3958 | .group = FIO_OPT_G_CRED, | |
3959 | }, | |
a275c37a JA |
3960 | #else |
3961 | { | |
3962 | .name = "cpumask", | |
3963 | .lname = "CPU mask", | |
3964 | .type = FIO_OPT_UNSUPPORTED, | |
3965 | .help = "Your platform does not support CPU affinities", | |
3966 | }, | |
3967 | { | |
3968 | .name = "cpus_allowed", | |
3969 | .lname = "CPUs allowed", | |
3970 | .type = FIO_OPT_UNSUPPORTED, | |
3971 | .help = "Your platform does not support CPU affinities", | |
3972 | }, | |
3973 | { | |
3974 | .name = "cpus_allowed_policy", | |
3975 | .lname = "CPUs allowed distribution policy", | |
3976 | .type = FIO_OPT_UNSUPPORTED, | |
3977 | .help = "Your platform does not support CPU affinities", | |
3978 | }, | |
d0b937ed | 3979 | #endif |
67bf9823 | 3980 | #ifdef CONFIG_LIBNUMA |
d0b937ed YR |
3981 | { |
3982 | .name = "numa_cpu_nodes", | |
cce2fdfe | 3983 | .lname = "NUMA CPU Nodes", |
d0b937ed YR |
3984 | .type = FIO_OPT_STR, |
3985 | .cb = str_numa_cpunodes_cb, | |
a609f12a | 3986 | .off1 = offsetof(struct thread_options, numa_cpunodes), |
d0b937ed | 3987 | .help = "NUMA CPU nodes bind", |
6be54b2d JA |
3988 | .category = FIO_OPT_C_GENERAL, |
3989 | .group = FIO_OPT_G_INVALID, | |
d0b937ed YR |
3990 | }, |
3991 | { | |
3992 | .name = "numa_mem_policy", | |
cce2fdfe | 3993 | .lname = "NUMA Memory Policy", |
d0b937ed YR |
3994 | .type = FIO_OPT_STR, |
3995 | .cb = str_numa_mpol_cb, | |
a609f12a | 3996 | .off1 = offsetof(struct thread_options, numa_memnodes), |
d0b937ed | 3997 | .help = "NUMA memory policy setup", |
6be54b2d JA |
3998 | .category = FIO_OPT_C_GENERAL, |
3999 | .group = FIO_OPT_G_INVALID, | |
d0b937ed | 4000 | }, |
a275c37a JA |
4001 | #else |
4002 | { | |
4003 | .name = "numa_cpu_nodes", | |
4004 | .lname = "NUMA CPU Nodes", | |
4005 | .type = FIO_OPT_UNSUPPORTED, | |
4006 | .help = "Build fio with libnuma-dev(el) to enable this option", | |
4007 | }, | |
4008 | { | |
4009 | .name = "numa_mem_policy", | |
4010 | .lname = "NUMA Memory Policy", | |
4011 | .type = FIO_OPT_UNSUPPORTED, | |
4012 | .help = "Build fio with libnuma-dev(el) to enable this option", | |
4013 | }, | |
03553853 YR |
4014 | #endif |
4015 | #ifdef CONFIG_CUDA | |
4016 | { | |
4017 | .name = "gpu_dev_id", | |
4018 | .lname = "GPU device ID", | |
4019 | .type = FIO_OPT_INT, | |
4020 | .off1 = offsetof(struct thread_options, gpu_dev_id), | |
4021 | .help = "Set GPU device ID for GPUDirect RDMA", | |
4022 | .def = "0", | |
4023 | .category = FIO_OPT_C_GENERAL, | |
4024 | .group = FIO_OPT_G_INVALID, | |
4025 | }, | |
214e1eca JA |
4026 | #endif |
4027 | { | |
4028 | .name = "end_fsync", | |
e8b0e958 | 4029 | .lname = "End fsync", |
214e1eca | 4030 | .type = FIO_OPT_BOOL, |
a609f12a | 4031 | .off1 = offsetof(struct thread_options, end_fsync), |
214e1eca JA |
4032 | .help = "Include fsync at the end of job", |
4033 | .def = "0", | |
e8b0e958 JA |
4034 | .category = FIO_OPT_C_FILE, |
4035 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
4036 | }, |
4037 | { | |
4038 | .name = "fsync_on_close", | |
e8b0e958 | 4039 | .lname = "Fsync on close", |
214e1eca | 4040 | .type = FIO_OPT_BOOL, |
a609f12a | 4041 | .off1 = offsetof(struct thread_options, fsync_on_close), |
214e1eca JA |
4042 | .help = "fsync files on close", |
4043 | .def = "0", | |
e8b0e958 JA |
4044 | .category = FIO_OPT_C_FILE, |
4045 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
4046 | }, |
4047 | { | |
4048 | .name = "unlink", | |
e8b0e958 | 4049 | .lname = "Unlink file", |
214e1eca | 4050 | .type = FIO_OPT_BOOL, |
a609f12a | 4051 | .off1 = offsetof(struct thread_options, unlink), |
214e1eca JA |
4052 | .help = "Unlink created files after job has completed", |
4053 | .def = "0", | |
e8b0e958 JA |
4054 | .category = FIO_OPT_C_FILE, |
4055 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 4056 | }, |
39c1c323 | 4057 | { |
4058 | .name = "unlink_each_loop", | |
4059 | .lname = "Unlink file after each loop of a job", | |
4060 | .type = FIO_OPT_BOOL, | |
a609f12a | 4061 | .off1 = offsetof(struct thread_options, unlink_each_loop), |
39c1c323 | 4062 | .help = "Unlink created files after each loop in a job has completed", |
4063 | .def = "0", | |
4064 | .category = FIO_OPT_C_FILE, | |
4065 | .group = FIO_OPT_G_INVALID, | |
4066 | }, | |
214e1eca JA |
4067 | { |
4068 | .name = "exitall", | |
e8b0e958 | 4069 | .lname = "Exit-all on terminate", |
214e1eca JA |
4070 | .type = FIO_OPT_STR_SET, |
4071 | .cb = str_exitall_cb, | |
4072 | .help = "Terminate all jobs when one exits", | |
e8b0e958 | 4073 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 4074 | .group = FIO_OPT_G_PROCESS, |
214e1eca | 4075 | }, |
64402a8a HW |
4076 | { |
4077 | .name = "exit_what", | |
4078 | .lname = "What jobs to quit on terminate", | |
4079 | .type = FIO_OPT_STR, | |
4080 | .off1 = offsetof(struct thread_options, exit_what), | |
4081 | .help = "Fine-grained control for exitall", | |
4082 | .def = "group", | |
4083 | .category = FIO_OPT_C_GENERAL, | |
4084 | .group = FIO_OPT_G_PROCESS, | |
4085 | .posval = { | |
4086 | { .ival = "group", | |
4087 | .oval = TERMINATE_GROUP, | |
4088 | .help = "exit_all=1 default behaviour", | |
4089 | }, | |
4090 | { .ival = "stonewall", | |
4091 | .oval = TERMINATE_STONEWALL, | |
4092 | .help = "quit all currently running jobs; continue with next stonewall", | |
4093 | }, | |
4094 | { .ival = "all", | |
4095 | .oval = TERMINATE_ALL, | |
4096 | .help = "Quit everything", | |
4097 | }, | |
4098 | }, | |
4099 | }, | |
f9cafb12 JA |
4100 | { |
4101 | .name = "exitall_on_error", | |
4102 | .lname = "Exit-all on terminate in error", | |
78abcf9b | 4103 | .type = FIO_OPT_STR_SET, |
a609f12a | 4104 | .off1 = offsetof(struct thread_options, exitall_error), |
f9cafb12 JA |
4105 | .help = "Terminate all jobs when one exits in error", |
4106 | .category = FIO_OPT_C_GENERAL, | |
4107 | .group = FIO_OPT_G_PROCESS, | |
4108 | }, | |
214e1eca JA |
4109 | { |
4110 | .name = "stonewall", | |
e8b0e958 | 4111 | .lname = "Wait for previous", |
d392365e | 4112 | .alias = "wait_for_previous", |
214e1eca | 4113 | .type = FIO_OPT_STR_SET, |
a609f12a | 4114 | .off1 = offsetof(struct thread_options, stonewall), |
214e1eca | 4115 | .help = "Insert a hard barrier between this job and previous", |
e8b0e958 | 4116 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 4117 | .group = FIO_OPT_G_PROCESS, |
214e1eca | 4118 | }, |
b3d62a75 JA |
4119 | { |
4120 | .name = "new_group", | |
e8b0e958 | 4121 | .lname = "New group", |
b3d62a75 | 4122 | .type = FIO_OPT_STR_SET, |
a609f12a | 4123 | .off1 = offsetof(struct thread_options, new_group), |
b3d62a75 | 4124 | .help = "Mark the start of a new group (for reporting)", |
e8b0e958 | 4125 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 4126 | .group = FIO_OPT_G_PROCESS, |
b3d62a75 | 4127 | }, |
214e1eca JA |
4128 | { |
4129 | .name = "thread", | |
e8b0e958 | 4130 | .lname = "Thread", |
214e1eca | 4131 | .type = FIO_OPT_STR_SET, |
a609f12a | 4132 | .off1 = offsetof(struct thread_options, use_thread), |
20eb06bd | 4133 | .help = "Use threads instead of processes", |
c8931876 JA |
4134 | #ifdef CONFIG_NO_SHM |
4135 | .def = "1", | |
4136 | .no_warn_def = 1, | |
4137 | #endif | |
e8b0e958 | 4138 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 4139 | .group = FIO_OPT_G_PROCESS, |
214e1eca | 4140 | }, |
3a5db920 JA |
4141 | { |
4142 | .name = "per_job_logs", | |
cce2fdfe | 4143 | .lname = "Per Job Logs", |
3a5db920 | 4144 | .type = FIO_OPT_BOOL, |
a609f12a | 4145 | .off1 = offsetof(struct thread_options, per_job_logs), |
3a5db920 JA |
4146 | .help = "Include job number in generated log files or not", |
4147 | .def = "1", | |
4148 | .category = FIO_OPT_C_LOG, | |
4149 | .group = FIO_OPT_G_INVALID, | |
4150 | }, | |
214e1eca JA |
4151 | { |
4152 | .name = "write_bw_log", | |
e8b0e958 | 4153 | .lname = "Write bandwidth log", |
dded427c | 4154 | .type = FIO_OPT_STR, |
a609f12a | 4155 | .off1 = offsetof(struct thread_options, bw_log_file), |
dded427c | 4156 | .cb = str_write_bw_log_cb, |
214e1eca | 4157 | .help = "Write log of bandwidth during run", |
e8b0e958 JA |
4158 | .category = FIO_OPT_C_LOG, |
4159 | .group = FIO_OPT_G_INVALID, | |
214e1eca JA |
4160 | }, |
4161 | { | |
4162 | .name = "write_lat_log", | |
e8b0e958 | 4163 | .lname = "Write latency log", |
dded427c | 4164 | .type = FIO_OPT_STR, |
a609f12a | 4165 | .off1 = offsetof(struct thread_options, lat_log_file), |
dded427c | 4166 | .cb = str_write_lat_log_cb, |
214e1eca | 4167 | .help = "Write log of latency during run", |
e8b0e958 JA |
4168 | .category = FIO_OPT_C_LOG, |
4169 | .group = FIO_OPT_G_INVALID, | |
214e1eca | 4170 | }, |
c8eeb9df JA |
4171 | { |
4172 | .name = "write_iops_log", | |
e8b0e958 | 4173 | .lname = "Write IOPS log", |
dded427c | 4174 | .type = FIO_OPT_STR, |
a609f12a | 4175 | .off1 = offsetof(struct thread_options, iops_log_file), |
dded427c | 4176 | .cb = str_write_iops_log_cb, |
c8eeb9df | 4177 | .help = "Write log of IOPS during run", |
e8b0e958 JA |
4178 | .category = FIO_OPT_C_LOG, |
4179 | .group = FIO_OPT_G_INVALID, | |
c8eeb9df | 4180 | }, |
b8bc8cba JA |
4181 | { |
4182 | .name = "log_avg_msec", | |
e8b0e958 | 4183 | .lname = "Log averaging (msec)", |
b8bc8cba | 4184 | .type = FIO_OPT_INT, |
a609f12a | 4185 | .off1 = offsetof(struct thread_options, log_avg_msec), |
b8bc8cba JA |
4186 | .help = "Average bw/iops/lat logs over this period of time", |
4187 | .def = "0", | |
e8b0e958 | 4188 | .category = FIO_OPT_C_LOG, |
1e613c9c KC |
4189 | .group = FIO_OPT_G_INVALID, |
4190 | }, | |
4191 | { | |
4192 | .name = "log_hist_msec", | |
4193 | .lname = "Log histograms (msec)", | |
4194 | .type = FIO_OPT_INT, | |
a609f12a | 4195 | .off1 = offsetof(struct thread_options, log_hist_msec), |
1e613c9c KC |
4196 | .help = "Dump completion latency histograms at frequency of this time value", |
4197 | .def = "0", | |
4198 | .category = FIO_OPT_C_LOG, | |
4199 | .group = FIO_OPT_G_INVALID, | |
4200 | }, | |
4201 | { | |
4202 | .name = "log_hist_coarseness", | |
4203 | .lname = "Histogram logs coarseness", | |
4204 | .type = FIO_OPT_INT, | |
a609f12a | 4205 | .off1 = offsetof(struct thread_options, log_hist_coarseness), |
1e613c9c KC |
4206 | .help = "Integer in range [0,6]. Higher coarseness outputs" |
4207 | " fewer histogram bins per sample. The number of bins for" | |
4208 | " these are [1216, 608, 304, 152, 76, 38, 19] respectively.", | |
4209 | .def = "0", | |
4210 | .category = FIO_OPT_C_LOG, | |
4211 | .group = FIO_OPT_G_INVALID, | |
4212 | }, | |
4213 | { | |
4214 | .name = "write_hist_log", | |
4215 | .lname = "Write latency histogram logs", | |
dded427c | 4216 | .type = FIO_OPT_STR, |
a609f12a | 4217 | .off1 = offsetof(struct thread_options, hist_log_file), |
dded427c | 4218 | .cb = str_write_hist_log_cb, |
1e613c9c KC |
4219 | .help = "Write log of latency histograms during run", |
4220 | .category = FIO_OPT_C_LOG, | |
e8b0e958 | 4221 | .group = FIO_OPT_G_INVALID, |
b8bc8cba | 4222 | }, |
e6989e10 JA |
4223 | { |
4224 | .name = "log_max_value", | |
4225 | .lname = "Log maximum instead of average", | |
4226 | .type = FIO_OPT_BOOL, | |
a609f12a | 4227 | .off1 = offsetof(struct thread_options, log_max), |
e6989e10 JA |
4228 | .help = "Log max sample in a window instead of average", |
4229 | .def = "0", | |
4230 | .category = FIO_OPT_C_LOG, | |
4231 | .group = FIO_OPT_G_INVALID, | |
4232 | }, | |
ae588852 JA |
4233 | { |
4234 | .name = "log_offset", | |
4235 | .lname = "Log offset of IO", | |
4236 | .type = FIO_OPT_BOOL, | |
a609f12a | 4237 | .off1 = offsetof(struct thread_options, log_offset), |
ae588852 JA |
4238 | .help = "Include offset of IO for each log entry", |
4239 | .def = "0", | |
4240 | .category = FIO_OPT_C_LOG, | |
4241 | .group = FIO_OPT_G_INVALID, | |
4242 | }, | |
aee2ab67 JA |
4243 | #ifdef CONFIG_ZLIB |
4244 | { | |
4245 | .name = "log_compression", | |
4246 | .lname = "Log compression", | |
4247 | .type = FIO_OPT_INT, | |
a609f12a | 4248 | .off1 = offsetof(struct thread_options, log_gz), |
aee2ab67 | 4249 | .help = "Log in compressed chunks of this size", |
9919b27b | 4250 | .minval = 1024ULL, |
aee2ab67 JA |
4251 | .maxval = 512 * 1024 * 1024ULL, |
4252 | .category = FIO_OPT_C_LOG, | |
4253 | .group = FIO_OPT_G_INVALID, | |
4254 | }, | |
c08f9fe2 JA |
4255 | #ifdef FIO_HAVE_CPU_AFFINITY |
4256 | { | |
4257 | .name = "log_compression_cpus", | |
4258 | .lname = "Log Compression CPUs", | |
4259 | .type = FIO_OPT_STR, | |
4260 | .cb = str_log_cpus_allowed_cb, | |
a609f12a | 4261 | .off1 = offsetof(struct thread_options, log_gz_cpumask), |
c08f9fe2 JA |
4262 | .parent = "log_compression", |
4263 | .help = "Limit log compression to these CPUs", | |
4264 | .category = FIO_OPT_C_LOG, | |
4265 | .group = FIO_OPT_G_INVALID, | |
4266 | }, | |
a275c37a JA |
4267 | #else |
4268 | { | |
4269 | .name = "log_compression_cpus", | |
4270 | .lname = "Log Compression CPUs", | |
4271 | .type = FIO_OPT_UNSUPPORTED, | |
4272 | .help = "Your platform does not support CPU affinities", | |
4273 | }, | |
c08f9fe2 | 4274 | #endif |
b26317c9 JA |
4275 | { |
4276 | .name = "log_store_compressed", | |
4277 | .lname = "Log store compressed", | |
4278 | .type = FIO_OPT_BOOL, | |
a609f12a | 4279 | .off1 = offsetof(struct thread_options, log_gz_store), |
b26317c9 JA |
4280 | .help = "Store logs in a compressed format", |
4281 | .category = FIO_OPT_C_LOG, | |
4282 | .group = FIO_OPT_G_INVALID, | |
4283 | }, | |
a275c37a JA |
4284 | #else |
4285 | { | |
4286 | .name = "log_compression", | |
4287 | .lname = "Log compression", | |
4288 | .type = FIO_OPT_UNSUPPORTED, | |
4289 | .help = "Install libz-dev(el) to get compression support", | |
4290 | }, | |
4291 | { | |
4292 | .name = "log_store_compressed", | |
4293 | .lname = "Log store compressed", | |
4294 | .type = FIO_OPT_UNSUPPORTED, | |
4295 | .help = "Install libz-dev(el) to get compression support", | |
4296 | }, | |
aee2ab67 | 4297 | #endif |
3aea75b1 KC |
4298 | { |
4299 | .name = "log_unix_epoch", | |
4300 | .lname = "Log epoch unix", | |
4301 | .type = FIO_OPT_BOOL, | |
4302 | .off1 = offsetof(struct thread_options, log_unix_epoch), | |
4303 | .help = "Use Unix time in log files", | |
4304 | .category = FIO_OPT_C_LOG, | |
4305 | .group = FIO_OPT_G_INVALID, | |
4306 | }, | |
66347cfa DE |
4307 | { |
4308 | .name = "block_error_percentiles", | |
4309 | .lname = "Block error percentiles", | |
4310 | .type = FIO_OPT_BOOL, | |
a609f12a | 4311 | .off1 = offsetof(struct thread_options, block_error_hist), |
66347cfa DE |
4312 | .help = "Record trim block errors and make a histogram", |
4313 | .def = "0", | |
4314 | .category = FIO_OPT_C_LOG, | |
4315 | .group = FIO_OPT_G_INVALID, | |
4316 | }, | |
c504ee55 JA |
4317 | { |
4318 | .name = "bwavgtime", | |
4319 | .lname = "Bandwidth average time", | |
4320 | .type = FIO_OPT_INT, | |
a609f12a | 4321 | .off1 = offsetof(struct thread_options, bw_avg_time), |
c504ee55 JA |
4322 | .help = "Time window over which to calculate bandwidth" |
4323 | " (msec)", | |
4324 | .def = "500", | |
4325 | .parent = "write_bw_log", | |
4326 | .hide = 1, | |
4327 | .interval = 100, | |
4328 | .category = FIO_OPT_C_LOG, | |
4329 | .group = FIO_OPT_G_INVALID, | |
4330 | }, | |
4331 | { | |
4332 | .name = "iopsavgtime", | |
4333 | .lname = "IOPS average time", | |
4334 | .type = FIO_OPT_INT, | |
a609f12a | 4335 | .off1 = offsetof(struct thread_options, iops_avg_time), |
c504ee55 JA |
4336 | .help = "Time window over which to calculate IOPS (msec)", |
4337 | .def = "500", | |
4338 | .parent = "write_iops_log", | |
4339 | .hide = 1, | |
4340 | .interval = 100, | |
4341 | .category = FIO_OPT_C_LOG, | |
4342 | .group = FIO_OPT_G_INVALID, | |
4343 | }, | |
214e1eca JA |
4344 | { |
4345 | .name = "group_reporting", | |
e8b0e958 | 4346 | .lname = "Group reporting", |
d2507043 | 4347 | .type = FIO_OPT_STR_SET, |
a609f12a | 4348 | .off1 = offsetof(struct thread_options, group_reporting), |
214e1eca | 4349 | .help = "Do reporting on a per-group basis", |
10860056 | 4350 | .category = FIO_OPT_C_STAT, |
e8b0e958 | 4351 | .group = FIO_OPT_G_INVALID, |
214e1eca | 4352 | }, |
8243be59 JA |
4353 | { |
4354 | .name = "stats", | |
4355 | .lname = "Stats", | |
4356 | .type = FIO_OPT_BOOL, | |
4357 | .off1 = offsetof(struct thread_options, stats), | |
4358 | .help = "Enable collection of stats", | |
4359 | .def = "1", | |
4360 | .category = FIO_OPT_C_STAT, | |
4361 | .group = FIO_OPT_G_INVALID, | |
4362 | }, | |
e9459e5a JA |
4363 | { |
4364 | .name = "zero_buffers", | |
e8b0e958 | 4365 | .lname = "Zero I/O buffers", |
e9459e5a | 4366 | .type = FIO_OPT_STR_SET, |
a609f12a | 4367 | .off1 = offsetof(struct thread_options, zero_buffers), |
e9459e5a | 4368 | .help = "Init IO buffers to all zeroes", |
e8b0e958 | 4369 | .category = FIO_OPT_C_IO, |
3ceb458f | 4370 | .group = FIO_OPT_G_IO_BUF, |
e9459e5a | 4371 | }, |
5973cafb JA |
4372 | { |
4373 | .name = "refill_buffers", | |
e8b0e958 | 4374 | .lname = "Refill I/O buffers", |
5973cafb | 4375 | .type = FIO_OPT_STR_SET, |
a609f12a | 4376 | .off1 = offsetof(struct thread_options, refill_buffers), |
5973cafb | 4377 | .help = "Refill IO buffers on every IO submit", |
e8b0e958 | 4378 | .category = FIO_OPT_C_IO, |
3ceb458f | 4379 | .group = FIO_OPT_G_IO_BUF, |
5973cafb | 4380 | }, |
fd68418e JA |
4381 | { |
4382 | .name = "scramble_buffers", | |
e8b0e958 | 4383 | .lname = "Scramble I/O buffers", |
fd68418e | 4384 | .type = FIO_OPT_BOOL, |
a609f12a | 4385 | .off1 = offsetof(struct thread_options, scramble_buffers), |
fd68418e JA |
4386 | .help = "Slightly scramble buffers on every IO submit", |
4387 | .def = "1", | |
e8b0e958 | 4388 | .category = FIO_OPT_C_IO, |
3ceb458f | 4389 | .group = FIO_OPT_G_IO_BUF, |
fd68418e | 4390 | }, |
ce35b1ec JA |
4391 | { |
4392 | .name = "buffer_pattern", | |
4393 | .lname = "Buffer pattern", | |
4394 | .type = FIO_OPT_STR, | |
4395 | .cb = str_buffer_pattern_cb, | |
a609f12a | 4396 | .off1 = offsetof(struct thread_options, buffer_pattern), |
ce35b1ec JA |
4397 | .help = "Fill pattern for IO buffers", |
4398 | .category = FIO_OPT_C_IO, | |
4399 | .group = FIO_OPT_G_IO_BUF, | |
4400 | }, | |
9c42684e JA |
4401 | { |
4402 | .name = "buffer_compress_percentage", | |
e8b0e958 | 4403 | .lname = "Buffer compression percentage", |
9c42684e | 4404 | .type = FIO_OPT_INT, |
bedc9dc2 | 4405 | .cb = str_buffer_compress_cb, |
a609f12a | 4406 | .off1 = offsetof(struct thread_options, compress_percentage), |
9c42684e | 4407 | .maxval = 100, |
e7f5de90 | 4408 | .minval = 0, |
9c42684e | 4409 | .help = "How compressible the buffer is (approximately)", |
20eb06bd | 4410 | .interval = 5, |
e8b0e958 | 4411 | .category = FIO_OPT_C_IO, |
3ceb458f | 4412 | .group = FIO_OPT_G_IO_BUF, |
9c42684e | 4413 | }, |
f97a43a1 JA |
4414 | { |
4415 | .name = "buffer_compress_chunk", | |
e8b0e958 | 4416 | .lname = "Buffer compression chunk size", |
f97a43a1 | 4417 | .type = FIO_OPT_INT, |
a609f12a | 4418 | .off1 = offsetof(struct thread_options, compress_chunk), |
207b18e4 | 4419 | .parent = "buffer_compress_percentage", |
d71c154c | 4420 | .hide = 1, |
f97a43a1 | 4421 | .help = "Size of compressible region in buffer", |
1de80624 | 4422 | .def = "512", |
20eb06bd | 4423 | .interval = 256, |
e8b0e958 | 4424 | .category = FIO_OPT_C_IO, |
3ceb458f | 4425 | .group = FIO_OPT_G_IO_BUF, |
f97a43a1 | 4426 | }, |
5c94b008 JA |
4427 | { |
4428 | .name = "dedupe_percentage", | |
4429 | .lname = "Dedupe percentage", | |
4430 | .type = FIO_OPT_INT, | |
4431 | .cb = str_dedupe_cb, | |
a609f12a | 4432 | .off1 = offsetof(struct thread_options, dedupe_percentage), |
5c94b008 JA |
4433 | .maxval = 100, |
4434 | .minval = 0, | |
4435 | .help = "Percentage of buffers that are dedupable", | |
4436 | .interval = 1, | |
4437 | .category = FIO_OPT_C_IO, | |
4438 | .group = FIO_OPT_G_IO_BUF, | |
4439 | }, | |
83349190 YH |
4440 | { |
4441 | .name = "clat_percentiles", | |
e8b0e958 | 4442 | .lname = "Completion latency percentiles", |
83349190 | 4443 | .type = FIO_OPT_BOOL, |
a609f12a | 4444 | .off1 = offsetof(struct thread_options, clat_percentiles), |
83349190 | 4445 | .help = "Enable the reporting of completion latency percentiles", |
467b35ed | 4446 | .def = "1", |
b599759b JA |
4447 | .category = FIO_OPT_C_STAT, |
4448 | .group = FIO_OPT_G_INVALID, | |
4449 | }, | |
4450 | { | |
4451 | .name = "lat_percentiles", | |
4452 | .lname = "IO latency percentiles", | |
4453 | .type = FIO_OPT_BOOL, | |
4454 | .off1 = offsetof(struct thread_options, lat_percentiles), | |
4455 | .help = "Enable the reporting of IO latency percentiles", | |
4456 | .def = "0", | |
56440e63 VF |
4457 | .category = FIO_OPT_C_STAT, |
4458 | .group = FIO_OPT_G_INVALID, | |
4459 | }, | |
4460 | { | |
4461 | .name = "slat_percentiles", | |
4462 | .lname = "Submission latency percentiles", | |
4463 | .type = FIO_OPT_BOOL, | |
4464 | .off1 = offsetof(struct thread_options, slat_percentiles), | |
4465 | .help = "Enable the reporting of submission latency percentiles", | |
4466 | .def = "0", | |
e8b0e958 JA |
4467 | .category = FIO_OPT_C_STAT, |
4468 | .group = FIO_OPT_G_INVALID, | |
83349190 YH |
4469 | }, |
4470 | { | |
4471 | .name = "percentile_list", | |
66347cfa | 4472 | .lname = "Percentile list", |
83349190 | 4473 | .type = FIO_OPT_FLOAT_LIST, |
a609f12a JA |
4474 | .off1 = offsetof(struct thread_options, percentile_list), |
4475 | .off2 = offsetof(struct thread_options, percentile_precision), | |
66347cfa DE |
4476 | .help = "Specify a custom list of percentiles to report for " |
4477 | "completion latency and block errors", | |
fd112d34 | 4478 | .def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99", |
83349190 YH |
4479 | .maxlen = FIO_IO_U_LIST_MAX_LEN, |
4480 | .minfp = 0.0, | |
4481 | .maxfp = 100.0, | |
e8b0e958 JA |
4482 | .category = FIO_OPT_C_STAT, |
4483 | .group = FIO_OPT_G_INVALID, | |
e883cb35 JF |
4484 | }, |
4485 | { | |
4486 | .name = "significant_figures", | |
4487 | .lname = "Significant figures", | |
4488 | .type = FIO_OPT_INT, | |
4489 | .off1 = offsetof(struct thread_options, sig_figs), | |
4490 | .maxval = 10, | |
4491 | .minval = 1, | |
4492 | .help = "Significant figures for output-format set to normal", | |
4493 | .def = "4", | |
4494 | .interval = 1, | |
4495 | .category = FIO_OPT_C_STAT, | |
4496 | .group = FIO_OPT_G_INVALID, | |
83349190 YH |
4497 | }, |
4498 | ||
0a839f30 JA |
4499 | #ifdef FIO_HAVE_DISK_UTIL |
4500 | { | |
4501 | .name = "disk_util", | |
e8b0e958 | 4502 | .lname = "Disk utilization", |
0a839f30 | 4503 | .type = FIO_OPT_BOOL, |
a609f12a | 4504 | .off1 = offsetof(struct thread_options, do_disk_util), |
f66ab3c8 | 4505 | .help = "Log disk utilization statistics", |
0a839f30 | 4506 | .def = "1", |
e8b0e958 JA |
4507 | .category = FIO_OPT_C_STAT, |
4508 | .group = FIO_OPT_G_INVALID, | |
0a839f30 | 4509 | }, |
a275c37a JA |
4510 | #else |
4511 | { | |
4512 | .name = "disk_util", | |
4513 | .lname = "Disk utilization", | |
4514 | .type = FIO_OPT_UNSUPPORTED, | |
4515 | .help = "Your platform does not support disk utilization", | |
4516 | }, | |
0a839f30 | 4517 | #endif |
993bf48b JA |
4518 | { |
4519 | .name = "gtod_reduce", | |
e8b0e958 | 4520 | .lname = "Reduce gettimeofday() calls", |
993bf48b JA |
4521 | .type = FIO_OPT_BOOL, |
4522 | .help = "Greatly reduce number of gettimeofday() calls", | |
4523 | .cb = str_gtod_reduce_cb, | |
4524 | .def = "0", | |
a4ed77fe | 4525 | .hide_on_set = 1, |
e8b0e958 JA |
4526 | .category = FIO_OPT_C_STAT, |
4527 | .group = FIO_OPT_G_INVALID, | |
993bf48b | 4528 | }, |
02af0988 JA |
4529 | { |
4530 | .name = "disable_lat", | |
e8b0e958 | 4531 | .lname = "Disable all latency stats", |
02af0988 | 4532 | .type = FIO_OPT_BOOL, |
a609f12a | 4533 | .off1 = offsetof(struct thread_options, disable_lat), |
02af0988 JA |
4534 | .help = "Disable latency numbers", |
4535 | .parent = "gtod_reduce", | |
d71c154c | 4536 | .hide = 1, |
02af0988 | 4537 | .def = "0", |
e8b0e958 JA |
4538 | .category = FIO_OPT_C_STAT, |
4539 | .group = FIO_OPT_G_INVALID, | |
02af0988 | 4540 | }, |
9520ebb9 JA |
4541 | { |
4542 | .name = "disable_clat", | |
e8b0e958 | 4543 | .lname = "Disable completion latency stats", |
9520ebb9 | 4544 | .type = FIO_OPT_BOOL, |
a609f12a | 4545 | .off1 = offsetof(struct thread_options, disable_clat), |
9520ebb9 | 4546 | .help = "Disable completion latency numbers", |
993bf48b | 4547 | .parent = "gtod_reduce", |
d71c154c | 4548 | .hide = 1, |
9520ebb9 | 4549 | .def = "0", |
e8b0e958 JA |
4550 | .category = FIO_OPT_C_STAT, |
4551 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 JA |
4552 | }, |
4553 | { | |
4554 | .name = "disable_slat", | |
e8b0e958 | 4555 | .lname = "Disable submission latency stats", |
9520ebb9 | 4556 | .type = FIO_OPT_BOOL, |
a609f12a | 4557 | .off1 = offsetof(struct thread_options, disable_slat), |
03e20d68 | 4558 | .help = "Disable submission latency numbers", |
993bf48b | 4559 | .parent = "gtod_reduce", |
d71c154c | 4560 | .hide = 1, |
9520ebb9 | 4561 | .def = "0", |
e8b0e958 JA |
4562 | .category = FIO_OPT_C_STAT, |
4563 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 JA |
4564 | }, |
4565 | { | |
4566 | .name = "disable_bw_measurement", | |
afd2ceff | 4567 | .alias = "disable_bw", |
e8b0e958 | 4568 | .lname = "Disable bandwidth stats", |
9520ebb9 | 4569 | .type = FIO_OPT_BOOL, |
a609f12a | 4570 | .off1 = offsetof(struct thread_options, disable_bw), |
9520ebb9 | 4571 | .help = "Disable bandwidth logging", |
993bf48b | 4572 | .parent = "gtod_reduce", |
d71c154c | 4573 | .hide = 1, |
9520ebb9 | 4574 | .def = "0", |
e8b0e958 JA |
4575 | .category = FIO_OPT_C_STAT, |
4576 | .group = FIO_OPT_G_INVALID, | |
9520ebb9 | 4577 | }, |
be4ecfdf JA |
4578 | { |
4579 | .name = "gtod_cpu", | |
e8b0e958 | 4580 | .lname = "Dedicated gettimeofday() CPU", |
be4ecfdf | 4581 | .type = FIO_OPT_INT, |
a609f12a | 4582 | .off1 = offsetof(struct thread_options, gtod_cpu), |
03e20d68 | 4583 | .help = "Set up dedicated gettimeofday() thread on this CPU", |
29d43ff9 | 4584 | .verify = gtod_cpu_verify, |
e8b0e958 | 4585 | .category = FIO_OPT_C_GENERAL, |
10860056 | 4586 | .group = FIO_OPT_G_CLOCK, |
be4ecfdf | 4587 | }, |
771e58be JA |
4588 | { |
4589 | .name = "unified_rw_reporting", | |
cce2fdfe | 4590 | .lname = "Unified RW Reporting", |
771e58be | 4591 | .type = FIO_OPT_BOOL, |
a609f12a | 4592 | .off1 = offsetof(struct thread_options, unified_rw_rep), |
771e58be JA |
4593 | .help = "Unify reporting across data direction", |
4594 | .def = "0", | |
90b7a96d JA |
4595 | .category = FIO_OPT_C_GENERAL, |
4596 | .group = FIO_OPT_G_INVALID, | |
771e58be | 4597 | }, |
f2bba182 RR |
4598 | { |
4599 | .name = "continue_on_error", | |
e8b0e958 | 4600 | .lname = "Continue on error", |
06842027 | 4601 | .type = FIO_OPT_STR, |
a609f12a | 4602 | .off1 = offsetof(struct thread_options, continue_on_error), |
03e20d68 | 4603 | .help = "Continue on non-fatal errors during IO", |
06842027 | 4604 | .def = "none", |
e8b0e958 | 4605 | .category = FIO_OPT_C_GENERAL, |
bc3f552f | 4606 | .group = FIO_OPT_G_ERR, |
06842027 SL |
4607 | .posval = { |
4608 | { .ival = "none", | |
4609 | .oval = ERROR_TYPE_NONE, | |
4610 | .help = "Exit when an error is encountered", | |
4611 | }, | |
4612 | { .ival = "read", | |
4613 | .oval = ERROR_TYPE_READ, | |
4614 | .help = "Continue on read errors only", | |
4615 | }, | |
4616 | { .ival = "write", | |
4617 | .oval = ERROR_TYPE_WRITE, | |
4618 | .help = "Continue on write errors only", | |
4619 | }, | |
4620 | { .ival = "io", | |
4621 | .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE, | |
4622 | .help = "Continue on any IO errors", | |
4623 | }, | |
4624 | { .ival = "verify", | |
4625 | .oval = ERROR_TYPE_VERIFY, | |
4626 | .help = "Continue on verify errors only", | |
4627 | }, | |
4628 | { .ival = "all", | |
4629 | .oval = ERROR_TYPE_ANY, | |
4630 | .help = "Continue on all io and verify errors", | |
4631 | }, | |
4632 | { .ival = "0", | |
4633 | .oval = ERROR_TYPE_NONE, | |
4634 | .help = "Alias for 'none'", | |
4635 | }, | |
4636 | { .ival = "1", | |
4637 | .oval = ERROR_TYPE_ANY, | |
4638 | .help = "Alias for 'all'", | |
4639 | }, | |
4640 | }, | |
f2bba182 | 4641 | }, |
8b28bd41 DM |
4642 | { |
4643 | .name = "ignore_error", | |
cce2fdfe | 4644 | .lname = "Ignore Error", |
8b28bd41 DM |
4645 | .type = FIO_OPT_STR, |
4646 | .cb = str_ignore_error_cb, | |
a609f12a | 4647 | .off1 = offsetof(struct thread_options, ignore_error_nr), |
8b28bd41 DM |
4648 | .help = "Set a specific list of errors to ignore", |
4649 | .parent = "rw", | |
a94eb99a | 4650 | .category = FIO_OPT_C_GENERAL, |
bc3f552f | 4651 | .group = FIO_OPT_G_ERR, |
8b28bd41 DM |
4652 | }, |
4653 | { | |
4654 | .name = "error_dump", | |
cce2fdfe | 4655 | .lname = "Error Dump", |
8b28bd41 | 4656 | .type = FIO_OPT_BOOL, |
a609f12a | 4657 | .off1 = offsetof(struct thread_options, error_dump), |
8b28bd41 DM |
4658 | .def = "0", |
4659 | .help = "Dump info on each error", | |
a94eb99a | 4660 | .category = FIO_OPT_C_GENERAL, |
bc3f552f | 4661 | .group = FIO_OPT_G_ERR, |
8b28bd41 | 4662 | }, |
9ac8a797 JA |
4663 | { |
4664 | .name = "profile", | |
e8b0e958 | 4665 | .lname = "Profile", |
79d16311 | 4666 | .type = FIO_OPT_STR_STORE, |
a609f12a | 4667 | .off1 = offsetof(struct thread_options, profile), |
9ac8a797 | 4668 | .help = "Select a specific builtin performance test", |
13fca827 | 4669 | .category = FIO_OPT_C_PROFILE, |
e8b0e958 | 4670 | .group = FIO_OPT_G_INVALID, |
9ac8a797 | 4671 | }, |
a696fa2a JA |
4672 | { |
4673 | .name = "cgroup", | |
e8b0e958 | 4674 | .lname = "Cgroup", |
a696fa2a | 4675 | .type = FIO_OPT_STR_STORE, |
a609f12a | 4676 | .off1 = offsetof(struct thread_options, cgroup), |
a696fa2a | 4677 | .help = "Add job to cgroup of this name", |
e8b0e958 | 4678 | .category = FIO_OPT_C_GENERAL, |
a1f6afec JA |
4679 | .group = FIO_OPT_G_CGROUP, |
4680 | }, | |
4681 | { | |
4682 | .name = "cgroup_nodelete", | |
4683 | .lname = "Cgroup no-delete", | |
4684 | .type = FIO_OPT_BOOL, | |
a609f12a | 4685 | .off1 = offsetof(struct thread_options, cgroup_nodelete), |
a1f6afec JA |
4686 | .help = "Do not delete cgroups after job completion", |
4687 | .def = "0", | |
4688 | .parent = "cgroup", | |
4689 | .category = FIO_OPT_C_GENERAL, | |
4690 | .group = FIO_OPT_G_CGROUP, | |
a696fa2a JA |
4691 | }, |
4692 | { | |
4693 | .name = "cgroup_weight", | |
e8b0e958 | 4694 | .lname = "Cgroup weight", |
a696fa2a | 4695 | .type = FIO_OPT_INT, |
a609f12a | 4696 | .off1 = offsetof(struct thread_options, cgroup_weight), |
a696fa2a JA |
4697 | .help = "Use given weight for cgroup", |
4698 | .minval = 100, | |
4699 | .maxval = 1000, | |
a1f6afec | 4700 | .parent = "cgroup", |
e8b0e958 | 4701 | .category = FIO_OPT_C_GENERAL, |
a1f6afec | 4702 | .group = FIO_OPT_G_CGROUP, |
7de87099 | 4703 | }, |
e0b0d892 JA |
4704 | { |
4705 | .name = "uid", | |
e8b0e958 | 4706 | .lname = "User ID", |
e0b0d892 | 4707 | .type = FIO_OPT_INT, |
a609f12a | 4708 | .off1 = offsetof(struct thread_options, uid), |
e0b0d892 | 4709 | .help = "Run job with this user ID", |
e8b0e958 | 4710 | .category = FIO_OPT_C_GENERAL, |
10860056 | 4711 | .group = FIO_OPT_G_CRED, |
e0b0d892 JA |
4712 | }, |
4713 | { | |
4714 | .name = "gid", | |
e8b0e958 | 4715 | .lname = "Group ID", |
e0b0d892 | 4716 | .type = FIO_OPT_INT, |
a609f12a | 4717 | .off1 = offsetof(struct thread_options, gid), |
e0b0d892 | 4718 | .help = "Run job with this group ID", |
e8b0e958 | 4719 | .category = FIO_OPT_C_GENERAL, |
10860056 | 4720 | .group = FIO_OPT_G_CRED, |
e0b0d892 | 4721 | }, |
a1f6afec JA |
4722 | { |
4723 | .name = "kb_base", | |
4724 | .lname = "KB Base", | |
41dd12d6 | 4725 | .type = FIO_OPT_STR, |
a609f12a | 4726 | .off1 = offsetof(struct thread_options, kb_base), |
a1f6afec JA |
4727 | .prio = 1, |
4728 | .def = "1024", | |
ba9c7219 JA |
4729 | .posval = { |
4730 | { .ival = "1024", | |
4731 | .oval = 1024, | |
d694a6a7 | 4732 | .help = "Inputs invert IEC and SI prefixes (for compatibility); outputs prefer binary", |
ba9c7219 JA |
4733 | }, |
4734 | { .ival = "1000", | |
4735 | .oval = 1000, | |
d694a6a7 | 4736 | .help = "Inputs use IEC and SI prefixes; outputs prefer SI", |
ba9c7219 JA |
4737 | }, |
4738 | }, | |
d694a6a7 | 4739 | .help = "Unit prefix interpretation for quantities of data (IEC and SI)", |
a1f6afec JA |
4740 | .category = FIO_OPT_C_GENERAL, |
4741 | .group = FIO_OPT_G_INVALID, | |
4742 | }, | |
cf3a0518 JA |
4743 | { |
4744 | .name = "unit_base", | |
d694a6a7 | 4745 | .lname = "Unit for quantities of data (Bits or Bytes)", |
92a1a1d7 | 4746 | .type = FIO_OPT_STR, |
a609f12a | 4747 | .off1 = offsetof(struct thread_options, unit_base), |
cf3a0518 | 4748 | .prio = 1, |
71a08258 JA |
4749 | .posval = { |
4750 | { .ival = "0", | |
41a87019 | 4751 | .oval = N2S_NONE, |
71a08258 JA |
4752 | .help = "Auto-detect", |
4753 | }, | |
4754 | { .ival = "8", | |
41a87019 | 4755 | .oval = N2S_BYTEPERSEC, |
71a08258 JA |
4756 | .help = "Normal (byte based)", |
4757 | }, | |
4758 | { .ival = "1", | |
41a87019 | 4759 | .oval = N2S_BITPERSEC, |
71a08258 JA |
4760 | .help = "Bit based", |
4761 | }, | |
4762 | }, | |
cf3a0518 JA |
4763 | .help = "Bit multiple of result summary data (8 for byte, 1 for bit)", |
4764 | .category = FIO_OPT_C_GENERAL, | |
4765 | .group = FIO_OPT_G_INVALID, | |
4766 | }, | |
3ceb458f JA |
4767 | { |
4768 | .name = "hugepage-size", | |
4769 | .lname = "Hugepage size", | |
4770 | .type = FIO_OPT_INT, | |
a609f12a | 4771 | .off1 = offsetof(struct thread_options, hugepage_size), |
3ceb458f JA |
4772 | .help = "When using hugepages, specify size of each page", |
4773 | .def = __fio_stringify(FIO_HUGE_PAGE), | |
4774 | .interval = 1024 * 1024, | |
4775 | .category = FIO_OPT_C_GENERAL, | |
4776 | .group = FIO_OPT_G_INVALID, | |
4777 | }, | |
9e684a49 DE |
4778 | { |
4779 | .name = "flow_id", | |
e8b0e958 | 4780 | .lname = "I/O flow ID", |
9e684a49 | 4781 | .type = FIO_OPT_INT, |
a609f12a | 4782 | .off1 = offsetof(struct thread_options, flow_id), |
9e684a49 DE |
4783 | .help = "The flow index ID to use", |
4784 | .def = "0", | |
e8b0e958 JA |
4785 | .category = FIO_OPT_C_IO, |
4786 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
4787 | }, |
4788 | { | |
4789 | .name = "flow", | |
e8b0e958 | 4790 | .lname = "I/O flow weight", |
20c7a244 | 4791 | .type = FIO_OPT_INT, |
a609f12a | 4792 | .off1 = offsetof(struct thread_options, flow), |
9e684a49 DE |
4793 | .help = "Weight for flow control of this job", |
4794 | .parent = "flow_id", | |
d71c154c | 4795 | .hide = 1, |
9e684a49 | 4796 | .def = "0", |
d4e74fda | 4797 | .maxval = FLOW_MAX_WEIGHT, |
e8b0e958 JA |
4798 | .category = FIO_OPT_C_IO, |
4799 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
4800 | }, |
4801 | { | |
4802 | .name = "flow_watermark", | |
e8b0e958 | 4803 | .lname = "I/O flow watermark", |
d4e74fda | 4804 | .type = FIO_OPT_SOFT_DEPRECATED, |
e8b0e958 JA |
4805 | .category = FIO_OPT_C_IO, |
4806 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 DE |
4807 | }, |
4808 | { | |
4809 | .name = "flow_sleep", | |
e8b0e958 | 4810 | .lname = "I/O flow sleep", |
9e684a49 | 4811 | .type = FIO_OPT_INT, |
a609f12a | 4812 | .off1 = offsetof(struct thread_options, flow_sleep), |
9e684a49 DE |
4813 | .help = "How many microseconds to sleep after being held" |
4814 | " back by the flow control mechanism", | |
4815 | .parent = "flow_id", | |
d71c154c | 4816 | .hide = 1, |
9e684a49 | 4817 | .def = "0", |
e8b0e958 JA |
4818 | .category = FIO_OPT_C_IO, |
4819 | .group = FIO_OPT_G_IO_FLOW, | |
9e684a49 | 4820 | }, |
16e56d25 VF |
4821 | { |
4822 | .name = "steadystate", | |
4823 | .lname = "Steady state threshold", | |
4824 | .alias = "ss", | |
4825 | .type = FIO_OPT_STR, | |
2c5d94bc | 4826 | .off1 = offsetof(struct thread_options, ss_state), |
16e56d25 VF |
4827 | .cb = str_steadystate_cb, |
4828 | .help = "Define the criterion and limit to judge when a job has reached steady state", | |
4829 | .def = "iops_slope:0.01%", | |
4830 | .posval = { | |
4831 | { .ival = "iops", | |
f0c50c66 | 4832 | .oval = FIO_SS_IOPS, |
16e56d25 VF |
4833 | .help = "maximum mean deviation of IOPS measurements", |
4834 | }, | |
4835 | { .ival = "iops_slope", | |
f0c50c66 | 4836 | .oval = FIO_SS_IOPS_SLOPE, |
16e56d25 VF |
4837 | .help = "slope calculated from IOPS measurements", |
4838 | }, | |
4839 | { .ival = "bw", | |
f0c50c66 | 4840 | .oval = FIO_SS_BW, |
16e56d25 VF |
4841 | .help = "maximum mean deviation of bandwidth measurements", |
4842 | }, | |
4843 | { | |
4844 | .ival = "bw_slope", | |
f0c50c66 | 4845 | .oval = FIO_SS_BW_SLOPE, |
16e56d25 VF |
4846 | .help = "slope calculated from bandwidth measurements", |
4847 | }, | |
4848 | }, | |
4849 | .category = FIO_OPT_C_GENERAL, | |
4850 | .group = FIO_OPT_G_RUNTIME, | |
4851 | }, | |
4852 | { | |
4853 | .name = "steadystate_duration", | |
4854 | .lname = "Steady state duration", | |
4855 | .alias = "ss_dur", | |
915ca980 | 4856 | .parent = "steadystate", |
16e56d25 VF |
4857 | .type = FIO_OPT_STR_VAL_TIME, |
4858 | .off1 = offsetof(struct thread_options, ss_dur), | |
4859 | .help = "Stop workload upon attaining steady state for specified duration", | |
4860 | .def = "0", | |
4861 | .is_seconds = 1, | |
4862 | .is_time = 1, | |
4863 | .category = FIO_OPT_C_GENERAL, | |
4864 | .group = FIO_OPT_G_RUNTIME, | |
4865 | }, | |
4866 | { | |
4867 | .name = "steadystate_ramp_time", | |
4868 | .lname = "Steady state ramp time", | |
4869 | .alias = "ss_ramp", | |
915ca980 | 4870 | .parent = "steadystate", |
16e56d25 VF |
4871 | .type = FIO_OPT_STR_VAL_TIME, |
4872 | .off1 = offsetof(struct thread_options, ss_ramp_time), | |
4873 | .help = "Delay before initiation of data collection for steady state job termination testing", | |
4874 | .def = "0", | |
4875 | .is_seconds = 1, | |
4876 | .is_time = 1, | |
4877 | .category = FIO_OPT_C_GENERAL, | |
4878 | .group = FIO_OPT_G_RUNTIME, | |
4879 | }, | |
214e1eca JA |
4880 | { |
4881 | .name = NULL, | |
4882 | }, | |
4883 | }; | |
4884 | ||
17af15d4 | 4885 | static void add_to_lopt(struct option *lopt, struct fio_option *o, |
de890a1e | 4886 | const char *name, int val) |
9f81736c | 4887 | { |
17af15d4 | 4888 | lopt->name = (char *) name; |
de890a1e | 4889 | lopt->val = val; |
9f81736c | 4890 | if (o->type == FIO_OPT_STR_SET) |
ff52be3d | 4891 | lopt->has_arg = optional_argument; |
9f81736c JA |
4892 | else |
4893 | lopt->has_arg = required_argument; | |
4894 | } | |
4895 | ||
de890a1e SL |
4896 | static void options_to_lopts(struct fio_option *opts, |
4897 | struct option *long_options, | |
4898 | int i, int option_type) | |
214e1eca | 4899 | { |
de890a1e | 4900 | struct fio_option *o = &opts[0]; |
214e1eca | 4901 | while (o->name) { |
de890a1e | 4902 | add_to_lopt(&long_options[i], o, o->name, option_type); |
17af15d4 JA |
4903 | if (o->alias) { |
4904 | i++; | |
de890a1e | 4905 | add_to_lopt(&long_options[i], o, o->alias, option_type); |
17af15d4 | 4906 | } |
214e1eca JA |
4907 | |
4908 | i++; | |
4909 | o++; | |
4910 | assert(i < FIO_NR_OPTIONS); | |
4911 | } | |
4912 | } | |
4913 | ||
de890a1e SL |
4914 | void fio_options_set_ioengine_opts(struct option *long_options, |
4915 | struct thread_data *td) | |
4916 | { | |
4917 | unsigned int i; | |
4918 | ||
4919 | i = 0; | |
4920 | while (long_options[i].name) { | |
4921 | if (long_options[i].val == FIO_GETOPT_IOENGINE) { | |
4922 | memset(&long_options[i], 0, sizeof(*long_options)); | |
4923 | break; | |
4924 | } | |
4925 | i++; | |
4926 | } | |
4927 | ||
4928 | /* | |
4929 | * Just clear out the prior ioengine options. | |
4930 | */ | |
4931 | if (!td || !td->eo) | |
4932 | return; | |
4933 | ||
4934 | options_to_lopts(td->io_ops->options, long_options, i, | |
4935 | FIO_GETOPT_IOENGINE); | |
4936 | } | |
4937 | ||
4938 | void fio_options_dup_and_init(struct option *long_options) | |
4939 | { | |
4940 | unsigned int i; | |
4941 | ||
9af4a244 | 4942 | options_init(fio_options); |
de890a1e SL |
4943 | |
4944 | i = 0; | |
4945 | while (long_options[i].name) | |
4946 | i++; | |
4947 | ||
9af4a244 | 4948 | options_to_lopts(fio_options, long_options, i, FIO_GETOPT_JOB); |
de890a1e SL |
4949 | } |
4950 | ||
74929ac2 JA |
4951 | struct fio_keyword { |
4952 | const char *word; | |
4953 | const char *desc; | |
4954 | char *replace; | |
4955 | }; | |
4956 | ||
4957 | static struct fio_keyword fio_keywords[] = { | |
4958 | { | |
4959 | .word = "$pagesize", | |
4960 | .desc = "Page size in the system", | |
4961 | }, | |
4962 | { | |
4963 | .word = "$mb_memory", | |
4964 | .desc = "Megabytes of memory online", | |
4965 | }, | |
4966 | { | |
4967 | .word = "$ncpus", | |
4968 | .desc = "Number of CPUs online in the system", | |
4969 | }, | |
4970 | { | |
4971 | .word = NULL, | |
4972 | }, | |
4973 | }; | |
4974 | ||
af1dc266 JA |
4975 | void fio_keywords_exit(void) |
4976 | { | |
4977 | struct fio_keyword *kw; | |
4978 | ||
4979 | kw = &fio_keywords[0]; | |
4980 | while (kw->word) { | |
4981 | free(kw->replace); | |
4982 | kw->replace = NULL; | |
4983 | kw++; | |
4984 | } | |
4985 | } | |
4986 | ||
74929ac2 JA |
4987 | void fio_keywords_init(void) |
4988 | { | |
3b2e1464 | 4989 | unsigned long long mb_memory; |
74929ac2 JA |
4990 | char buf[128]; |
4991 | long l; | |
4992 | ||
a4cfc477 | 4993 | sprintf(buf, "%lu", (unsigned long) page_size); |
74929ac2 JA |
4994 | fio_keywords[0].replace = strdup(buf); |
4995 | ||
8eb016d3 | 4996 | mb_memory = os_phys_mem() / (1024 * 1024); |
3b2e1464 | 4997 | sprintf(buf, "%llu", mb_memory); |
74929ac2 JA |
4998 | fio_keywords[1].replace = strdup(buf); |
4999 | ||
c00a2289 | 5000 | l = cpus_online(); |
74929ac2 JA |
5001 | sprintf(buf, "%lu", l); |
5002 | fio_keywords[2].replace = strdup(buf); | |
5003 | } | |
5004 | ||
892a6ffc JA |
5005 | #define BC_APP "bc" |
5006 | ||
5007 | static char *bc_calc(char *str) | |
5008 | { | |
d0c814ec | 5009 | char buf[128], *tmp; |
892a6ffc JA |
5010 | FILE *f; |
5011 | int ret; | |
5012 | ||
5013 | /* | |
5014 | * No math, just return string | |
5015 | */ | |
d0c814ec SL |
5016 | if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') && |
5017 | !strchr(str, '/')) || strchr(str, '\'')) | |
892a6ffc JA |
5018 | return str; |
5019 | ||
5020 | /* | |
5021 | * Split option from value, we only need to calculate the value | |
5022 | */ | |
5023 | tmp = strchr(str, '='); | |
5024 | if (!tmp) | |
5025 | return str; | |
5026 | ||
5027 | tmp++; | |
892a6ffc | 5028 | |
d0c814ec SL |
5029 | /* |
5030 | * Prevent buffer overflows; such a case isn't reasonable anyway | |
5031 | */ | |
5032 | if (strlen(str) >= 128 || strlen(tmp) > 100) | |
5033 | return str; | |
892a6ffc JA |
5034 | |
5035 | sprintf(buf, "which %s > /dev/null", BC_APP); | |
5036 | if (system(buf)) { | |
5037 | log_err("fio: bc is needed for performing math\n"); | |
892a6ffc JA |
5038 | return NULL; |
5039 | } | |
5040 | ||
d0c814ec | 5041 | sprintf(buf, "echo '%s' | %s", tmp, BC_APP); |
892a6ffc | 5042 | f = popen(buf, "r"); |
3c3ed070 | 5043 | if (!f) |
892a6ffc | 5044 | return NULL; |
892a6ffc | 5045 | |
d0c814ec | 5046 | ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f); |
1d824f37 JA |
5047 | if (ret <= 0) { |
5048 | pclose(f); | |
892a6ffc | 5049 | return NULL; |
1d824f37 | 5050 | } |
892a6ffc | 5051 | |
892a6ffc | 5052 | pclose(f); |
d0c814ec SL |
5053 | buf[(tmp - str) + ret - 1] = '\0'; |
5054 | memcpy(buf, str, tmp - str); | |
892a6ffc | 5055 | free(str); |
d0c814ec SL |
5056 | return strdup(buf); |
5057 | } | |
5058 | ||
5059 | /* | |
5060 | * Return a copy of the input string with substrings of the form ${VARNAME} | |
5061 | * substituted with the value of the environment variable VARNAME. The | |
5062 | * substitution always occurs, even if VARNAME is empty or the corresponding | |
5063 | * environment variable undefined. | |
5064 | */ | |
b4f5e72f | 5065 | char *fio_option_dup_subs(const char *opt) |
d0c814ec SL |
5066 | { |
5067 | char out[OPT_LEN_MAX+1]; | |
5068 | char in[OPT_LEN_MAX+1]; | |
5069 | char *outptr = out; | |
5070 | char *inptr = in; | |
5071 | char *ch1, *ch2, *env; | |
5072 | ssize_t nchr = OPT_LEN_MAX; | |
5073 | size_t envlen; | |
5074 | ||
5075 | if (strlen(opt) + 1 > OPT_LEN_MAX) { | |
5076 | log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX); | |
5077 | return NULL; | |
5078 | } | |
5079 | ||
36833fb0 | 5080 | snprintf(in, sizeof(in), "%s", opt); |
d0c814ec SL |
5081 | |
5082 | while (*inptr && nchr > 0) { | |
5083 | if (inptr[0] == '$' && inptr[1] == '{') { | |
5084 | ch2 = strchr(inptr, '}'); | |
5085 | if (ch2 && inptr+1 < ch2) { | |
5086 | ch1 = inptr+2; | |
5087 | inptr = ch2+1; | |
5088 | *ch2 = '\0'; | |
5089 | ||
5090 | env = getenv(ch1); | |
5091 | if (env) { | |
5092 | envlen = strlen(env); | |
5093 | if (envlen <= nchr) { | |
5094 | memcpy(outptr, env, envlen); | |
5095 | outptr += envlen; | |
5096 | nchr -= envlen; | |
5097 | } | |
5098 | } | |
5099 | ||
5100 | continue; | |
5101 | } | |
5102 | } | |
5103 | ||
5104 | *outptr++ = *inptr++; | |
5105 | --nchr; | |
5106 | } | |
5107 | ||
5108 | *outptr = '\0'; | |
5109 | return strdup(out); | |
892a6ffc JA |
5110 | } |
5111 | ||
74929ac2 JA |
5112 | /* |
5113 | * Look for reserved variable names and replace them with real values | |
5114 | */ | |
5115 | static char *fio_keyword_replace(char *opt) | |
5116 | { | |
5117 | char *s; | |
5118 | int i; | |
d0c814ec | 5119 | int docalc = 0; |
74929ac2 JA |
5120 | |
5121 | for (i = 0; fio_keywords[i].word != NULL; i++) { | |
5122 | struct fio_keyword *kw = &fio_keywords[i]; | |
5123 | ||
5124 | while ((s = strstr(opt, kw->word)) != NULL) { | |
33153428 | 5125 | char *new = calloc(strlen(opt) + 1, 1); |
74929ac2 JA |
5126 | char *o_org = opt; |
5127 | int olen = s - opt; | |
5128 | int len; | |
5129 | ||
5130 | /* | |
5131 | * Copy part of the string before the keyword and | |
5132 | * sprintf() the replacement after it. | |
5133 | */ | |
5134 | memcpy(new, opt, olen); | |
5135 | len = sprintf(new + olen, "%s", kw->replace); | |
5136 | ||
5137 | /* | |
5138 | * If there's more in the original string, copy that | |
5139 | * in too | |
5140 | */ | |
85b9ee7e | 5141 | opt += olen + strlen(kw->word); |
33153428 | 5142 | /* keeps final zero thanks to calloc */ |
74929ac2 | 5143 | if (strlen(opt)) |
85b9ee7e | 5144 | memcpy(new + olen + len, opt, strlen(opt)); |
74929ac2 JA |
5145 | |
5146 | /* | |
5147 | * replace opt and free the old opt | |
5148 | */ | |
5149 | opt = new; | |
d0c814ec | 5150 | free(o_org); |
7a958bd5 | 5151 | |
d0c814ec | 5152 | docalc = 1; |
74929ac2 JA |
5153 | } |
5154 | } | |
5155 | ||
d0c814ec SL |
5156 | /* |
5157 | * Check for potential math and invoke bc, if possible | |
5158 | */ | |
5159 | if (docalc) | |
5160 | opt = bc_calc(opt); | |
5161 | ||
7a958bd5 | 5162 | return opt; |
74929ac2 JA |
5163 | } |
5164 | ||
d0c814ec SL |
5165 | static char **dup_and_sub_options(char **opts, int num_opts) |
5166 | { | |
5167 | int i; | |
5168 | char **opts_copy = malloc(num_opts * sizeof(*opts)); | |
5169 | for (i = 0; i < num_opts; i++) { | |
b4f5e72f | 5170 | opts_copy[i] = fio_option_dup_subs(opts[i]); |
d0c814ec SL |
5171 | if (!opts_copy[i]) |
5172 | continue; | |
5173 | opts_copy[i] = fio_keyword_replace(opts_copy[i]); | |
5174 | } | |
5175 | return opts_copy; | |
5176 | } | |
5177 | ||
e15b023b | 5178 | static void show_closest_option(const char *opt) |
a2d027b9 JA |
5179 | { |
5180 | int best_option, best_distance; | |
5181 | int i, distance; | |
e15b023b JA |
5182 | char *name; |
5183 | ||
5184 | if (!strlen(opt)) | |
5185 | return; | |
5186 | ||
5187 | name = strdup(opt); | |
5188 | i = 0; | |
5189 | while (name[i] != '\0' && name[i] != '=') | |
5190 | i++; | |
5191 | name[i] = '\0'; | |
a2d027b9 JA |
5192 | |
5193 | best_option = -1; | |
5194 | best_distance = INT_MAX; | |
5195 | i = 0; | |
5196 | while (fio_options[i].name) { | |
5197 | distance = string_distance(name, fio_options[i].name); | |
5198 | if (distance < best_distance) { | |
5199 | best_distance = distance; | |
5200 | best_option = i; | |
5201 | } | |
5202 | i++; | |
5203 | } | |
5204 | ||
75e6bcba JA |
5205 | if (best_option != -1 && string_distance_ok(name, best_distance) && |
5206 | fio_options[best_option].type != FIO_OPT_UNSUPPORTED) | |
a2d027b9 | 5207 | log_err("Did you mean %s?\n", fio_options[best_option].name); |
e15b023b JA |
5208 | |
5209 | free(name); | |
a2d027b9 JA |
5210 | } |
5211 | ||
c2292325 | 5212 | int fio_options_parse(struct thread_data *td, char **opts, int num_opts) |
214e1eca | 5213 | { |
de890a1e | 5214 | int i, ret, unknown; |
d0c814ec | 5215 | char **opts_copy; |
3b8b7135 | 5216 | |
9af4a244 | 5217 | sort_options(opts, fio_options, num_opts); |
d0c814ec | 5218 | opts_copy = dup_and_sub_options(opts, num_opts); |
3b8b7135 | 5219 | |
de890a1e | 5220 | for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) { |
9109883a | 5221 | const struct fio_option *o; |
9af4a244 | 5222 | int newret = parse_option(opts_copy[i], opts[i], fio_options, |
a609f12a | 5223 | &o, &td->o, &td->opt_list); |
d0c814ec | 5224 | |
a8523a6a JA |
5225 | if (!newret && o) |
5226 | fio_option_mark_set(&td->o, o); | |
5227 | ||
de890a1e SL |
5228 | if (opts_copy[i]) { |
5229 | if (newret && !o) { | |
5230 | unknown++; | |
5231 | continue; | |
5232 | } | |
d0c814ec | 5233 | free(opts_copy[i]); |
de890a1e SL |
5234 | opts_copy[i] = NULL; |
5235 | } | |
5236 | ||
5237 | ret |= newret; | |
5238 | } | |
5239 | ||
5240 | if (unknown) { | |
5241 | ret |= ioengine_load(td); | |
5242 | if (td->eo) { | |
5243 | sort_options(opts_copy, td->io_ops->options, num_opts); | |
5244 | opts = opts_copy; | |
5245 | } | |
5246 | for (i = 0; i < num_opts; i++) { | |
9109883a | 5247 | const struct fio_option *o = NULL; |
de890a1e | 5248 | int newret = 1; |
a2d027b9 | 5249 | |
de890a1e SL |
5250 | if (!opts_copy[i]) |
5251 | continue; | |
5252 | ||
5253 | if (td->eo) | |
5254 | newret = parse_option(opts_copy[i], opts[i], | |
5255 | td->io_ops->options, &o, | |
66e19a38 | 5256 | td->eo, &td->opt_list); |
de890a1e SL |
5257 | |
5258 | ret |= newret; | |
a2d027b9 | 5259 | if (!o) { |
de890a1e | 5260 | log_err("Bad option <%s>\n", opts[i]); |
a2d027b9 JA |
5261 | show_closest_option(opts[i]); |
5262 | } | |
de890a1e SL |
5263 | free(opts_copy[i]); |
5264 | opts_copy[i] = NULL; | |
5265 | } | |
74929ac2 | 5266 | } |
3b8b7135 | 5267 | |
d0c814ec | 5268 | free(opts_copy); |
3b8b7135 | 5269 | return ret; |
214e1eca JA |
5270 | } |
5271 | ||
5272 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) | |
5273 | { | |
a8523a6a JA |
5274 | int ret; |
5275 | ||
a609f12a | 5276 | ret = parse_cmd_option(opt, val, fio_options, &td->o, &td->opt_list); |
a8523a6a | 5277 | if (!ret) { |
9109883a | 5278 | const struct fio_option *o; |
a8523a6a | 5279 | |
9109883a | 5280 | o = find_option_c(fio_options, opt); |
a8523a6a JA |
5281 | if (o) |
5282 | fio_option_mark_set(&td->o, o); | |
5283 | } | |
5284 | ||
5285 | return ret; | |
214e1eca JA |
5286 | } |
5287 | ||
de890a1e SL |
5288 | int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt, |
5289 | char *val) | |
5290 | { | |
d8b4f395 JA |
5291 | return parse_cmd_option(opt, val, td->io_ops->options, td->eo, |
5292 | &td->opt_list); | |
de890a1e SL |
5293 | } |
5294 | ||
214e1eca JA |
5295 | void fio_fill_default_options(struct thread_data *td) |
5296 | { | |
cb1402d6 | 5297 | td->o.magic = OPT_MAGIC; |
a609f12a | 5298 | fill_default_options(&td->o, fio_options); |
214e1eca JA |
5299 | } |
5300 | ||
5301 | int fio_show_option_help(const char *opt) | |
5302 | { | |
9af4a244 | 5303 | return show_cmd_help(fio_options, opt); |
214e1eca | 5304 | } |
d23bb327 | 5305 | |
de890a1e SL |
5306 | /* |
5307 | * dupe FIO_OPT_STR_STORE options | |
5308 | */ | |
5309 | void fio_options_mem_dupe(struct thread_data *td) | |
5310 | { | |
53b5693d | 5311 | options_mem_dupe(fio_options, &td->o); |
1647f592 JA |
5312 | |
5313 | if (td->eo && td->io_ops) { | |
de890a1e | 5314 | void *oldeo = td->eo; |
1647f592 | 5315 | |
de890a1e SL |
5316 | td->eo = malloc(td->io_ops->option_struct_size); |
5317 | memcpy(td->eo, oldeo, td->io_ops->option_struct_size); | |
53b5693d | 5318 | options_mem_dupe(td->io_ops->options, td->eo); |
de890a1e SL |
5319 | } |
5320 | } | |
5321 | ||
d6978a32 JA |
5322 | unsigned int fio_get_kb_base(void *data) |
5323 | { | |
a609f12a JA |
5324 | struct thread_data *td = cb_data_to_td(data); |
5325 | struct thread_options *o = &td->o; | |
d6978a32 JA |
5326 | unsigned int kb_base = 0; |
5327 | ||
cb1402d6 JA |
5328 | /* |
5329 | * This is a hack... For private options, *data is not holding | |
5330 | * a pointer to the thread_options, but to private data. This means | |
5331 | * we can't safely dereference it, but magic is first so mem wise | |
5332 | * it is valid. But this also means that if the job first sets | |
5333 | * kb_base and expects that to be honored by private options, | |
5334 | * it will be disappointed. We will return the global default | |
5335 | * for this. | |
5336 | */ | |
5337 | if (o && o->magic == OPT_MAGIC) | |
83ea422a | 5338 | kb_base = o->kb_base; |
d6978a32 JA |
5339 | if (!kb_base) |
5340 | kb_base = 1024; | |
5341 | ||
5342 | return kb_base; | |
5343 | } | |
9f988e2e | 5344 | |
9109883a | 5345 | int add_option(const struct fio_option *o) |
9f988e2e | 5346 | { |
07b3232d JA |
5347 | struct fio_option *__o; |
5348 | int opt_index = 0; | |
5349 | ||
9af4a244 | 5350 | __o = fio_options; |
07b3232d JA |
5351 | while (__o->name) { |
5352 | opt_index++; | |
5353 | __o++; | |
5354 | } | |
5355 | ||
7b504edd JA |
5356 | if (opt_index + 1 == FIO_MAX_OPTS) { |
5357 | log_err("fio: FIO_MAX_OPTS is too small\n"); | |
5358 | return 1; | |
5359 | } | |
5360 | ||
9af4a244 | 5361 | memcpy(&fio_options[opt_index], o, sizeof(*o)); |
7b504edd | 5362 | fio_options[opt_index + 1].name = NULL; |
07b3232d | 5363 | return 0; |
9f988e2e | 5364 | } |
e2de69da | 5365 | |
07b3232d | 5366 | void invalidate_profile_options(const char *prof_name) |
e2de69da | 5367 | { |
07b3232d | 5368 | struct fio_option *o; |
e2de69da | 5369 | |
9af4a244 | 5370 | o = fio_options; |
07b3232d JA |
5371 | while (o->name) { |
5372 | if (o->prof_name && !strcmp(o->prof_name, prof_name)) { | |
5373 | o->type = FIO_OPT_INVALID; | |
5374 | o->prof_name = NULL; | |
5375 | } | |
5376 | o++; | |
e2de69da JA |
5377 | } |
5378 | } | |
f5b6bb85 JA |
5379 | |
5380 | void add_opt_posval(const char *optname, const char *ival, const char *help) | |
5381 | { | |
5382 | struct fio_option *o; | |
5383 | unsigned int i; | |
5384 | ||
9af4a244 | 5385 | o = find_option(fio_options, optname); |
f5b6bb85 JA |
5386 | if (!o) |
5387 | return; | |
5388 | ||
5389 | for (i = 0; i < PARSE_MAX_VP; i++) { | |
5390 | if (o->posval[i].ival) | |
5391 | continue; | |
5392 | ||
5393 | o->posval[i].ival = ival; | |
5394 | o->posval[i].help = help; | |
5395 | break; | |
5396 | } | |
5397 | } | |
5398 | ||
5399 | void del_opt_posval(const char *optname, const char *ival) | |
5400 | { | |
5401 | struct fio_option *o; | |
5402 | unsigned int i; | |
5403 | ||
9af4a244 | 5404 | o = find_option(fio_options, optname); |
f5b6bb85 JA |
5405 | if (!o) |
5406 | return; | |
5407 | ||
5408 | for (i = 0; i < PARSE_MAX_VP; i++) { | |
5409 | if (!o->posval[i].ival) | |
5410 | continue; | |
5411 | if (strcmp(o->posval[i].ival, ival)) | |
5412 | continue; | |
5413 | ||
5414 | o->posval[i].ival = NULL; | |
5415 | o->posval[i].help = NULL; | |
5416 | } | |
5417 | } | |
7e356b2d JA |
5418 | |
5419 | void fio_options_free(struct thread_data *td) | |
5420 | { | |
ca6336a8 | 5421 | options_free(fio_options, &td->o); |
de890a1e SL |
5422 | if (td->eo && td->io_ops && td->io_ops->options) { |
5423 | options_free(td->io_ops->options, td->eo); | |
5424 | free(td->eo); | |
5425 | td->eo = NULL; | |
5426 | } | |
7e356b2d | 5427 | } |
c504ee55 JA |
5428 | |
5429 | struct fio_option *fio_option_find(const char *name) | |
5430 | { | |
5431 | return find_option(fio_options, name); | |
5432 | } | |
5433 | ||
517c9c72 | 5434 | static struct fio_option *find_next_opt(struct fio_option *from, |
f0e7f45a | 5435 | unsigned int off1) |
a8523a6a | 5436 | { |
f0e7f45a | 5437 | struct fio_option *opt; |
a8523a6a | 5438 | |
f0e7f45a JA |
5439 | if (!from) |
5440 | from = &fio_options[0]; | |
5441 | else | |
5442 | from++; | |
5443 | ||
5444 | opt = NULL; | |
5445 | do { | |
5446 | if (off1 == from->off1) { | |
5447 | opt = from; | |
a8523a6a JA |
5448 | break; |
5449 | } | |
f0e7f45a JA |
5450 | from++; |
5451 | } while (from->name); | |
a8523a6a | 5452 | |
f0e7f45a JA |
5453 | return opt; |
5454 | } | |
5455 | ||
5456 | static int opt_is_set(struct thread_options *o, struct fio_option *opt) | |
5457 | { | |
5458 | unsigned int opt_off, index, offset; | |
a8523a6a JA |
5459 | |
5460 | opt_off = opt - &fio_options[0]; | |
5461 | index = opt_off / (8 * sizeof(uint64_t)); | |
5462 | offset = opt_off & ((8 * sizeof(uint64_t)) - 1); | |
e9d686d6 | 5463 | return (o->set_options[index] & ((uint64_t)1 << offset)) != 0; |
a8523a6a JA |
5464 | } |
5465 | ||
72f39748 | 5466 | bool __fio_option_is_set(struct thread_options *o, unsigned int off1) |
f0e7f45a JA |
5467 | { |
5468 | struct fio_option *opt, *next; | |
5469 | ||
5470 | next = NULL; | |
517c9c72 | 5471 | while ((opt = find_next_opt(next, off1)) != NULL) { |
f0e7f45a | 5472 | if (opt_is_set(o, opt)) |
72f39748 | 5473 | return true; |
f0e7f45a JA |
5474 | |
5475 | next = opt; | |
5476 | } | |
5477 | ||
72f39748 | 5478 | return false; |
f0e7f45a JA |
5479 | } |
5480 | ||
9109883a | 5481 | void fio_option_mark_set(struct thread_options *o, const struct fio_option *opt) |
a8523a6a JA |
5482 | { |
5483 | unsigned int opt_off, index, offset; | |
5484 | ||
5485 | opt_off = opt - &fio_options[0]; | |
5486 | index = opt_off / (8 * sizeof(uint64_t)); | |
5487 | offset = opt_off & ((8 * sizeof(uint64_t)) - 1); | |
e9d686d6 | 5488 | o->set_options[index] |= (uint64_t)1 << offset; |
a8523a6a | 5489 | } |