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