Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1 | #include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <unistd.h> |
| 4 | #include <ctype.h> |
| 5 | #include <string.h> |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 6 | #include <assert.h> |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 7 | #include <libgen.h> |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 8 | #include <fcntl.h> |
| 9 | #include <sys/types.h> |
| 10 | #include <sys/stat.h> |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 11 | |
| 12 | #include "fio.h" |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 13 | #include "verify.h" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 14 | #include "parse.h" |
Jens Axboe | eef3235 | 2008-06-02 13:31:26 +0200 | [diff] [blame] | 15 | #include "lib/fls.h" |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 16 | #include "options.h" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 17 | |
Jens Axboe | 5d7c5d3 | 2010-06-21 15:08:17 +0200 | [diff] [blame] | 18 | #include "crc/crc32c.h" |
| 19 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 20 | /* |
| 21 | * Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that. |
| 22 | */ |
| 23 | static char *get_opt_postfix(const char *str) |
| 24 | { |
| 25 | char *p = strstr(str, ":"); |
| 26 | |
| 27 | if (!p) |
| 28 | return NULL; |
| 29 | |
| 30 | p++; |
| 31 | strip_blank_front(&p); |
| 32 | strip_blank_end(p); |
| 33 | return strdup(p); |
| 34 | } |
| 35 | |
Radha Ramachandran | 0e92f87 | 2009-10-27 20:14:27 +0100 | [diff] [blame] | 36 | static int converthexchartoint(char a) |
| 37 | { |
| 38 | int base; |
| 39 | |
| 40 | switch(a) { |
| 41 | case '0'...'9': |
| 42 | base = '0'; |
| 43 | break; |
| 44 | case 'A'...'F': |
| 45 | base = 'A' - 10; |
| 46 | break; |
| 47 | case 'a'...'f': |
| 48 | base = 'a' - 10; |
| 49 | break; |
| 50 | default: |
| 51 | base = 0; |
| 52 | } |
| 53 | return (a - base); |
| 54 | } |
| 55 | |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 56 | static int bs_cmp(const void *p1, const void *p2) |
| 57 | { |
| 58 | const struct bssplit *bsp1 = p1; |
| 59 | const struct bssplit *bsp2 = p2; |
| 60 | |
| 61 | return bsp1->perc < bsp2->perc; |
| 62 | } |
| 63 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 64 | static int bssplit_ddir(struct thread_data *td, int ddir, char *str) |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 65 | { |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 66 | struct bssplit *bssplit; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 67 | unsigned int i, perc, perc_missing; |
| 68 | unsigned int max_bs, min_bs; |
| 69 | long long val; |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 70 | char *fname; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 71 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 72 | td->o.bssplit_nr[ddir] = 4; |
| 73 | bssplit = malloc(4 * sizeof(struct bssplit)); |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 74 | |
| 75 | i = 0; |
| 76 | max_bs = 0; |
| 77 | min_bs = -1; |
| 78 | while ((fname = strsep(&str, ":")) != NULL) { |
| 79 | char *perc_str; |
| 80 | |
| 81 | if (!strlen(fname)) |
| 82 | break; |
| 83 | |
| 84 | /* |
| 85 | * grow struct buffer, if needed |
| 86 | */ |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 87 | if (i == td->o.bssplit_nr[ddir]) { |
| 88 | td->o.bssplit_nr[ddir] <<= 1; |
| 89 | bssplit = realloc(bssplit, td->o.bssplit_nr[ddir] |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 90 | * sizeof(struct bssplit)); |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | perc_str = strstr(fname, "/"); |
| 94 | if (perc_str) { |
| 95 | *perc_str = '\0'; |
| 96 | perc_str++; |
| 97 | perc = atoi(perc_str); |
| 98 | if (perc > 100) |
| 99 | perc = 100; |
| 100 | else if (!perc) |
| 101 | perc = -1; |
| 102 | } else |
| 103 | perc = -1; |
| 104 | |
Jens Axboe | 6925dd3 | 2011-09-07 22:10:11 +0200 | [diff] [blame] | 105 | if (str_to_decimal(fname, &val, 1, td)) { |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 106 | log_err("fio: bssplit conversion failed\n"); |
| 107 | free(td->o.bssplit); |
| 108 | return 1; |
| 109 | } |
| 110 | |
| 111 | if (val > max_bs) |
| 112 | max_bs = val; |
| 113 | if (val < min_bs) |
| 114 | min_bs = val; |
| 115 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 116 | bssplit[i].bs = val; |
| 117 | bssplit[i].perc = perc; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 118 | i++; |
| 119 | } |
| 120 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 121 | td->o.bssplit_nr[ddir] = i; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 122 | |
| 123 | /* |
| 124 | * Now check if the percentages add up, and how much is missing |
| 125 | */ |
| 126 | perc = perc_missing = 0; |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 127 | for (i = 0; i < td->o.bssplit_nr[ddir]; i++) { |
| 128 | struct bssplit *bsp = &bssplit[i]; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 129 | |
| 130 | if (bsp->perc == (unsigned char) -1) |
| 131 | perc_missing++; |
| 132 | else |
| 133 | perc += bsp->perc; |
| 134 | } |
| 135 | |
| 136 | if (perc > 100) { |
| 137 | log_err("fio: bssplit percentages add to more than 100%%\n"); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 138 | free(bssplit); |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 139 | return 1; |
| 140 | } |
| 141 | /* |
| 142 | * If values didn't have a percentage set, divide the remains between |
| 143 | * them. |
| 144 | */ |
| 145 | if (perc_missing) { |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 146 | for (i = 0; i < td->o.bssplit_nr[ddir]; i++) { |
| 147 | struct bssplit *bsp = &bssplit[i]; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 148 | |
| 149 | if (bsp->perc == (unsigned char) -1) |
| 150 | bsp->perc = (100 - perc) / perc_missing; |
| 151 | } |
| 152 | } |
| 153 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 154 | td->o.min_bs[ddir] = min_bs; |
| 155 | td->o.max_bs[ddir] = max_bs; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 156 | |
| 157 | /* |
| 158 | * now sort based on percentages, for ease of lookup |
| 159 | */ |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 160 | qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp); |
| 161 | td->o.bssplit[ddir] = bssplit; |
| 162 | return 0; |
| 163 | |
| 164 | } |
| 165 | |
| 166 | static int str_bssplit_cb(void *data, const char *input) |
| 167 | { |
| 168 | struct thread_data *td = data; |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 169 | char *str, *p, *odir, *ddir; |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 170 | int ret = 0; |
| 171 | |
| 172 | p = str = strdup(input); |
| 173 | |
| 174 | strip_blank_front(&str); |
| 175 | strip_blank_end(str); |
| 176 | |
| 177 | odir = strchr(str, ','); |
| 178 | if (odir) { |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 179 | ddir = strchr(odir + 1, ','); |
| 180 | if (ddir) { |
| 181 | ret = bssplit_ddir(td, DDIR_TRIM, ddir + 1); |
| 182 | if (!ret) |
| 183 | *ddir = '\0'; |
| 184 | } else { |
| 185 | char *op; |
| 186 | |
| 187 | op = strdup(odir + 1); |
| 188 | ret = bssplit_ddir(td, DDIR_TRIM, op); |
| 189 | |
| 190 | free(op); |
| 191 | } |
| 192 | if (!ret) |
| 193 | ret = bssplit_ddir(td, DDIR_WRITE, odir + 1); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 194 | if (!ret) { |
| 195 | *odir = '\0'; |
| 196 | ret = bssplit_ddir(td, DDIR_READ, str); |
| 197 | } |
| 198 | } else { |
| 199 | char *op; |
| 200 | |
| 201 | op = strdup(str); |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 202 | ret = bssplit_ddir(td, DDIR_WRITE, op); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 203 | free(op); |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 204 | |
| 205 | if (!ret) { |
| 206 | op = strdup(str); |
| 207 | ret = bssplit_ddir(td, DDIR_TRIM, op); |
| 208 | free(op); |
| 209 | } |
| 210 | ret = bssplit_ddir(td, DDIR_READ, str); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 211 | } |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 212 | |
| 213 | free(p); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 214 | return ret; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 215 | } |
| 216 | |
Dmitry Monakhov | 8b28bd4 | 2012-09-23 15:46:09 +0400 | [diff] [blame] | 217 | static int str2error(char *str) |
| 218 | { |
| 219 | const char * err[] = {"EPERM", "ENOENT", "ESRCH", "EINTR", "EIO", |
| 220 | "ENXIO", "E2BIG", "ENOEXEC", "EBADF", |
| 221 | "ECHILD", "EAGAIN", "ENOMEM", "EACCES", |
| 222 | "EFAULT", "ENOTBLK", "EBUSY", "EEXIST", |
| 223 | "EXDEV", "ENODEV", "ENOTDIR", "EISDIR", |
| 224 | "EINVAL", "ENFILE", "EMFILE", "ENOTTY", |
| 225 | "ETXTBSY","EFBIG", "ENOSPC", "ESPIPE", |
| 226 | "EROFS","EMLINK", "EPIPE", "EDOM", "ERANGE"}; |
| 227 | int i = 0, num = sizeof(err) / sizeof(void *); |
| 228 | |
| 229 | while( i < num) { |
| 230 | if (!strcmp(err[i], str)) |
| 231 | return i + 1; |
| 232 | i++; |
| 233 | } |
| 234 | return 0; |
| 235 | } |
| 236 | |
| 237 | static int ignore_error_type(struct thread_data *td, int etype, char *str) |
| 238 | { |
| 239 | unsigned int i; |
| 240 | int *error; |
| 241 | char *fname; |
| 242 | |
| 243 | if (etype >= ERROR_TYPE_CNT) { |
| 244 | log_err("Illegal error type\n"); |
| 245 | return 1; |
| 246 | } |
| 247 | |
| 248 | td->o.ignore_error_nr[etype] = 4; |
| 249 | error = malloc(4 * sizeof(struct bssplit)); |
| 250 | |
| 251 | i = 0; |
| 252 | while ((fname = strsep(&str, ":")) != NULL) { |
| 253 | |
| 254 | if (!strlen(fname)) |
| 255 | break; |
| 256 | |
| 257 | /* |
| 258 | * grow struct buffer, if needed |
| 259 | */ |
| 260 | if (i == td->o.ignore_error_nr[etype]) { |
| 261 | td->o.ignore_error_nr[etype] <<= 1; |
| 262 | error = realloc(error, td->o.ignore_error_nr[etype] |
| 263 | * sizeof(int)); |
| 264 | } |
| 265 | if (fname[0] == 'E') { |
| 266 | error[i] = str2error(fname); |
| 267 | } else { |
| 268 | error[i] = atoi(fname); |
| 269 | if (error[i] < 0) |
| 270 | error[i] = error[i]; |
| 271 | } |
| 272 | if (!error[i]) { |
| 273 | log_err("Unknown error %s, please use number value \n", |
| 274 | fname); |
| 275 | return 1; |
| 276 | } |
| 277 | i++; |
| 278 | } |
| 279 | if (i) { |
| 280 | td->o.continue_on_error |= 1 << etype; |
| 281 | td->o.ignore_error_nr[etype] = i; |
| 282 | td->o.ignore_error[etype] = error; |
| 283 | } |
| 284 | return 0; |
| 285 | |
| 286 | } |
| 287 | |
| 288 | static int str_ignore_error_cb(void *data, const char *input) |
| 289 | { |
| 290 | struct thread_data *td = data; |
| 291 | char *str, *p, *n; |
| 292 | int type = 0, ret = 1; |
| 293 | p = str = strdup(input); |
| 294 | |
| 295 | strip_blank_front(&str); |
| 296 | strip_blank_end(str); |
| 297 | |
| 298 | while (p) { |
| 299 | n = strchr(p, ','); |
| 300 | if (n) |
| 301 | *n++ = '\0'; |
| 302 | ret = ignore_error_type(td, type, p); |
| 303 | if (ret) |
| 304 | break; |
| 305 | p = n; |
| 306 | type++; |
| 307 | } |
| 308 | free(str); |
| 309 | return ret; |
| 310 | } |
| 311 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 312 | static int str_rw_cb(void *data, const char *str) |
| 313 | { |
| 314 | struct thread_data *td = data; |
| 315 | char *nr = get_opt_postfix(str); |
| 316 | |
Jens Axboe | 5736c10 | 2010-07-20 12:03:25 -0600 | [diff] [blame] | 317 | td->o.ddir_seq_nr = 1; |
Jens Axboe | 059b080 | 2011-08-25 09:09:37 +0200 | [diff] [blame] | 318 | td->o.ddir_seq_add = 0; |
| 319 | |
| 320 | if (!nr) |
| 321 | return 0; |
| 322 | |
| 323 | if (td_random(td)) |
Jens Axboe | 5736c10 | 2010-07-20 12:03:25 -0600 | [diff] [blame] | 324 | td->o.ddir_seq_nr = atoi(nr); |
Jens Axboe | 059b080 | 2011-08-25 09:09:37 +0200 | [diff] [blame] | 325 | else { |
| 326 | long long val; |
| 327 | |
Jens Axboe | 6925dd3 | 2011-09-07 22:10:11 +0200 | [diff] [blame] | 328 | if (str_to_decimal(nr, &val, 1, td)) { |
Jens Axboe | 059b080 | 2011-08-25 09:09:37 +0200 | [diff] [blame] | 329 | log_err("fio: rw postfix parsing failed\n"); |
| 330 | free(nr); |
| 331 | return 1; |
| 332 | } |
| 333 | |
| 334 | td->o.ddir_seq_add = val; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 335 | } |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 336 | |
Jens Axboe | 059b080 | 2011-08-25 09:09:37 +0200 | [diff] [blame] | 337 | free(nr); |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 338 | return 0; |
| 339 | } |
| 340 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 341 | static int str_mem_cb(void *data, const char *mem) |
| 342 | { |
| 343 | struct thread_data *td = data; |
| 344 | |
Shaohua Li | d9759b1 | 2013-01-17 13:28:15 +0100 | [diff] [blame] | 345 | if (td->o.mem_type == MEM_MMAPHUGE || td->o.mem_type == MEM_MMAP) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 346 | td->mmapfile = get_opt_postfix(mem); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 347 | |
| 348 | return 0; |
| 349 | } |
| 350 | |
Jens Axboe | 5d7c5d3 | 2010-06-21 15:08:17 +0200 | [diff] [blame] | 351 | static int str_verify_cb(void *data, const char *mem) |
| 352 | { |
| 353 | struct thread_data *td = data; |
| 354 | |
Jens Axboe | e3aaafc | 2012-02-22 20:28:17 +0100 | [diff] [blame] | 355 | if (td->o.verify == VERIFY_CRC32C_INTEL || |
| 356 | td->o.verify == VERIFY_CRC32C) { |
| 357 | crc32c_intel_probe(); |
Jens Axboe | 5d7c5d3 | 2010-06-21 15:08:17 +0200 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | return 0; |
| 361 | } |
| 362 | |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 363 | static int fio_clock_source_cb(void *data, const char *str) |
| 364 | { |
| 365 | struct thread_data *td = data; |
| 366 | |
| 367 | fio_clock_source = td->o.clocksource; |
Jens Axboe | fa80fea | 2012-12-09 20:29:00 +0100 | [diff] [blame] | 368 | fio_clock_source_set = 1; |
Jens Axboe | 01423ea | 2012-12-14 20:37:06 +0100 | [diff] [blame] | 369 | fio_clock_init(); |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 370 | return 0; |
| 371 | } |
| 372 | |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 373 | static int str_lockmem_cb(void fio_unused *data, unsigned long long *val) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 374 | { |
| 375 | mlock_size = *val; |
| 376 | return 0; |
| 377 | } |
| 378 | |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 379 | static int str_rwmix_read_cb(void *data, unsigned long long *val) |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 380 | { |
| 381 | struct thread_data *td = data; |
| 382 | |
| 383 | td->o.rwmix[DDIR_READ] = *val; |
| 384 | td->o.rwmix[DDIR_WRITE] = 100 - *val; |
| 385 | return 0; |
| 386 | } |
| 387 | |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 388 | static int str_rwmix_write_cb(void *data, unsigned long long *val) |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 389 | { |
| 390 | struct thread_data *td = data; |
| 391 | |
| 392 | td->o.rwmix[DDIR_WRITE] = *val; |
| 393 | td->o.rwmix[DDIR_READ] = 100 - *val; |
| 394 | return 0; |
| 395 | } |
| 396 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 397 | #ifdef FIO_HAVE_IOPRIO |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 398 | static int str_prioclass_cb(void *data, unsigned long long *val) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 399 | { |
| 400 | struct thread_data *td = data; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 401 | unsigned short mask; |
| 402 | |
| 403 | /* |
| 404 | * mask off old class bits, str_prio_cb() may have set a default class |
| 405 | */ |
| 406 | mask = (1 << IOPRIO_CLASS_SHIFT) - 1; |
| 407 | td->ioprio &= mask; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 408 | |
| 409 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; |
Jens Axboe | ac68478 | 2007-11-08 08:29:07 +0100 | [diff] [blame] | 410 | td->ioprio_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 411 | return 0; |
| 412 | } |
| 413 | |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 414 | static int str_prio_cb(void *data, unsigned long long *val) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 415 | { |
| 416 | struct thread_data *td = data; |
| 417 | |
| 418 | td->ioprio |= *val; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 419 | |
| 420 | /* |
| 421 | * If no class is set, assume BE |
| 422 | */ |
| 423 | if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) |
| 424 | td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; |
| 425 | |
Jens Axboe | ac68478 | 2007-11-08 08:29:07 +0100 | [diff] [blame] | 426 | td->ioprio_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 427 | return 0; |
| 428 | } |
| 429 | #endif |
| 430 | |
| 431 | static int str_exitall_cb(void) |
| 432 | { |
| 433 | exitall_on_terminate = 1; |
| 434 | return 0; |
| 435 | } |
| 436 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 437 | #ifdef FIO_HAVE_CPU_AFFINITY |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 438 | static int str_cpumask_cb(void *data, unsigned long long *val) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 439 | { |
| 440 | struct thread_data *td = data; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 441 | unsigned int i; |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 442 | long max_cpu; |
Jens Axboe | d2ce18b | 2008-12-12 20:51:40 +0100 | [diff] [blame] | 443 | int ret; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 444 | |
Jens Axboe | d2ce18b | 2008-12-12 20:51:40 +0100 | [diff] [blame] | 445 | ret = fio_cpuset_init(&td->o.cpumask); |
| 446 | if (ret < 0) { |
| 447 | log_err("fio: cpuset_init failed\n"); |
| 448 | td_verror(td, ret, "fio_cpuset_init"); |
| 449 | return 1; |
| 450 | } |
| 451 | |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 452 | max_cpu = cpus_online(); |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 453 | |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 454 | for (i = 0; i < sizeof(int) * 8; i++) { |
| 455 | if ((1 << i) & *val) { |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 456 | if (i > max_cpu) { |
| 457 | log_err("fio: CPU %d too large (max=%ld)\n", i, |
| 458 | max_cpu); |
| 459 | return 1; |
| 460 | } |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 461 | dprint(FD_PARSE, "set cpu allowed %d\n", i); |
Jens Axboe | 6d459ee | 2008-12-12 20:02:58 +0100 | [diff] [blame] | 462 | fio_cpu_set(&td->o.cpumask, i); |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 463 | } |
| 464 | } |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 465 | |
Jens Axboe | 375b269 | 2007-05-22 09:13:02 +0200 | [diff] [blame] | 466 | td->o.cpumask_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 467 | return 0; |
| 468 | } |
| 469 | |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 470 | static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask, |
| 471 | const char *input) |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 472 | { |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 473 | char *cpu, *str, *p; |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 474 | long max_cpu; |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 475 | int ret = 0; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 476 | |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 477 | ret = fio_cpuset_init(mask); |
Jens Axboe | d2ce18b | 2008-12-12 20:51:40 +0100 | [diff] [blame] | 478 | if (ret < 0) { |
| 479 | log_err("fio: cpuset_init failed\n"); |
| 480 | td_verror(td, ret, "fio_cpuset_init"); |
| 481 | return 1; |
| 482 | } |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 483 | |
| 484 | p = str = strdup(input); |
| 485 | |
| 486 | strip_blank_front(&str); |
| 487 | strip_blank_end(str); |
| 488 | |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 489 | max_cpu = cpus_online(); |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 490 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 491 | while ((cpu = strsep(&str, ",")) != NULL) { |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 492 | char *str2, *cpu2; |
| 493 | int icpu, icpu2; |
| 494 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 495 | if (!strlen(cpu)) |
| 496 | break; |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 497 | |
| 498 | str2 = cpu; |
| 499 | icpu2 = -1; |
| 500 | while ((cpu2 = strsep(&str2, "-")) != NULL) { |
| 501 | if (!strlen(cpu2)) |
| 502 | break; |
| 503 | |
| 504 | icpu2 = atoi(cpu2); |
| 505 | } |
| 506 | |
| 507 | icpu = atoi(cpu); |
| 508 | if (icpu2 == -1) |
| 509 | icpu2 = icpu; |
| 510 | while (icpu <= icpu2) { |
Jens Axboe | 6d459ee | 2008-12-12 20:02:58 +0100 | [diff] [blame] | 511 | if (icpu >= FIO_MAX_CPUS) { |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 512 | log_err("fio: your OS only supports up to" |
Jens Axboe | 6d459ee | 2008-12-12 20:02:58 +0100 | [diff] [blame] | 513 | " %d CPUs\n", (int) FIO_MAX_CPUS); |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 514 | ret = 1; |
| 515 | break; |
| 516 | } |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 517 | if (icpu > max_cpu) { |
| 518 | log_err("fio: CPU %d too large (max=%ld)\n", |
| 519 | icpu, max_cpu); |
| 520 | ret = 1; |
| 521 | break; |
| 522 | } |
Jens Axboe | 0b9d69e | 2009-09-11 22:29:54 +0200 | [diff] [blame] | 523 | |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 524 | dprint(FD_PARSE, "set cpu allowed %d\n", icpu); |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 525 | fio_cpu_set(mask, icpu); |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 526 | icpu++; |
| 527 | } |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 528 | if (ret) |
| 529 | break; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 530 | } |
| 531 | |
| 532 | free(p); |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 533 | if (!ret) |
| 534 | td->o.cpumask_set = 1; |
| 535 | return ret; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 536 | } |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 537 | |
| 538 | static int str_cpus_allowed_cb(void *data, const char *input) |
| 539 | { |
| 540 | struct thread_data *td = data; |
| 541 | int ret; |
| 542 | |
| 543 | ret = set_cpus_allowed(td, &td->o.cpumask, input); |
| 544 | if (!ret) |
| 545 | td->o.cpumask_set = 1; |
| 546 | |
| 547 | return ret; |
| 548 | } |
| 549 | |
| 550 | static int str_verify_cpus_allowed_cb(void *data, const char *input) |
| 551 | { |
| 552 | struct thread_data *td = data; |
| 553 | int ret; |
| 554 | |
| 555 | ret = set_cpus_allowed(td, &td->o.verify_cpumask, input); |
| 556 | if (!ret) |
| 557 | td->o.verify_cpumask_set = 1; |
| 558 | |
| 559 | return ret; |
| 560 | } |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 561 | #endif |
| 562 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 563 | #ifdef CONFIG_LIBNUMA |
Yufei Ren | d0b937e | 2012-10-19 23:11:52 -0400 | [diff] [blame] | 564 | static int str_numa_cpunodes_cb(void *data, char *input) |
| 565 | { |
| 566 | struct thread_data *td = data; |
| 567 | |
| 568 | /* numa_parse_nodestring() parses a character string list |
| 569 | * of nodes into a bit mask. The bit mask is allocated by |
| 570 | * numa_allocate_nodemask(), so it should be freed by |
| 571 | * numa_free_nodemask(). |
| 572 | */ |
| 573 | td->o.numa_cpunodesmask = numa_parse_nodestring(input); |
| 574 | if (td->o.numa_cpunodesmask == NULL) { |
| 575 | log_err("fio: numa_parse_nodestring failed\n"); |
| 576 | td_verror(td, 1, "str_numa_cpunodes_cb"); |
| 577 | return 1; |
| 578 | } |
| 579 | |
| 580 | td->o.numa_cpumask_set = 1; |
| 581 | return 0; |
| 582 | } |
| 583 | |
| 584 | static int str_numa_mpol_cb(void *data, char *input) |
| 585 | { |
| 586 | struct thread_data *td = data; |
| 587 | const char * const policy_types[] = |
| 588 | { "default", "prefer", "bind", "interleave", "local" }; |
| 589 | int i; |
| 590 | |
| 591 | char *nodelist = strchr(input, ':'); |
| 592 | if (nodelist) { |
| 593 | /* NUL-terminate mode */ |
| 594 | *nodelist++ = '\0'; |
| 595 | } |
| 596 | |
| 597 | for (i = 0; i <= MPOL_LOCAL; i++) { |
| 598 | if (!strcmp(input, policy_types[i])) { |
| 599 | td->o.numa_mem_mode = i; |
| 600 | break; |
| 601 | } |
| 602 | } |
| 603 | if (i > MPOL_LOCAL) { |
| 604 | log_err("fio: memory policy should be: default, prefer, bind, interleave, local\n"); |
| 605 | goto out; |
| 606 | } |
| 607 | |
| 608 | switch (td->o.numa_mem_mode) { |
| 609 | case MPOL_PREFERRED: |
| 610 | /* |
| 611 | * Insist on a nodelist of one node only |
| 612 | */ |
| 613 | if (nodelist) { |
| 614 | char *rest = nodelist; |
| 615 | while (isdigit(*rest)) |
| 616 | rest++; |
| 617 | if (*rest) { |
| 618 | log_err("fio: one node only for \'prefer\'\n"); |
| 619 | goto out; |
| 620 | } |
| 621 | } else { |
| 622 | log_err("fio: one node is needed for \'prefer\'\n"); |
| 623 | goto out; |
| 624 | } |
| 625 | break; |
| 626 | case MPOL_INTERLEAVE: |
| 627 | /* |
| 628 | * Default to online nodes with memory if no nodelist |
| 629 | */ |
| 630 | if (!nodelist) |
| 631 | nodelist = strdup("all"); |
| 632 | break; |
| 633 | case MPOL_LOCAL: |
| 634 | case MPOL_DEFAULT: |
| 635 | /* |
| 636 | * Don't allow a nodelist |
| 637 | */ |
| 638 | if (nodelist) { |
| 639 | log_err("fio: NO nodelist for \'local\'\n"); |
| 640 | goto out; |
| 641 | } |
| 642 | break; |
| 643 | case MPOL_BIND: |
| 644 | /* |
| 645 | * Insist on a nodelist |
| 646 | */ |
| 647 | if (!nodelist) { |
| 648 | log_err("fio: a nodelist is needed for \'bind\'\n"); |
| 649 | goto out; |
| 650 | } |
| 651 | break; |
| 652 | } |
| 653 | |
| 654 | |
| 655 | /* numa_parse_nodestring() parses a character string list |
| 656 | * of nodes into a bit mask. The bit mask is allocated by |
| 657 | * numa_allocate_nodemask(), so it should be freed by |
| 658 | * numa_free_nodemask(). |
| 659 | */ |
| 660 | switch (td->o.numa_mem_mode) { |
| 661 | case MPOL_PREFERRED: |
| 662 | td->o.numa_mem_prefer_node = atoi(nodelist); |
| 663 | break; |
| 664 | case MPOL_INTERLEAVE: |
| 665 | case MPOL_BIND: |
| 666 | td->o.numa_memnodesmask = numa_parse_nodestring(nodelist); |
| 667 | if (td->o.numa_memnodesmask == NULL) { |
| 668 | log_err("fio: numa_parse_nodestring failed\n"); |
| 669 | td_verror(td, 1, "str_numa_memnodes_cb"); |
| 670 | return 1; |
| 671 | } |
| 672 | break; |
| 673 | case MPOL_LOCAL: |
| 674 | case MPOL_DEFAULT: |
| 675 | default: |
| 676 | break; |
| 677 | } |
| 678 | |
| 679 | td->o.numa_memmask_set = 1; |
| 680 | return 0; |
| 681 | |
| 682 | out: |
| 683 | return 1; |
| 684 | } |
| 685 | #endif |
| 686 | |
Jens Axboe | 0d29de8 | 2010-09-01 13:54:15 +0200 | [diff] [blame] | 687 | #ifdef FIO_HAVE_TRIM |
| 688 | static int str_verify_trim_cb(void *data, unsigned long long *val) |
| 689 | { |
| 690 | struct thread_data *td = data; |
| 691 | |
| 692 | td->o.trim_percentage = *val; |
| 693 | return 0; |
| 694 | } |
| 695 | #endif |
| 696 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 697 | static int str_fst_cb(void *data, const char *str) |
| 698 | { |
| 699 | struct thread_data *td = data; |
| 700 | char *nr = get_opt_postfix(str); |
| 701 | |
| 702 | td->file_service_nr = 1; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 703 | if (nr) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 704 | td->file_service_nr = atoi(nr); |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 705 | free(nr); |
| 706 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 707 | |
| 708 | return 0; |
| 709 | } |
| 710 | |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 711 | #ifdef CONFIG_SYNC_FILE_RANGE |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 712 | static int str_sfr_cb(void *data, const char *str) |
| 713 | { |
| 714 | struct thread_data *td = data; |
| 715 | char *nr = get_opt_postfix(str); |
| 716 | |
| 717 | td->sync_file_range_nr = 1; |
| 718 | if (nr) { |
| 719 | td->sync_file_range_nr = atoi(nr); |
| 720 | free(nr); |
| 721 | } |
| 722 | |
| 723 | return 0; |
| 724 | } |
Jens Axboe | 3ae0637 | 2010-03-19 19:17:15 +0100 | [diff] [blame] | 725 | #endif |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 726 | |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 727 | static int str_random_distribution_cb(void *data, const char *str) |
| 728 | { |
| 729 | struct thread_data *td = data; |
| 730 | double val; |
| 731 | char *nr; |
| 732 | |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 733 | if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) |
| 734 | val = 1.1; |
| 735 | else if (td->o.random_distribution == FIO_RAND_DIST_PARETO) |
| 736 | val = 0.2; |
| 737 | else |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 738 | return 0; |
| 739 | |
| 740 | nr = get_opt_postfix(str); |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 741 | if (nr && !str_to_float(nr, &val)) { |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 742 | log_err("fio: random postfix parsing failed\n"); |
| 743 | free(nr); |
| 744 | return 1; |
| 745 | } |
| 746 | |
Jens Axboe | 078189c | 2012-11-07 13:47:22 +0100 | [diff] [blame] | 747 | free(nr); |
| 748 | |
Jens Axboe | 18ded91 | 2012-11-08 08:36:00 +0100 | [diff] [blame] | 749 | if (td->o.random_distribution == FIO_RAND_DIST_ZIPF) { |
| 750 | if (val == 1.00) { |
| 751 | log_err("fio: zipf theta must different than 1.0\n"); |
| 752 | return 1; |
| 753 | } |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 754 | td->o.zipf_theta = val; |
Jens Axboe | 18ded91 | 2012-11-08 08:36:00 +0100 | [diff] [blame] | 755 | } else { |
Jens Axboe | 078189c | 2012-11-07 13:47:22 +0100 | [diff] [blame] | 756 | if (val <= 0.00 || val >= 1.00) { |
| 757 | log_err("fio: pareto input out of range (0 < input < 1.0)\n"); |
| 758 | return 1; |
| 759 | } |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 760 | td->o.pareto_h = val; |
Jens Axboe | 078189c | 2012-11-07 13:47:22 +0100 | [diff] [blame] | 761 | } |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 762 | |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 763 | return 0; |
| 764 | } |
| 765 | |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 766 | static int check_dir(struct thread_data *td, char *fname) |
| 767 | { |
Jens Axboe | 3f0ca9b | 2011-05-24 21:36:24 +0200 | [diff] [blame] | 768 | #if 0 |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 769 | char file[PATH_MAX], *dir; |
Jens Axboe | bc83891 | 2008-04-07 09:00:54 +0200 | [diff] [blame] | 770 | int elen = 0; |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 771 | |
Jens Axboe | bc83891 | 2008-04-07 09:00:54 +0200 | [diff] [blame] | 772 | if (td->o.directory) { |
| 773 | strcpy(file, td->o.directory); |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 774 | strcat(file, "/"); |
Jens Axboe | bc83891 | 2008-04-07 09:00:54 +0200 | [diff] [blame] | 775 | elen = strlen(file); |
| 776 | } |
| 777 | |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 778 | sprintf(file + elen, "%s", fname); |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 779 | dir = dirname(file); |
| 780 | |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 781 | { |
| 782 | struct stat sb; |
| 783 | /* |
| 784 | * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded |
| 785 | * yet, so we can't do this check right here... |
| 786 | */ |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 787 | if (lstat(dir, &sb) < 0) { |
| 788 | int ret = errno; |
| 789 | |
| 790 | log_err("fio: %s is not a directory\n", dir); |
| 791 | td_verror(td, ret, "lstat"); |
| 792 | return 1; |
| 793 | } |
| 794 | |
| 795 | if (!S_ISDIR(sb.st_mode)) { |
| 796 | log_err("fio: %s is not a directory\n", dir); |
| 797 | return 1; |
| 798 | } |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 799 | } |
| 800 | #endif |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 801 | |
| 802 | return 0; |
| 803 | } |
| 804 | |
Jens Axboe | 8e827d3 | 2009-08-04 09:51:48 +0200 | [diff] [blame] | 805 | /* |
| 806 | * Return next file in the string. Files are separated with ':'. If the ':' |
| 807 | * is escaped with a '\', then that ':' is part of the filename and does not |
| 808 | * indicate a new file. |
| 809 | */ |
| 810 | static char *get_next_file_name(char **ptr) |
| 811 | { |
| 812 | char *str = *ptr; |
| 813 | char *p, *start; |
| 814 | |
| 815 | if (!str || !strlen(str)) |
| 816 | return NULL; |
| 817 | |
| 818 | start = str; |
| 819 | do { |
| 820 | /* |
| 821 | * No colon, we are done |
| 822 | */ |
| 823 | p = strchr(str, ':'); |
| 824 | if (!p) { |
| 825 | *ptr = NULL; |
| 826 | break; |
| 827 | } |
| 828 | |
| 829 | /* |
| 830 | * We got a colon, but it's the first character. Skip and |
| 831 | * continue |
| 832 | */ |
| 833 | if (p == start) { |
| 834 | str = ++start; |
| 835 | continue; |
| 836 | } |
| 837 | |
| 838 | if (*(p - 1) != '\\') { |
| 839 | *p = '\0'; |
| 840 | *ptr = p + 1; |
| 841 | break; |
| 842 | } |
| 843 | |
| 844 | memmove(p - 1, p, strlen(p) + 1); |
| 845 | str = p; |
| 846 | } while (1); |
| 847 | |
| 848 | return start; |
| 849 | } |
| 850 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 851 | static int str_filename_cb(void *data, const char *input) |
| 852 | { |
| 853 | struct thread_data *td = data; |
| 854 | char *fname, *str, *p; |
| 855 | |
| 856 | p = str = strdup(input); |
| 857 | |
| 858 | strip_blank_front(&str); |
| 859 | strip_blank_end(str); |
| 860 | |
| 861 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 862 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 863 | |
Jens Axboe | 8e827d3 | 2009-08-04 09:51:48 +0200 | [diff] [blame] | 864 | while ((fname = get_next_file_name(&str)) != NULL) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 865 | if (!strlen(fname)) |
| 866 | break; |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 867 | if (check_dir(td, fname)) { |
| 868 | free(p); |
| 869 | return 1; |
| 870 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 871 | add_file(td, fname); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 872 | td->o.nr_files++; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 873 | } |
| 874 | |
| 875 | free(p); |
| 876 | return 0; |
| 877 | } |
| 878 | |
| 879 | static int str_directory_cb(void *data, const char fio_unused *str) |
| 880 | { |
| 881 | struct thread_data *td = data; |
| 882 | struct stat sb; |
| 883 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 884 | if (lstat(td->o.directory, &sb) < 0) { |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 885 | int ret = errno; |
| 886 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 887 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 888 | td_verror(td, ret, "lstat"); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 889 | return 1; |
| 890 | } |
| 891 | if (!S_ISDIR(sb.st_mode)) { |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 892 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 893 | return 1; |
| 894 | } |
| 895 | |
| 896 | return 0; |
| 897 | } |
| 898 | |
| 899 | static int str_opendir_cb(void *data, const char fio_unused *str) |
| 900 | { |
| 901 | struct thread_data *td = data; |
| 902 | |
| 903 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 904 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 905 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 906 | return add_dir_files(td, td->o.opendir); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 907 | } |
| 908 | |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 909 | static int str_verify_offset_cb(void *data, unsigned long long *off) |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 910 | { |
| 911 | struct thread_data *td = data; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 912 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 913 | if (*off && *off < sizeof(struct verify_header)) { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 914 | log_err("fio: verify_offset too small\n"); |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 915 | return 1; |
| 916 | } |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 917 | |
| 918 | td->o.verify_offset = *off; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 919 | return 0; |
| 920 | } |
| 921 | |
Radha Ramachandran | 0e92f87 | 2009-10-27 20:14:27 +0100 | [diff] [blame] | 922 | static int str_verify_pattern_cb(void *data, const char *input) |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 923 | { |
| 924 | struct thread_data *td = data; |
Radha Ramachandran | 0e92f87 | 2009-10-27 20:14:27 +0100 | [diff] [blame] | 925 | long off; |
| 926 | int i = 0, j = 0, len, k, base = 10; |
| 927 | char* loc1, * loc2; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 928 | |
Radha Ramachandran | 0e92f87 | 2009-10-27 20:14:27 +0100 | [diff] [blame] | 929 | loc1 = strstr(input, "0x"); |
| 930 | loc2 = strstr(input, "0X"); |
| 931 | if (loc1 || loc2) |
| 932 | base = 16; |
| 933 | off = strtol(input, NULL, base); |
| 934 | if (off != LONG_MAX || errno != ERANGE) { |
| 935 | while (off) { |
| 936 | td->o.verify_pattern[i] = off & 0xff; |
| 937 | off >>= 8; |
| 938 | i++; |
| 939 | } |
| 940 | } else { |
| 941 | len = strlen(input); |
| 942 | k = len - 1; |
| 943 | if (base == 16) { |
| 944 | if (loc1) |
| 945 | j = loc1 - input + 2; |
| 946 | else |
| 947 | j = loc2 - input + 2; |
| 948 | } else |
| 949 | return 1; |
| 950 | if (len - j < MAX_PATTERN_SIZE * 2) { |
| 951 | while (k >= j) { |
| 952 | off = converthexchartoint(input[k--]); |
| 953 | if (k >= j) |
| 954 | off += (converthexchartoint(input[k--]) |
| 955 | * 16); |
| 956 | td->o.verify_pattern[i++] = (char) off; |
| 957 | } |
| 958 | } |
| 959 | } |
Steven Lang | efcd9dc | 2012-02-02 20:22:04 +0100 | [diff] [blame] | 960 | |
| 961 | /* |
| 962 | * Fill the pattern all the way to the end. This greatly reduces |
| 963 | * the number of memcpy's we have to do when verifying the IO. |
| 964 | */ |
| 965 | while (i > 1 && i * 2 <= MAX_PATTERN_SIZE) { |
| 966 | memcpy(&td->o.verify_pattern[i], &td->o.verify_pattern[0], i); |
| 967 | i *= 2; |
| 968 | } |
Steven Lang | 9a2a86d | 2012-02-07 09:42:59 +0100 | [diff] [blame] | 969 | if (i == 1) { |
| 970 | /* |
| 971 | * The code in verify_io_u_pattern assumes a single byte pattern |
| 972 | * fills the whole verify pattern buffer. |
| 973 | */ |
| 974 | memset(td->o.verify_pattern, td->o.verify_pattern[0], |
| 975 | MAX_PATTERN_SIZE); |
| 976 | } |
Steven Lang | efcd9dc | 2012-02-02 20:22:04 +0100 | [diff] [blame] | 977 | |
Radha Ramachandran | 0e92f87 | 2009-10-27 20:14:27 +0100 | [diff] [blame] | 978 | td->o.verify_pattern_bytes = i; |
Steven Lang | efcd9dc | 2012-02-02 20:22:04 +0100 | [diff] [blame] | 979 | |
Jens Axboe | 92bf48d | 2011-01-14 21:20:42 +0100 | [diff] [blame] | 980 | /* |
| 981 | * VERIFY_META could already be set |
| 982 | */ |
| 983 | if (td->o.verify == VERIFY_NONE) |
| 984 | td->o.verify = VERIFY_PATTERN; |
Steven Lang | efcd9dc | 2012-02-02 20:22:04 +0100 | [diff] [blame] | 985 | |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 986 | return 0; |
| 987 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 988 | |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 989 | static int str_lockfile_cb(void *data, const char *str) |
| 990 | { |
| 991 | struct thread_data *td = data; |
| 992 | char *nr = get_opt_postfix(str); |
| 993 | |
| 994 | td->o.lockfile_batch = 1; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 995 | if (nr) { |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 996 | td->o.lockfile_batch = atoi(nr); |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 997 | free(nr); |
| 998 | } |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 999 | |
| 1000 | return 0; |
| 1001 | } |
| 1002 | |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1003 | static int str_write_bw_log_cb(void *data, const char *str) |
| 1004 | { |
| 1005 | struct thread_data *td = data; |
| 1006 | |
| 1007 | if (str) |
| 1008 | td->o.bw_log_file = strdup(str); |
| 1009 | |
| 1010 | td->o.write_bw_log = 1; |
| 1011 | return 0; |
| 1012 | } |
| 1013 | |
| 1014 | static int str_write_lat_log_cb(void *data, const char *str) |
| 1015 | { |
| 1016 | struct thread_data *td = data; |
| 1017 | |
| 1018 | if (str) |
| 1019 | td->o.lat_log_file = strdup(str); |
| 1020 | |
| 1021 | td->o.write_lat_log = 1; |
| 1022 | return 0; |
| 1023 | } |
| 1024 | |
Jens Axboe | c8eeb9d | 2011-10-05 14:02:22 +0200 | [diff] [blame] | 1025 | static int str_write_iops_log_cb(void *data, const char *str) |
| 1026 | { |
| 1027 | struct thread_data *td = data; |
| 1028 | |
| 1029 | if (str) |
| 1030 | td->o.iops_log_file = strdup(str); |
| 1031 | |
| 1032 | td->o.write_iops_log = 1; |
| 1033 | return 0; |
| 1034 | } |
| 1035 | |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1036 | static int str_gtod_reduce_cb(void *data, int *il) |
| 1037 | { |
| 1038 | struct thread_data *td = data; |
| 1039 | int val = *il; |
| 1040 | |
Jens Axboe | 02af098 | 2010-06-24 09:59:34 +0200 | [diff] [blame] | 1041 | td->o.disable_lat = !!val; |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1042 | td->o.disable_clat = !!val; |
| 1043 | td->o.disable_slat = !!val; |
| 1044 | td->o.disable_bw = !!val; |
Jens Axboe | 0dc1bc0 | 2011-10-13 08:55:29 +0200 | [diff] [blame] | 1045 | td->o.clat_percentiles = !val; |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1046 | if (val) |
| 1047 | td->tv_cache_mask = 63; |
| 1048 | |
| 1049 | return 0; |
| 1050 | } |
| 1051 | |
Cigy Cyriac | 85bc833 | 2010-08-10 19:21:09 -0400 | [diff] [blame] | 1052 | static int str_gtod_cpu_cb(void *data, long long *il) |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 1053 | { |
| 1054 | struct thread_data *td = data; |
| 1055 | int val = *il; |
| 1056 | |
| 1057 | td->o.gtod_cpu = val; |
| 1058 | td->o.gtod_offload = 1; |
| 1059 | return 0; |
| 1060 | } |
| 1061 | |
Jens Axboe | 7bb5910 | 2011-07-12 19:47:03 +0200 | [diff] [blame] | 1062 | static int str_size_cb(void *data, unsigned long long *__val) |
| 1063 | { |
| 1064 | struct thread_data *td = data; |
| 1065 | unsigned long long v = *__val; |
| 1066 | |
| 1067 | if (parse_is_percent(v)) { |
| 1068 | td->o.size = 0; |
| 1069 | td->o.size_percent = -1ULL - v; |
| 1070 | } else |
| 1071 | td->o.size = v; |
| 1072 | |
| 1073 | return 0; |
| 1074 | } |
| 1075 | |
Jens Axboe | 896cac2 | 2009-07-01 10:38:35 +0200 | [diff] [blame] | 1076 | static int rw_verify(struct fio_option *o, void *data) |
| 1077 | { |
| 1078 | struct thread_data *td = data; |
| 1079 | |
| 1080 | if (read_only && td_write(td)) { |
| 1081 | log_err("fio: job <%s> has write bit set, but fio is in" |
| 1082 | " read-only mode\n", td->o.name); |
| 1083 | return 1; |
| 1084 | } |
| 1085 | |
| 1086 | return 0; |
| 1087 | } |
| 1088 | |
Jens Axboe | 276ca4f | 2009-07-01 10:43:05 +0200 | [diff] [blame] | 1089 | static int gtod_cpu_verify(struct fio_option *o, void *data) |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 1090 | { |
Jens Axboe | 276ca4f | 2009-07-01 10:43:05 +0200 | [diff] [blame] | 1091 | #ifndef FIO_HAVE_CPU_AFFINITY |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 1092 | struct thread_data *td = data; |
| 1093 | |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 1094 | if (td->o.gtod_cpu) { |
| 1095 | log_err("fio: platform must support CPU affinity for" |
| 1096 | "gettimeofday() offloading\n"); |
| 1097 | return 1; |
| 1098 | } |
| 1099 | #endif |
| 1100 | |
| 1101 | return 0; |
| 1102 | } |
| 1103 | |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 1104 | static int kb_base_verify(struct fio_option *o, void *data) |
| 1105 | { |
| 1106 | struct thread_data *td = data; |
| 1107 | |
| 1108 | if (td->o.kb_base != 1024 && td->o.kb_base != 1000) { |
| 1109 | log_err("fio: kb_base set to nonsensical value: %u\n", |
| 1110 | td->o.kb_base); |
| 1111 | return 1; |
| 1112 | } |
| 1113 | |
| 1114 | return 0; |
| 1115 | } |
| 1116 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1117 | /* |
| 1118 | * Map of job/command line options |
| 1119 | */ |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 1120 | static struct fio_option options[FIO_MAX_OPTS] = { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1121 | { |
| 1122 | .name = "description", |
| 1123 | .type = FIO_OPT_STR_STORE, |
| 1124 | .off1 = td_var_offset(description), |
| 1125 | .help = "Text job description", |
| 1126 | }, |
| 1127 | { |
| 1128 | .name = "name", |
| 1129 | .type = FIO_OPT_STR_STORE, |
| 1130 | .off1 = td_var_offset(name), |
| 1131 | .help = "Name of this job", |
| 1132 | }, |
| 1133 | { |
| 1134 | .name = "directory", |
| 1135 | .type = FIO_OPT_STR_STORE, |
| 1136 | .off1 = td_var_offset(directory), |
| 1137 | .cb = str_directory_cb, |
| 1138 | .help = "Directory to store files in", |
| 1139 | }, |
| 1140 | { |
| 1141 | .name = "filename", |
| 1142 | .type = FIO_OPT_STR_STORE, |
| 1143 | .off1 = td_var_offset(filename), |
| 1144 | .cb = str_filename_cb, |
Jens Axboe | f0d524b | 2009-04-27 08:00:48 +0200 | [diff] [blame] | 1145 | .prio = -1, /* must come after "directory" */ |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1146 | .help = "File(s) to use for the workload", |
| 1147 | }, |
| 1148 | { |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 1149 | .name = "kb_base", |
| 1150 | .type = FIO_OPT_INT, |
| 1151 | .off1 = td_var_offset(kb_base), |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 1152 | .verify = kb_base_verify, |
Jens Axboe | a639f0b | 2009-07-18 08:25:35 +0200 | [diff] [blame] | 1153 | .prio = 1, |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 1154 | .def = "1024", |
Jens Axboe | a639f0b | 2009-07-18 08:25:35 +0200 | [diff] [blame] | 1155 | .help = "How many bytes per KB for reporting (1000 or 1024)", |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 1156 | }, |
| 1157 | { |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 1158 | .name = "lockfile", |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 1159 | .type = FIO_OPT_STR, |
| 1160 | .cb = str_lockfile_cb, |
| 1161 | .off1 = td_var_offset(file_lock_mode), |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 1162 | .help = "Lock file when doing IO to it", |
| 1163 | .parent = "filename", |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 1164 | .def = "none", |
| 1165 | .posval = { |
| 1166 | { .ival = "none", |
| 1167 | .oval = FILE_LOCK_NONE, |
| 1168 | .help = "No file locking", |
| 1169 | }, |
| 1170 | { .ival = "exclusive", |
| 1171 | .oval = FILE_LOCK_EXCLUSIVE, |
| 1172 | .help = "Exclusive file lock", |
| 1173 | }, |
| 1174 | { |
| 1175 | .ival = "readwrite", |
| 1176 | .oval = FILE_LOCK_READWRITE, |
| 1177 | .help = "Read vs write lock", |
| 1178 | }, |
| 1179 | }, |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 1180 | }, |
| 1181 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1182 | .name = "opendir", |
| 1183 | .type = FIO_OPT_STR_STORE, |
| 1184 | .off1 = td_var_offset(opendir), |
| 1185 | .cb = str_opendir_cb, |
| 1186 | .help = "Recursively add files from this directory and down", |
| 1187 | }, |
| 1188 | { |
| 1189 | .name = "rw", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1190 | .alias = "readwrite", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1191 | .type = FIO_OPT_STR, |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 1192 | .cb = str_rw_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1193 | .off1 = td_var_offset(td_ddir), |
| 1194 | .help = "IO direction", |
| 1195 | .def = "read", |
Jens Axboe | 896cac2 | 2009-07-01 10:38:35 +0200 | [diff] [blame] | 1196 | .verify = rw_verify, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1197 | .posval = { |
| 1198 | { .ival = "read", |
| 1199 | .oval = TD_DDIR_READ, |
| 1200 | .help = "Sequential read", |
| 1201 | }, |
| 1202 | { .ival = "write", |
| 1203 | .oval = TD_DDIR_WRITE, |
| 1204 | .help = "Sequential write", |
| 1205 | }, |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 1206 | { .ival = "trim", |
| 1207 | .oval = TD_DDIR_TRIM, |
| 1208 | .help = "Sequential trim", |
| 1209 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1210 | { .ival = "randread", |
| 1211 | .oval = TD_DDIR_RANDREAD, |
| 1212 | .help = "Random read", |
| 1213 | }, |
| 1214 | { .ival = "randwrite", |
| 1215 | .oval = TD_DDIR_RANDWRITE, |
| 1216 | .help = "Random write", |
| 1217 | }, |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 1218 | { .ival = "randtrim", |
| 1219 | .oval = TD_DDIR_RANDTRIM, |
| 1220 | .help = "Random trim", |
| 1221 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1222 | { .ival = "rw", |
| 1223 | .oval = TD_DDIR_RW, |
| 1224 | .help = "Sequential read and write mix", |
| 1225 | }, |
Jens Axboe | 10b023d | 2012-03-23 13:40:06 +0100 | [diff] [blame] | 1226 | { .ival = "readwrite", |
| 1227 | .oval = TD_DDIR_RW, |
| 1228 | .help = "Sequential read and write mix", |
| 1229 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1230 | { .ival = "randrw", |
| 1231 | .oval = TD_DDIR_RANDRW, |
| 1232 | .help = "Random read and write mix" |
| 1233 | }, |
| 1234 | }, |
| 1235 | }, |
| 1236 | { |
Jens Axboe | 38dad62 | 2010-07-20 14:46:00 -0600 | [diff] [blame] | 1237 | .name = "rw_sequencer", |
| 1238 | .type = FIO_OPT_STR, |
| 1239 | .off1 = td_var_offset(rw_seq), |
| 1240 | .help = "IO offset generator modifier", |
| 1241 | .def = "sequential", |
| 1242 | .posval = { |
| 1243 | { .ival = "sequential", |
| 1244 | .oval = RW_SEQ_SEQ, |
| 1245 | .help = "Generate sequential offsets", |
| 1246 | }, |
| 1247 | { .ival = "identical", |
| 1248 | .oval = RW_SEQ_IDENT, |
| 1249 | .help = "Generate identical offsets", |
| 1250 | }, |
| 1251 | }, |
| 1252 | }, |
| 1253 | |
| 1254 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1255 | .name = "ioengine", |
| 1256 | .type = FIO_OPT_STR_STORE, |
| 1257 | .off1 = td_var_offset(ioengine), |
| 1258 | .help = "IO engine to use", |
Jens Axboe | 58483fa | 2011-01-19 11:09:58 -0700 | [diff] [blame] | 1259 | .def = FIO_PREFERRED_ENGINE, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1260 | .posval = { |
| 1261 | { .ival = "sync", |
| 1262 | .help = "Use read/write", |
| 1263 | }, |
gurudas pai | a31041e | 2007-10-23 15:12:30 +0200 | [diff] [blame] | 1264 | { .ival = "psync", |
| 1265 | .help = "Use pread/pwrite", |
| 1266 | }, |
Jens Axboe | 1d2af02 | 2008-02-04 10:59:07 +0100 | [diff] [blame] | 1267 | { .ival = "vsync", |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 1268 | .help = "Use readv/writev", |
Jens Axboe | 1d2af02 | 2008-02-04 10:59:07 +0100 | [diff] [blame] | 1269 | }, |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1270 | #ifdef CONFIG_LIBAIO |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1271 | { .ival = "libaio", |
| 1272 | .help = "Linux native asynchronous IO", |
| 1273 | }, |
| 1274 | #endif |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1275 | #ifdef CONFIG_POSIXAIO |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1276 | { .ival = "posixaio", |
| 1277 | .help = "POSIX asynchronous IO", |
| 1278 | }, |
| 1279 | #endif |
Jens Axboe | 997843c | 2013-01-24 15:27:40 -0700 | [diff] [blame] | 1280 | #ifdef CONFIG_SOLARISAIO |
Jens Axboe | 417f006 | 2008-06-02 11:59:30 +0200 | [diff] [blame] | 1281 | { .ival = "solarisaio", |
| 1282 | .help = "Solaris native asynchronous IO", |
| 1283 | }, |
| 1284 | #endif |
Jens Axboe | 4700b23 | 2013-01-24 15:33:33 -0700 | [diff] [blame] | 1285 | #ifdef CONFIG_WINDOWSAIO |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 1286 | { .ival = "windowsaio", |
Jens Axboe | 3be8007 | 2011-01-19 11:07:28 -0700 | [diff] [blame] | 1287 | .help = "Windows native asynchronous IO" |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 1288 | }, |
Jens Axboe | 3be8007 | 2011-01-19 11:07:28 -0700 | [diff] [blame] | 1289 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1290 | { .ival = "mmap", |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 1291 | .help = "Memory mapped IO" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1292 | }, |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1293 | #ifdef CONFIG_LINUX_SPLICE |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1294 | { .ival = "splice", |
| 1295 | .help = "splice/vmsplice based IO", |
| 1296 | }, |
Jens Axboe | 9cce02e | 2007-06-22 15:42:21 +0200 | [diff] [blame] | 1297 | { .ival = "netsplice", |
| 1298 | .help = "splice/vmsplice to/from the network", |
| 1299 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1300 | #endif |
| 1301 | #ifdef FIO_HAVE_SGIO |
| 1302 | { .ival = "sg", |
| 1303 | .help = "SCSI generic v3 IO", |
| 1304 | }, |
| 1305 | #endif |
| 1306 | { .ival = "null", |
| 1307 | .help = "Testing engine (no data transfer)", |
| 1308 | }, |
| 1309 | { .ival = "net", |
| 1310 | .help = "Network IO", |
| 1311 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1312 | { .ival = "cpuio", |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 1313 | .help = "CPU cycle burner engine", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1314 | }, |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1315 | #ifdef CONFIG_GUASI |
Jens Axboe | b8c82a4 | 2007-03-21 08:48:26 +0100 | [diff] [blame] | 1316 | { .ival = "guasi", |
| 1317 | .help = "GUASI IO engine", |
| 1318 | }, |
| 1319 | #endif |
Jens Axboe | 79a4318 | 2010-09-07 13:28:58 +0200 | [diff] [blame] | 1320 | #ifdef FIO_HAVE_BINJECT |
| 1321 | { .ival = "binject", |
| 1322 | .help = "binject direct inject block engine", |
| 1323 | }, |
| 1324 | #endif |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1325 | #ifdef CONFIG_RDMA |
ren yufei | 21b8aee | 2011-08-01 10:01:57 +0200 | [diff] [blame] | 1326 | { .ival = "rdma", |
| 1327 | .help = "RDMA IO engine", |
| 1328 | }, |
| 1329 | #endif |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1330 | #ifdef CONFIG_FUSION_AW |
Jens Axboe | 8200b8c | 2012-09-18 23:55:43 +0200 | [diff] [blame] | 1331 | { .ival = "fusion-aw-sync", |
| 1332 | .help = "Fusion-io atomic write engine", |
| 1333 | }, |
| 1334 | #endif |
Jens Axboe | 997843c | 2013-01-24 15:27:40 -0700 | [diff] [blame] | 1335 | #ifdef CONFIG_LINUX_EXT4_MOVE_EXTENT |
Jens Axboe | 1ecc95c | 2012-09-20 13:46:34 +0200 | [diff] [blame] | 1336 | { .ival = "e4defrag", |
| 1337 | .help = "ext4 defrag engine", |
| 1338 | }, |
| 1339 | #endif |
Jens Axboe | 997843c | 2013-01-24 15:27:40 -0700 | [diff] [blame] | 1340 | #ifdef CONFIG_LINUX_FALLOCATE |
Jens Axboe | 1ecc95c | 2012-09-20 13:46:34 +0200 | [diff] [blame] | 1341 | { .ival = "falloc", |
| 1342 | .help = "fallocate() file based engine", |
| 1343 | }, |
| 1344 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1345 | { .ival = "external", |
| 1346 | .help = "Load external engine (append name)", |
| 1347 | }, |
| 1348 | }, |
| 1349 | }, |
| 1350 | { |
| 1351 | .name = "iodepth", |
| 1352 | .type = FIO_OPT_INT, |
| 1353 | .off1 = td_var_offset(iodepth), |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 1354 | .help = "Number of IO buffers to keep in flight", |
Jens Axboe | 757aff4 | 2007-12-12 19:42:13 +0100 | [diff] [blame] | 1355 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1356 | .def = "1", |
| 1357 | }, |
| 1358 | { |
| 1359 | .name = "iodepth_batch", |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 1360 | .alias = "iodepth_batch_submit", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1361 | .type = FIO_OPT_INT, |
| 1362 | .off1 = td_var_offset(iodepth_batch), |
Jens Axboe | d65db44 | 2009-01-16 19:15:33 +0100 | [diff] [blame] | 1363 | .help = "Number of IO buffers to submit in one go", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1364 | .parent = "iodepth", |
Jens Axboe | a2e6f8a | 2008-01-18 10:28:11 +0100 | [diff] [blame] | 1365 | .minval = 1, |
| 1366 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1367 | }, |
| 1368 | { |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 1369 | .name = "iodepth_batch_complete", |
| 1370 | .type = FIO_OPT_INT, |
| 1371 | .off1 = td_var_offset(iodepth_batch_complete), |
Jens Axboe | d65db44 | 2009-01-16 19:15:33 +0100 | [diff] [blame] | 1372 | .help = "Number of IO buffers to retrieve in one go", |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 1373 | .parent = "iodepth", |
| 1374 | .minval = 0, |
| 1375 | .def = "1", |
| 1376 | }, |
| 1377 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1378 | .name = "iodepth_low", |
| 1379 | .type = FIO_OPT_INT, |
| 1380 | .off1 = td_var_offset(iodepth_low), |
| 1381 | .help = "Low water mark for queuing depth", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1382 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1383 | }, |
| 1384 | { |
| 1385 | .name = "size", |
| 1386 | .type = FIO_OPT_STR_VAL, |
Jens Axboe | 7bb5910 | 2011-07-12 19:47:03 +0200 | [diff] [blame] | 1387 | .cb = str_size_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1388 | .help = "Total size of device or files", |
| 1389 | }, |
| 1390 | { |
Shawn Lewis | aa31f1f | 2008-01-11 09:45:11 +0100 | [diff] [blame] | 1391 | .name = "fill_device", |
Jens Axboe | 74586c1 | 2011-01-20 10:16:03 -0700 | [diff] [blame] | 1392 | .alias = "fill_fs", |
Shawn Lewis | aa31f1f | 2008-01-11 09:45:11 +0100 | [diff] [blame] | 1393 | .type = FIO_OPT_BOOL, |
| 1394 | .off1 = td_var_offset(fill_device), |
| 1395 | .help = "Write until an ENOSPC error occurs", |
| 1396 | .def = "0", |
| 1397 | }, |
| 1398 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1399 | .name = "filesize", |
| 1400 | .type = FIO_OPT_STR_VAL, |
| 1401 | .off1 = td_var_offset(file_size_low), |
| 1402 | .off2 = td_var_offset(file_size_high), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 1403 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1404 | .help = "Size of individual files", |
| 1405 | }, |
| 1406 | { |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1407 | .name = "offset", |
| 1408 | .alias = "fileoffset", |
| 1409 | .type = FIO_OPT_STR_VAL, |
| 1410 | .off1 = td_var_offset(start_offset), |
| 1411 | .help = "Start IO from this offset", |
| 1412 | .def = "0", |
| 1413 | }, |
| 1414 | { |
Jens Axboe | 2d7cd86 | 2012-03-15 14:53:38 +0100 | [diff] [blame] | 1415 | .name = "offset_increment", |
| 1416 | .type = FIO_OPT_STR_VAL, |
| 1417 | .off1 = td_var_offset(offset_increment), |
| 1418 | .help = "What is the increment from one offset to the next", |
| 1419 | .parent = "offset", |
| 1420 | .def = "0", |
| 1421 | }, |
| 1422 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1423 | .name = "bs", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1424 | .alias = "blocksize", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1425 | .type = FIO_OPT_INT, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1426 | .off1 = td_var_offset(bs[DDIR_READ]), |
| 1427 | .off2 = td_var_offset(bs[DDIR_WRITE]), |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 1428 | .off3 = td_var_offset(bs[DDIR_TRIM]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 1429 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1430 | .help = "Block size unit", |
| 1431 | .def = "4k", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1432 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1433 | }, |
| 1434 | { |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 1435 | .name = "ba", |
| 1436 | .alias = "blockalign", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1437 | .type = FIO_OPT_INT, |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 1438 | .off1 = td_var_offset(ba[DDIR_READ]), |
| 1439 | .off2 = td_var_offset(ba[DDIR_WRITE]), |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 1440 | .off3 = td_var_offset(ba[DDIR_TRIM]), |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 1441 | .minval = 1, |
| 1442 | .help = "IO block offset alignment", |
| 1443 | .parent = "rw", |
| 1444 | }, |
| 1445 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1446 | .name = "bsrange", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1447 | .alias = "blocksize_range", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1448 | .type = FIO_OPT_RANGE, |
| 1449 | .off1 = td_var_offset(min_bs[DDIR_READ]), |
| 1450 | .off2 = td_var_offset(max_bs[DDIR_READ]), |
| 1451 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), |
| 1452 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 1453 | .off5 = td_var_offset(min_bs[DDIR_TRIM]), |
| 1454 | .off6 = td_var_offset(max_bs[DDIR_TRIM]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 1455 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1456 | .help = "Set block size range (in more detail than bs)", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1457 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1458 | }, |
| 1459 | { |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 1460 | .name = "bssplit", |
| 1461 | .type = FIO_OPT_STR, |
| 1462 | .cb = str_bssplit_cb, |
| 1463 | .help = "Set a specific mix of block sizes", |
| 1464 | .parent = "rw", |
| 1465 | }, |
| 1466 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1467 | .name = "bs_unaligned", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1468 | .alias = "blocksize_unaligned", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1469 | .type = FIO_OPT_STR_SET, |
| 1470 | .off1 = td_var_offset(bs_unaligned), |
| 1471 | .help = "Don't sector align IO buffer sizes", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1472 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1473 | }, |
| 1474 | { |
| 1475 | .name = "randrepeat", |
| 1476 | .type = FIO_OPT_BOOL, |
| 1477 | .off1 = td_var_offset(rand_repeatable), |
| 1478 | .help = "Use repeatable random IO pattern", |
| 1479 | .def = "1", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1480 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1481 | }, |
| 1482 | { |
Jens Axboe | 2615cc4 | 2011-03-28 09:35:09 +0200 | [diff] [blame] | 1483 | .name = "use_os_rand", |
| 1484 | .type = FIO_OPT_BOOL, |
| 1485 | .off1 = td_var_offset(use_os_rand), |
| 1486 | .help = "Set to use OS random generator", |
| 1487 | .def = "0", |
| 1488 | .parent = "rw", |
| 1489 | }, |
| 1490 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1491 | .name = "norandommap", |
| 1492 | .type = FIO_OPT_STR_SET, |
| 1493 | .off1 = td_var_offset(norandommap), |
| 1494 | .help = "Accept potential duplicate random blocks", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1495 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1496 | }, |
| 1497 | { |
Jens Axboe | 2b386d2 | 2008-03-26 10:32:57 +0100 | [diff] [blame] | 1498 | .name = "softrandommap", |
| 1499 | .type = FIO_OPT_BOOL, |
| 1500 | .off1 = td_var_offset(softrandommap), |
Jens Axboe | f66ab3c | 2008-06-05 11:48:22 +0200 | [diff] [blame] | 1501 | .help = "Set norandommap if randommap allocation fails", |
Jens Axboe | 2b386d2 | 2008-03-26 10:32:57 +0100 | [diff] [blame] | 1502 | .parent = "norandommap", |
| 1503 | .def = "0", |
| 1504 | }, |
| 1505 | { |
Jens Axboe | 8055e41 | 2012-11-26 08:43:47 +0100 | [diff] [blame] | 1506 | .name = "random_generator", |
| 1507 | .type = FIO_OPT_STR, |
| 1508 | .off1 = td_var_offset(random_generator), |
| 1509 | .help = "Type of random number generator to use", |
| 1510 | .def = "tausworthe", |
| 1511 | .posval = { |
| 1512 | { .ival = "tausworthe", |
| 1513 | .oval = FIO_RAND_GEN_TAUSWORTHE, |
| 1514 | .help = "Strong Tausworthe generator", |
| 1515 | }, |
| 1516 | { .ival = "lfsr", |
| 1517 | .oval = FIO_RAND_GEN_LFSR, |
| 1518 | .help = "Variable length LFSR", |
| 1519 | }, |
| 1520 | }, |
| 1521 | }, |
| 1522 | { |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 1523 | .name = "random_distribution", |
| 1524 | .type = FIO_OPT_STR, |
| 1525 | .off1 = td_var_offset(random_distribution), |
| 1526 | .cb = str_random_distribution_cb, |
| 1527 | .help = "Random offset distribution generator", |
| 1528 | .def = "random", |
| 1529 | .posval = { |
| 1530 | { .ival = "random", |
| 1531 | .oval = FIO_RAND_DIST_RANDOM, |
| 1532 | .help = "Completely random", |
| 1533 | }, |
| 1534 | { .ival = "zipf", |
| 1535 | .oval = FIO_RAND_DIST_ZIPF, |
| 1536 | .help = "Zipf distribution", |
| 1537 | }, |
Jens Axboe | 925fee3 | 2012-11-06 13:50:32 +0100 | [diff] [blame] | 1538 | { .ival = "pareto", |
| 1539 | .oval = FIO_RAND_DIST_PARETO, |
| 1540 | .help = "Pareto distribution", |
| 1541 | }, |
Jens Axboe | e25839d | 2012-11-06 10:49:42 +0100 | [diff] [blame] | 1542 | }, |
| 1543 | }, |
| 1544 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1545 | .name = "nrfiles", |
Jens Axboe | d7c8be0 | 2010-11-25 08:21:39 +0100 | [diff] [blame] | 1546 | .alias = "nr_files", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1547 | .type = FIO_OPT_INT, |
| 1548 | .off1 = td_var_offset(nr_files), |
| 1549 | .help = "Split job workload between this number of files", |
| 1550 | .def = "1", |
| 1551 | }, |
| 1552 | { |
| 1553 | .name = "openfiles", |
| 1554 | .type = FIO_OPT_INT, |
| 1555 | .off1 = td_var_offset(open_files), |
| 1556 | .help = "Number of files to keep open at the same time", |
| 1557 | }, |
| 1558 | { |
| 1559 | .name = "file_service_type", |
| 1560 | .type = FIO_OPT_STR, |
| 1561 | .cb = str_fst_cb, |
| 1562 | .off1 = td_var_offset(file_service_type), |
| 1563 | .help = "How to select which file to service next", |
| 1564 | .def = "roundrobin", |
| 1565 | .posval = { |
| 1566 | { .ival = "random", |
| 1567 | .oval = FIO_FSERVICE_RANDOM, |
| 1568 | .help = "Choose a file at random", |
| 1569 | }, |
| 1570 | { .ival = "roundrobin", |
| 1571 | .oval = FIO_FSERVICE_RR, |
| 1572 | .help = "Round robin select files", |
| 1573 | }, |
Jens Axboe | a086c25 | 2009-03-04 08:27:37 +0100 | [diff] [blame] | 1574 | { .ival = "sequential", |
| 1575 | .oval = FIO_FSERVICE_SEQ, |
| 1576 | .help = "Finish one file before moving to the next", |
| 1577 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1578 | }, |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1579 | .parent = "nrfiles", |
| 1580 | }, |
Jens Axboe | 97ac992 | 2013-01-24 15:00:25 -0700 | [diff] [blame] | 1581 | #ifdef CONFIG_POSIX_FALLOCATE |
Jens Axboe | 7bc8c2c | 2010-01-28 11:31:31 +0100 | [diff] [blame] | 1582 | { |
| 1583 | .name = "fallocate", |
Eric Gouriou | a596f04 | 2011-06-17 09:11:45 +0200 | [diff] [blame] | 1584 | .type = FIO_OPT_STR, |
| 1585 | .off1 = td_var_offset(fallocate_mode), |
| 1586 | .help = "Whether pre-allocation is performed when laying out files", |
| 1587 | .def = "posix", |
| 1588 | .posval = { |
| 1589 | { .ival = "none", |
| 1590 | .oval = FIO_FALLOCATE_NONE, |
| 1591 | .help = "Do not pre-allocate space", |
| 1592 | }, |
| 1593 | { .ival = "posix", |
| 1594 | .oval = FIO_FALLOCATE_POSIX, |
| 1595 | .help = "Use posix_fallocate()", |
| 1596 | }, |
Jens Axboe | 97ac992 | 2013-01-24 15:00:25 -0700 | [diff] [blame] | 1597 | #ifdef CONFIG_LINUX_FALLOCATE |
Eric Gouriou | a596f04 | 2011-06-17 09:11:45 +0200 | [diff] [blame] | 1598 | { .ival = "keep", |
| 1599 | .oval = FIO_FALLOCATE_KEEP_SIZE, |
| 1600 | .help = "Use fallocate(..., FALLOC_FL_KEEP_SIZE, ...)", |
| 1601 | }, |
Jens Axboe | 7bc8c2c | 2010-01-28 11:31:31 +0100 | [diff] [blame] | 1602 | #endif |
Eric Gouriou | a596f04 | 2011-06-17 09:11:45 +0200 | [diff] [blame] | 1603 | /* Compatibility with former boolean values */ |
| 1604 | { .ival = "0", |
| 1605 | .oval = FIO_FALLOCATE_NONE, |
| 1606 | .help = "Alias for 'none'", |
| 1607 | }, |
| 1608 | { .ival = "1", |
| 1609 | .oval = FIO_FALLOCATE_POSIX, |
| 1610 | .help = "Alias for 'posix'", |
| 1611 | }, |
| 1612 | }, |
| 1613 | }, |
Jens Axboe | 97ac992 | 2013-01-24 15:00:25 -0700 | [diff] [blame] | 1614 | #endif /* CONFIG_POSIX_FALLOCATE */ |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1615 | { |
| 1616 | .name = "fadvise_hint", |
| 1617 | .type = FIO_OPT_BOOL, |
| 1618 | .off1 = td_var_offset(fadvise_hint), |
| 1619 | .help = "Use fadvise() to advise the kernel on IO pattern", |
| 1620 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1621 | }, |
| 1622 | { |
| 1623 | .name = "fsync", |
| 1624 | .type = FIO_OPT_INT, |
| 1625 | .off1 = td_var_offset(fsync_blocks), |
| 1626 | .help = "Issue fsync for writes every given number of blocks", |
| 1627 | .def = "0", |
| 1628 | }, |
| 1629 | { |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 1630 | .name = "fdatasync", |
| 1631 | .type = FIO_OPT_INT, |
| 1632 | .off1 = td_var_offset(fdatasync_blocks), |
| 1633 | .help = "Issue fdatasync for writes every given number of blocks", |
| 1634 | .def = "0", |
| 1635 | }, |
Jens Axboe | 1ef2b6b | 2010-10-08 15:07:01 +0200 | [diff] [blame] | 1636 | { |
| 1637 | .name = "write_barrier", |
| 1638 | .type = FIO_OPT_INT, |
| 1639 | .off1 = td_var_offset(barrier_blocks), |
| 1640 | .help = "Make every Nth write a barrier write", |
| 1641 | .def = "0", |
| 1642 | }, |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1643 | #ifdef CONFIG_SYNC_FILE_RANGE |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 1644 | { |
| 1645 | .name = "sync_file_range", |
| 1646 | .posval = { |
| 1647 | { .ival = "wait_before", |
| 1648 | .oval = SYNC_FILE_RANGE_WAIT_BEFORE, |
| 1649 | .help = "SYNC_FILE_RANGE_WAIT_BEFORE", |
Jens Axboe | 3843deb | 2010-03-09 20:41:15 +0100 | [diff] [blame] | 1650 | .or = 1, |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 1651 | }, |
| 1652 | { .ival = "write", |
| 1653 | .oval = SYNC_FILE_RANGE_WRITE, |
| 1654 | .help = "SYNC_FILE_RANGE_WRITE", |
Jens Axboe | 3843deb | 2010-03-09 20:41:15 +0100 | [diff] [blame] | 1655 | .or = 1, |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 1656 | }, |
| 1657 | { |
| 1658 | .ival = "wait_after", |
| 1659 | .oval = SYNC_FILE_RANGE_WAIT_AFTER, |
| 1660 | .help = "SYNC_FILE_RANGE_WAIT_AFTER", |
Jens Axboe | 3843deb | 2010-03-09 20:41:15 +0100 | [diff] [blame] | 1661 | .or = 1, |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 1662 | }, |
| 1663 | }, |
Jens Axboe | 3843deb | 2010-03-09 20:41:15 +0100 | [diff] [blame] | 1664 | .type = FIO_OPT_STR_MULTI, |
Jens Axboe | 44f2969 | 2010-03-09 20:09:44 +0100 | [diff] [blame] | 1665 | .cb = str_sfr_cb, |
| 1666 | .off1 = td_var_offset(sync_file_range), |
| 1667 | .help = "Use sync_file_range()", |
| 1668 | }, |
| 1669 | #endif |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 1670 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1671 | .name = "direct", |
| 1672 | .type = FIO_OPT_BOOL, |
| 1673 | .off1 = td_var_offset(odirect), |
| 1674 | .help = "Use O_DIRECT IO (negates buffered)", |
| 1675 | .def = "0", |
| 1676 | }, |
| 1677 | { |
| 1678 | .name = "buffered", |
| 1679 | .type = FIO_OPT_BOOL, |
| 1680 | .off1 = td_var_offset(odirect), |
| 1681 | .neg = 1, |
| 1682 | .help = "Use buffered IO (negates direct)", |
| 1683 | .def = "1", |
| 1684 | }, |
| 1685 | { |
| 1686 | .name = "overwrite", |
| 1687 | .type = FIO_OPT_BOOL, |
| 1688 | .off1 = td_var_offset(overwrite), |
| 1689 | .help = "When writing, set whether to overwrite current data", |
| 1690 | .def = "0", |
| 1691 | }, |
| 1692 | { |
| 1693 | .name = "loops", |
| 1694 | .type = FIO_OPT_INT, |
| 1695 | .off1 = td_var_offset(loops), |
| 1696 | .help = "Number of times to run the job", |
| 1697 | .def = "1", |
| 1698 | }, |
| 1699 | { |
| 1700 | .name = "numjobs", |
| 1701 | .type = FIO_OPT_INT, |
| 1702 | .off1 = td_var_offset(numjobs), |
| 1703 | .help = "Duplicate this job this many times", |
| 1704 | .def = "1", |
| 1705 | }, |
| 1706 | { |
| 1707 | .name = "startdelay", |
Jens Axboe | a5737c9 | 2010-06-29 10:40:30 +0200 | [diff] [blame] | 1708 | .type = FIO_OPT_STR_VAL_TIME, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1709 | .off1 = td_var_offset(start_delay), |
| 1710 | .help = "Only start job when this period has passed", |
| 1711 | .def = "0", |
| 1712 | }, |
| 1713 | { |
| 1714 | .name = "runtime", |
| 1715 | .alias = "timeout", |
| 1716 | .type = FIO_OPT_STR_VAL_TIME, |
| 1717 | .off1 = td_var_offset(timeout), |
| 1718 | .help = "Stop workload when this amount of time has passed", |
| 1719 | .def = "0", |
| 1720 | }, |
| 1721 | { |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 1722 | .name = "time_based", |
| 1723 | .type = FIO_OPT_STR_SET, |
| 1724 | .off1 = td_var_offset(time_based), |
| 1725 | .help = "Keep running until runtime/timeout is met", |
| 1726 | }, |
| 1727 | { |
Jens Axboe | 721938a | 2008-09-10 09:46:16 +0200 | [diff] [blame] | 1728 | .name = "ramp_time", |
| 1729 | .type = FIO_OPT_STR_VAL_TIME, |
| 1730 | .off1 = td_var_offset(ramp_time), |
| 1731 | .help = "Ramp up time before measuring performance", |
| 1732 | }, |
| 1733 | { |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 1734 | .name = "clocksource", |
| 1735 | .type = FIO_OPT_STR, |
| 1736 | .cb = fio_clock_source_cb, |
| 1737 | .off1 = td_var_offset(clocksource), |
| 1738 | .help = "What type of timing source to use", |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 1739 | .posval = { |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1740 | #ifdef CONFIG_GETTIMEOFDAY |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 1741 | { .ival = "gettimeofday", |
| 1742 | .oval = CS_GTOD, |
| 1743 | .help = "Use gettimeofday(2) for timing", |
| 1744 | }, |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1745 | #endif |
| 1746 | #ifdef CONFIG_CLOCK_GETTIME |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 1747 | { .ival = "clock_gettime", |
| 1748 | .oval = CS_CGETTIME, |
| 1749 | .help = "Use clock_gettime(2) for timing", |
| 1750 | }, |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 1751 | #endif |
Jens Axboe | c223da8 | 2010-03-24 13:23:53 +0100 | [diff] [blame] | 1752 | #ifdef ARCH_HAVE_CPU_CLOCK |
| 1753 | { .ival = "cpu", |
| 1754 | .oval = CS_CPUCLOCK, |
| 1755 | .help = "Use CPU private clock", |
| 1756 | }, |
| 1757 | #endif |
| 1758 | }, |
| 1759 | }, |
| 1760 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1761 | .name = "mem", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1762 | .alias = "iomem", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1763 | .type = FIO_OPT_STR, |
| 1764 | .cb = str_mem_cb, |
| 1765 | .off1 = td_var_offset(mem_type), |
| 1766 | .help = "Backing type for IO buffers", |
| 1767 | .def = "malloc", |
| 1768 | .posval = { |
| 1769 | { .ival = "malloc", |
| 1770 | .oval = MEM_MALLOC, |
| 1771 | .help = "Use malloc(3) for IO buffers", |
| 1772 | }, |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 1773 | { .ival = "shm", |
| 1774 | .oval = MEM_SHM, |
| 1775 | .help = "Use shared memory segments for IO buffers", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1776 | }, |
| 1777 | #ifdef FIO_HAVE_HUGETLB |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 1778 | { .ival = "shmhuge", |
| 1779 | .oval = MEM_SHMHUGE, |
| 1780 | .help = "Like shm, but use huge pages", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1781 | }, |
| 1782 | #endif |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 1783 | { .ival = "mmap", |
| 1784 | .oval = MEM_MMAP, |
| 1785 | .help = "Use mmap(2) (file or anon) for IO buffers", |
| 1786 | }, |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 1787 | #ifdef FIO_HAVE_HUGETLB |
| 1788 | { .ival = "mmaphuge", |
| 1789 | .oval = MEM_MMAPHUGE, |
| 1790 | .help = "Like mmap, but use huge pages", |
| 1791 | }, |
| 1792 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1793 | }, |
| 1794 | }, |
| 1795 | { |
Jens Axboe | d529ee1 | 2009-07-01 10:33:03 +0200 | [diff] [blame] | 1796 | .name = "iomem_align", |
| 1797 | .alias = "mem_align", |
| 1798 | .type = FIO_OPT_INT, |
| 1799 | .off1 = td_var_offset(mem_align), |
| 1800 | .minval = 0, |
| 1801 | .help = "IO memory buffer offset alignment", |
| 1802 | .def = "0", |
| 1803 | .parent = "iomem", |
| 1804 | }, |
| 1805 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1806 | .name = "verify", |
| 1807 | .type = FIO_OPT_STR, |
| 1808 | .off1 = td_var_offset(verify), |
| 1809 | .help = "Verify data written", |
Jens Axboe | 5d7c5d3 | 2010-06-21 15:08:17 +0200 | [diff] [blame] | 1810 | .cb = str_verify_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1811 | .def = "0", |
| 1812 | .posval = { |
| 1813 | { .ival = "0", |
| 1814 | .oval = VERIFY_NONE, |
| 1815 | .help = "Don't do IO verification", |
| 1816 | }, |
Jens Axboe | fcca4b5 | 2007-07-27 15:42:00 +0200 | [diff] [blame] | 1817 | { .ival = "md5", |
| 1818 | .oval = VERIFY_MD5, |
| 1819 | .help = "Use md5 checksums for verification", |
| 1820 | }, |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 1821 | { .ival = "crc64", |
| 1822 | .oval = VERIFY_CRC64, |
| 1823 | .help = "Use crc64 checksums for verification", |
| 1824 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1825 | { .ival = "crc32", |
| 1826 | .oval = VERIFY_CRC32, |
| 1827 | .help = "Use crc32 checksums for verification", |
| 1828 | }, |
Jens Axboe | af497e6 | 2008-08-04 15:40:35 +0200 | [diff] [blame] | 1829 | { .ival = "crc32c-intel", |
Jens Axboe | e3aaafc | 2012-02-22 20:28:17 +0100 | [diff] [blame] | 1830 | .oval = VERIFY_CRC32C, |
| 1831 | .help = "Use crc32c checksums for verification (hw assisted, if available)", |
Jens Axboe | af497e6 | 2008-08-04 15:40:35 +0200 | [diff] [blame] | 1832 | }, |
Jens Axboe | bac39e0 | 2008-06-11 20:46:19 +0200 | [diff] [blame] | 1833 | { .ival = "crc32c", |
| 1834 | .oval = VERIFY_CRC32C, |
Jens Axboe | e3aaafc | 2012-02-22 20:28:17 +0100 | [diff] [blame] | 1835 | .help = "Use crc32c checksums for verification (hw assisted, if available)", |
Jens Axboe | bac39e0 | 2008-06-11 20:46:19 +0200 | [diff] [blame] | 1836 | }, |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 1837 | { .ival = "crc16", |
| 1838 | .oval = VERIFY_CRC16, |
| 1839 | .help = "Use crc16 checksums for verification", |
| 1840 | }, |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 1841 | { .ival = "crc7", |
| 1842 | .oval = VERIFY_CRC7, |
| 1843 | .help = "Use crc7 checksums for verification", |
| 1844 | }, |
Jens Axboe | 7c353ce | 2009-08-09 22:40:33 +0200 | [diff] [blame] | 1845 | { .ival = "sha1", |
| 1846 | .oval = VERIFY_SHA1, |
| 1847 | .help = "Use sha1 checksums for verification", |
| 1848 | }, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 1849 | { .ival = "sha256", |
| 1850 | .oval = VERIFY_SHA256, |
| 1851 | .help = "Use sha256 checksums for verification", |
| 1852 | }, |
| 1853 | { .ival = "sha512", |
| 1854 | .oval = VERIFY_SHA512, |
| 1855 | .help = "Use sha512 checksums for verification", |
| 1856 | }, |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 1857 | { .ival = "meta", |
| 1858 | .oval = VERIFY_META, |
| 1859 | .help = "Use io information", |
| 1860 | }, |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 1861 | { |
| 1862 | .ival = "null", |
| 1863 | .oval = VERIFY_NULL, |
| 1864 | .help = "Pretend to verify", |
| 1865 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1866 | }, |
| 1867 | }, |
| 1868 | { |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 1869 | .name = "do_verify", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 1870 | .type = FIO_OPT_BOOL, |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 1871 | .off1 = td_var_offset(do_verify), |
| 1872 | .help = "Run verification stage after write", |
| 1873 | .def = "1", |
| 1874 | .parent = "verify", |
| 1875 | }, |
| 1876 | { |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 1877 | .name = "verifysort", |
| 1878 | .type = FIO_OPT_BOOL, |
| 1879 | .off1 = td_var_offset(verifysort), |
| 1880 | .help = "Sort written verify blocks for read back", |
| 1881 | .def = "1", |
Jens Axboe | c83f2df | 2007-07-31 22:51:47 +0200 | [diff] [blame] | 1882 | .parent = "verify", |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 1883 | }, |
| 1884 | { |
Jens Axboe | 1ae83d4 | 2013-01-12 01:44:15 -0700 | [diff] [blame] | 1885 | .name = "verifysort_nr", |
| 1886 | .type = FIO_OPT_INT, |
| 1887 | .off1 = td_var_offset(verifysort_nr), |
| 1888 | .help = "Pre-load and sort verify blocks for a read workload", |
| 1889 | .minval = 0, |
| 1890 | .maxval = 131072, |
| 1891 | .def = "1024", |
| 1892 | .parent = "verify", |
| 1893 | }, |
| 1894 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1895 | .name = "verify_interval", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1896 | .type = FIO_OPT_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1897 | .off1 = td_var_offset(verify_interval), |
Jens Axboe | 819a968 | 2007-07-28 21:30:31 +0200 | [diff] [blame] | 1898 | .minval = 2 * sizeof(struct verify_header), |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1899 | .help = "Store verify buffer header every N bytes", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1900 | .parent = "verify", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 1901 | }, |
| 1902 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1903 | .name = "verify_offset", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1904 | .type = FIO_OPT_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1905 | .help = "Offset verify header location by N bytes", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 1906 | .def = "0", |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 1907 | .cb = str_verify_offset_cb, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1908 | .parent = "verify", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 1909 | }, |
| 1910 | { |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 1911 | .name = "verify_pattern", |
Radha Ramachandran | 0e92f87 | 2009-10-27 20:14:27 +0100 | [diff] [blame] | 1912 | .type = FIO_OPT_STR, |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 1913 | .cb = str_verify_pattern_cb, |
| 1914 | .help = "Fill pattern for IO buffers", |
| 1915 | .parent = "verify", |
| 1916 | }, |
| 1917 | { |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 1918 | .name = "verify_fatal", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 1919 | .type = FIO_OPT_BOOL, |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 1920 | .off1 = td_var_offset(verify_fatal), |
| 1921 | .def = "0", |
| 1922 | .help = "Exit on a single verify failure, don't continue", |
| 1923 | .parent = "verify", |
| 1924 | }, |
| 1925 | { |
Jens Axboe | b463e93 | 2011-01-12 09:03:23 +0100 | [diff] [blame] | 1926 | .name = "verify_dump", |
| 1927 | .type = FIO_OPT_BOOL, |
| 1928 | .off1 = td_var_offset(verify_dump), |
Jens Axboe | ef71e31 | 2011-10-25 22:43:36 +0200 | [diff] [blame] | 1929 | .def = "0", |
Jens Axboe | b463e93 | 2011-01-12 09:03:23 +0100 | [diff] [blame] | 1930 | .help = "Dump contents of good and bad blocks on failure", |
| 1931 | .parent = "verify", |
| 1932 | }, |
| 1933 | { |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 1934 | .name = "verify_async", |
| 1935 | .type = FIO_OPT_INT, |
| 1936 | .off1 = td_var_offset(verify_async), |
| 1937 | .def = "0", |
| 1938 | .help = "Number of async verifier threads to use", |
| 1939 | .parent = "verify", |
| 1940 | }, |
Jens Axboe | 9e14418 | 2010-06-15 14:25:36 +0200 | [diff] [blame] | 1941 | { |
| 1942 | .name = "verify_backlog", |
| 1943 | .type = FIO_OPT_STR_VAL, |
| 1944 | .off1 = td_var_offset(verify_backlog), |
| 1945 | .help = "Verify after this number of blocks are written", |
| 1946 | .parent = "verify", |
| 1947 | }, |
| 1948 | { |
| 1949 | .name = "verify_backlog_batch", |
| 1950 | .type = FIO_OPT_INT, |
| 1951 | .off1 = td_var_offset(verify_batch), |
| 1952 | .help = "Verify this number of IO blocks", |
Jens Axboe | 0d29de8 | 2010-09-01 13:54:15 +0200 | [diff] [blame] | 1953 | .parent = "verify", |
Jens Axboe | 9e14418 | 2010-06-15 14:25:36 +0200 | [diff] [blame] | 1954 | }, |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 1955 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 1956 | { |
| 1957 | .name = "verify_async_cpus", |
| 1958 | .type = FIO_OPT_STR, |
| 1959 | .cb = str_verify_cpus_allowed_cb, |
| 1960 | .help = "Set CPUs allowed for async verify threads", |
| 1961 | .parent = "verify_async", |
| 1962 | }, |
| 1963 | #endif |
Jens Axboe | 51aa2da | 2013-01-21 10:55:02 -0700 | [diff] [blame] | 1964 | { |
| 1965 | .name = "experimental_verify", |
| 1966 | .off1 = td_var_offset(experimental_verify), |
| 1967 | .type = FIO_OPT_BOOL, |
Jens Axboe | b31eaac | 2013-01-24 15:29:58 -0700 | [diff] [blame] | 1968 | .help = "Enable experimental verification", |
Jens Axboe | 51aa2da | 2013-01-21 10:55:02 -0700 | [diff] [blame] | 1969 | }, |
Jens Axboe | 0d29de8 | 2010-09-01 13:54:15 +0200 | [diff] [blame] | 1970 | #ifdef FIO_HAVE_TRIM |
| 1971 | { |
| 1972 | .name = "trim_percentage", |
| 1973 | .type = FIO_OPT_INT, |
| 1974 | .cb = str_verify_trim_cb, |
| 1975 | .maxval = 100, |
| 1976 | .help = "Number of verify blocks to discard/trim", |
| 1977 | .parent = "verify", |
| 1978 | .def = "0", |
| 1979 | }, |
| 1980 | { |
| 1981 | .name = "trim_verify_zero", |
| 1982 | .type = FIO_OPT_INT, |
| 1983 | .help = "Verify that trim/discarded blocks are returned as zeroes", |
| 1984 | .off1 = td_var_offset(trim_zero), |
| 1985 | .parent = "trim_percentage", |
| 1986 | .def = "1", |
| 1987 | }, |
| 1988 | { |
| 1989 | .name = "trim_backlog", |
| 1990 | .type = FIO_OPT_STR_VAL, |
| 1991 | .off1 = td_var_offset(trim_backlog), |
| 1992 | .help = "Trim after this number of blocks are written", |
| 1993 | .parent = "trim_percentage", |
| 1994 | }, |
| 1995 | { |
| 1996 | .name = "trim_backlog_batch", |
| 1997 | .type = FIO_OPT_INT, |
| 1998 | .off1 = td_var_offset(trim_batch), |
| 1999 | .help = "Trim this number of IO blocks", |
| 2000 | .parent = "trim_percentage", |
| 2001 | }, |
| 2002 | #endif |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 2003 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2004 | .name = "write_iolog", |
| 2005 | .type = FIO_OPT_STR_STORE, |
| 2006 | .off1 = td_var_offset(write_iolog_file), |
| 2007 | .help = "Store IO pattern to file", |
| 2008 | }, |
| 2009 | { |
| 2010 | .name = "read_iolog", |
| 2011 | .type = FIO_OPT_STR_STORE, |
| 2012 | .off1 = td_var_offset(read_iolog_file), |
| 2013 | .help = "Playback IO pattern from file", |
| 2014 | }, |
| 2015 | { |
David Nellans | 64bbb86 | 2010-08-24 22:13:30 +0200 | [diff] [blame] | 2016 | .name = "replay_no_stall", |
| 2017 | .type = FIO_OPT_INT, |
| 2018 | .off1 = td_var_offset(no_stall), |
| 2019 | .def = "0", |
Jens Axboe | 87e7a97 | 2010-08-25 09:01:25 +0200 | [diff] [blame] | 2020 | .parent = "read_iolog", |
David Nellans | 64bbb86 | 2010-08-24 22:13:30 +0200 | [diff] [blame] | 2021 | .help = "Playback IO pattern file as fast as possible without stalls", |
| 2022 | }, |
| 2023 | { |
David Nellans | d1c46c0 | 2010-08-31 21:20:47 +0200 | [diff] [blame] | 2024 | .name = "replay_redirect", |
| 2025 | .type = FIO_OPT_STR_STORE, |
| 2026 | .off1 = td_var_offset(replay_redirect), |
| 2027 | .parent = "read_iolog", |
| 2028 | .help = "Replay all I/O onto this device, regardless of trace device", |
| 2029 | }, |
| 2030 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2031 | .name = "exec_prerun", |
| 2032 | .type = FIO_OPT_STR_STORE, |
| 2033 | .off1 = td_var_offset(exec_prerun), |
| 2034 | .help = "Execute this file prior to running job", |
| 2035 | }, |
| 2036 | { |
| 2037 | .name = "exec_postrun", |
| 2038 | .type = FIO_OPT_STR_STORE, |
| 2039 | .off1 = td_var_offset(exec_postrun), |
| 2040 | .help = "Execute this file after running job", |
| 2041 | }, |
| 2042 | #ifdef FIO_HAVE_IOSCHED_SWITCH |
| 2043 | { |
| 2044 | .name = "ioscheduler", |
| 2045 | .type = FIO_OPT_STR_STORE, |
| 2046 | .off1 = td_var_offset(ioscheduler), |
| 2047 | .help = "Use this IO scheduler on the backing device", |
| 2048 | }, |
| 2049 | #endif |
| 2050 | { |
| 2051 | .name = "zonesize", |
| 2052 | .type = FIO_OPT_STR_VAL, |
| 2053 | .off1 = td_var_offset(zone_size), |
Steven Noonan | ed33585 | 2012-01-31 13:58:00 +0100 | [diff] [blame] | 2054 | .help = "Amount of data to read per zone", |
| 2055 | .def = "0", |
| 2056 | }, |
| 2057 | { |
| 2058 | .name = "zonerange", |
| 2059 | .type = FIO_OPT_STR_VAL, |
| 2060 | .off1 = td_var_offset(zone_range), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2061 | .help = "Give size of an IO zone", |
| 2062 | .def = "0", |
| 2063 | }, |
| 2064 | { |
| 2065 | .name = "zoneskip", |
| 2066 | .type = FIO_OPT_STR_VAL, |
| 2067 | .off1 = td_var_offset(zone_skip), |
| 2068 | .help = "Space between IO zones", |
| 2069 | .def = "0", |
| 2070 | }, |
| 2071 | { |
| 2072 | .name = "lockmem", |
| 2073 | .type = FIO_OPT_STR_VAL, |
| 2074 | .cb = str_lockmem_cb, |
| 2075 | .help = "Lock down this amount of memory", |
| 2076 | .def = "0", |
| 2077 | }, |
| 2078 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2079 | .name = "rwmixread", |
| 2080 | .type = FIO_OPT_INT, |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 2081 | .cb = str_rwmix_read_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2082 | .maxval = 100, |
| 2083 | .help = "Percentage of mixed workload that is reads", |
| 2084 | .def = "50", |
| 2085 | }, |
| 2086 | { |
| 2087 | .name = "rwmixwrite", |
| 2088 | .type = FIO_OPT_INT, |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 2089 | .cb = str_rwmix_write_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2090 | .maxval = 100, |
| 2091 | .help = "Percentage of mixed workload that is writes", |
| 2092 | .def = "50", |
| 2093 | }, |
| 2094 | { |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2095 | .name = "rwmixcycle", |
Jens Axboe | 15ca150 | 2008-04-07 09:26:02 +0200 | [diff] [blame] | 2096 | .type = FIO_OPT_DEPRECATED, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2097 | }, |
| 2098 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2099 | .name = "nice", |
| 2100 | .type = FIO_OPT_INT, |
| 2101 | .off1 = td_var_offset(nice), |
| 2102 | .help = "Set job CPU nice value", |
| 2103 | .minval = -19, |
| 2104 | .maxval = 20, |
| 2105 | .def = "0", |
| 2106 | }, |
| 2107 | #ifdef FIO_HAVE_IOPRIO |
| 2108 | { |
| 2109 | .name = "prio", |
| 2110 | .type = FIO_OPT_INT, |
| 2111 | .cb = str_prio_cb, |
| 2112 | .help = "Set job IO priority value", |
| 2113 | .minval = 0, |
| 2114 | .maxval = 7, |
| 2115 | }, |
| 2116 | { |
| 2117 | .name = "prioclass", |
| 2118 | .type = FIO_OPT_INT, |
| 2119 | .cb = str_prioclass_cb, |
| 2120 | .help = "Set job IO priority class", |
| 2121 | .minval = 0, |
| 2122 | .maxval = 3, |
| 2123 | }, |
| 2124 | #endif |
| 2125 | { |
| 2126 | .name = "thinktime", |
| 2127 | .type = FIO_OPT_INT, |
| 2128 | .off1 = td_var_offset(thinktime), |
| 2129 | .help = "Idle time between IO buffers (usec)", |
| 2130 | .def = "0", |
| 2131 | }, |
| 2132 | { |
| 2133 | .name = "thinktime_spin", |
| 2134 | .type = FIO_OPT_INT, |
| 2135 | .off1 = td_var_offset(thinktime_spin), |
| 2136 | .help = "Start think time by spinning this amount (usec)", |
| 2137 | .def = "0", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2138 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2139 | }, |
| 2140 | { |
| 2141 | .name = "thinktime_blocks", |
| 2142 | .type = FIO_OPT_INT, |
| 2143 | .off1 = td_var_offset(thinktime_blocks), |
| 2144 | .help = "IO buffer period between 'thinktime'", |
| 2145 | .def = "1", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2146 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2147 | }, |
| 2148 | { |
| 2149 | .name = "rate", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 2150 | .type = FIO_OPT_INT, |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 2151 | .off1 = td_var_offset(rate[DDIR_READ]), |
| 2152 | .off2 = td_var_offset(rate[DDIR_WRITE]), |
| 2153 | .off3 = td_var_offset(rate[DDIR_TRIM]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2154 | .help = "Set bandwidth rate", |
| 2155 | }, |
| 2156 | { |
| 2157 | .name = "ratemin", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 2158 | .type = FIO_OPT_INT, |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 2159 | .off1 = td_var_offset(ratemin[DDIR_READ]), |
| 2160 | .off2 = td_var_offset(ratemin[DDIR_WRITE]), |
| 2161 | .off3 = td_var_offset(ratemin[DDIR_TRIM]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 2162 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2163 | .parent = "rate", |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 2164 | }, |
| 2165 | { |
| 2166 | .name = "rate_iops", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 2167 | .type = FIO_OPT_INT, |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 2168 | .off1 = td_var_offset(rate_iops[DDIR_READ]), |
| 2169 | .off2 = td_var_offset(rate_iops[DDIR_WRITE]), |
| 2170 | .off3 = td_var_offset(rate_iops[DDIR_TRIM]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 2171 | .help = "Limit IO used to this number of IO operations/sec", |
| 2172 | }, |
| 2173 | { |
| 2174 | .name = "rate_iops_min", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 2175 | .type = FIO_OPT_INT, |
Shaohua Li | 6eaf09d | 2012-09-14 08:49:43 +0200 | [diff] [blame] | 2176 | .off1 = td_var_offset(rate_iops_min[DDIR_READ]), |
| 2177 | .off2 = td_var_offset(rate_iops_min[DDIR_WRITE]), |
| 2178 | .off3 = td_var_offset(rate_iops_min[DDIR_TRIM]), |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 2179 | .help = "Job must meet this rate or it will be shut down", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2180 | .parent = "rate_iops", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2181 | }, |
| 2182 | { |
| 2183 | .name = "ratecycle", |
| 2184 | .type = FIO_OPT_INT, |
| 2185 | .off1 = td_var_offset(ratecycle), |
| 2186 | .help = "Window average for rate limits (msec)", |
| 2187 | .def = "1000", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 2188 | .parent = "rate", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2189 | }, |
| 2190 | { |
Jens Axboe | 1550153 | 2012-10-24 16:37:45 +0200 | [diff] [blame] | 2191 | .name = "max_latency", |
| 2192 | .type = FIO_OPT_INT, |
| 2193 | .off1 = td_var_offset(max_latency), |
| 2194 | .help = "Maximum tolerated IO latency (usec)", |
| 2195 | }, |
| 2196 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2197 | .name = "invalidate", |
| 2198 | .type = FIO_OPT_BOOL, |
| 2199 | .off1 = td_var_offset(invalidate_cache), |
| 2200 | .help = "Invalidate buffer/page cache prior to running job", |
| 2201 | .def = "1", |
| 2202 | }, |
| 2203 | { |
| 2204 | .name = "sync", |
| 2205 | .type = FIO_OPT_BOOL, |
| 2206 | .off1 = td_var_offset(sync_io), |
| 2207 | .help = "Use O_SYNC for buffered writes", |
| 2208 | .def = "0", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 2209 | .parent = "buffered", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2210 | }, |
| 2211 | { |
| 2212 | .name = "bwavgtime", |
| 2213 | .type = FIO_OPT_INT, |
| 2214 | .off1 = td_var_offset(bw_avg_time), |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 2215 | .help = "Time window over which to calculate bandwidth" |
| 2216 | " (msec)", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2217 | .def = "500", |
Jens Axboe | c8eeb9d | 2011-10-05 14:02:22 +0200 | [diff] [blame] | 2218 | .parent = "write_bw_log", |
| 2219 | }, |
| 2220 | { |
| 2221 | .name = "iopsavgtime", |
| 2222 | .type = FIO_OPT_INT, |
| 2223 | .off1 = td_var_offset(iops_avg_time), |
| 2224 | .help = "Time window over which to calculate IOPS (msec)", |
| 2225 | .def = "500", |
| 2226 | .parent = "write_iops_log", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2227 | }, |
| 2228 | { |
| 2229 | .name = "create_serialize", |
| 2230 | .type = FIO_OPT_BOOL, |
| 2231 | .off1 = td_var_offset(create_serialize), |
| 2232 | .help = "Serialize creating of job files", |
| 2233 | .def = "1", |
| 2234 | }, |
| 2235 | { |
| 2236 | .name = "create_fsync", |
| 2237 | .type = FIO_OPT_BOOL, |
| 2238 | .off1 = td_var_offset(create_fsync), |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 2239 | .help = "fsync file after creation", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2240 | .def = "1", |
| 2241 | }, |
| 2242 | { |
Jens Axboe | 814452b | 2009-03-04 12:53:13 +0100 | [diff] [blame] | 2243 | .name = "create_on_open", |
| 2244 | .type = FIO_OPT_BOOL, |
| 2245 | .off1 = td_var_offset(create_on_open), |
| 2246 | .help = "Create files when they are opened for IO", |
| 2247 | .def = "0", |
| 2248 | }, |
Jens Axboe | 0b9d69e | 2009-09-11 22:29:54 +0200 | [diff] [blame] | 2249 | { |
Jens Axboe | 25460cf | 2012-05-02 13:58:02 +0200 | [diff] [blame] | 2250 | .name = "create_only", |
| 2251 | .type = FIO_OPT_BOOL, |
| 2252 | .off1 = td_var_offset(create_only), |
| 2253 | .help = "Only perform file creation phase", |
| 2254 | .def = "0", |
| 2255 | }, |
| 2256 | { |
Zhang, Yanmin | afad68f | 2009-05-20 11:30:55 +0200 | [diff] [blame] | 2257 | .name = "pre_read", |
| 2258 | .type = FIO_OPT_BOOL, |
| 2259 | .off1 = td_var_offset(pre_read), |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 2260 | .help = "Pre-read files before starting official testing", |
Zhang, Yanmin | afad68f | 2009-05-20 11:30:55 +0200 | [diff] [blame] | 2261 | .def = "0", |
| 2262 | }, |
Jens Axboe | 814452b | 2009-03-04 12:53:13 +0100 | [diff] [blame] | 2263 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2264 | .name = "cpuload", |
| 2265 | .type = FIO_OPT_INT, |
| 2266 | .off1 = td_var_offset(cpuload), |
| 2267 | .help = "Use this percentage of CPU", |
| 2268 | }, |
| 2269 | { |
| 2270 | .name = "cpuchunks", |
| 2271 | .type = FIO_OPT_INT, |
| 2272 | .off1 = td_var_offset(cpucycle), |
| 2273 | .help = "Length of the CPU burn cycles (usecs)", |
| 2274 | .def = "50000", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 2275 | .parent = "cpuload", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2276 | }, |
| 2277 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 2278 | { |
| 2279 | .name = "cpumask", |
| 2280 | .type = FIO_OPT_INT, |
| 2281 | .cb = str_cpumask_cb, |
| 2282 | .help = "CPU affinity mask", |
| 2283 | }, |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 2284 | { |
| 2285 | .name = "cpus_allowed", |
| 2286 | .type = FIO_OPT_STR, |
| 2287 | .cb = str_cpus_allowed_cb, |
| 2288 | .help = "Set CPUs allowed", |
| 2289 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2290 | #endif |
Jens Axboe | 67bf982 | 2013-01-10 11:23:19 +0100 | [diff] [blame] | 2291 | #ifdef CONFIG_LIBNUMA |
Yufei Ren | d0b937e | 2012-10-19 23:11:52 -0400 | [diff] [blame] | 2292 | { |
| 2293 | .name = "numa_cpu_nodes", |
| 2294 | .type = FIO_OPT_STR, |
| 2295 | .cb = str_numa_cpunodes_cb, |
| 2296 | .help = "NUMA CPU nodes bind", |
| 2297 | }, |
| 2298 | { |
| 2299 | .name = "numa_mem_policy", |
| 2300 | .type = FIO_OPT_STR, |
| 2301 | .cb = str_numa_mpol_cb, |
| 2302 | .help = "NUMA memory policy setup", |
| 2303 | }, |
| 2304 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2305 | { |
| 2306 | .name = "end_fsync", |
| 2307 | .type = FIO_OPT_BOOL, |
| 2308 | .off1 = td_var_offset(end_fsync), |
| 2309 | .help = "Include fsync at the end of job", |
| 2310 | .def = "0", |
| 2311 | }, |
| 2312 | { |
| 2313 | .name = "fsync_on_close", |
| 2314 | .type = FIO_OPT_BOOL, |
| 2315 | .off1 = td_var_offset(fsync_on_close), |
| 2316 | .help = "fsync files on close", |
| 2317 | .def = "0", |
| 2318 | }, |
| 2319 | { |
| 2320 | .name = "unlink", |
| 2321 | .type = FIO_OPT_BOOL, |
| 2322 | .off1 = td_var_offset(unlink), |
| 2323 | .help = "Unlink created files after job has completed", |
| 2324 | .def = "0", |
| 2325 | }, |
| 2326 | { |
| 2327 | .name = "exitall", |
| 2328 | .type = FIO_OPT_STR_SET, |
| 2329 | .cb = str_exitall_cb, |
| 2330 | .help = "Terminate all jobs when one exits", |
| 2331 | }, |
| 2332 | { |
| 2333 | .name = "stonewall", |
Jens Axboe | d392365 | 2011-08-03 12:38:39 +0200 | [diff] [blame] | 2334 | .alias = "wait_for_previous", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2335 | .type = FIO_OPT_STR_SET, |
| 2336 | .off1 = td_var_offset(stonewall), |
| 2337 | .help = "Insert a hard barrier between this job and previous", |
| 2338 | }, |
| 2339 | { |
Jens Axboe | b3d62a7 | 2007-03-20 14:23:26 +0100 | [diff] [blame] | 2340 | .name = "new_group", |
| 2341 | .type = FIO_OPT_STR_SET, |
| 2342 | .off1 = td_var_offset(new_group), |
| 2343 | .help = "Mark the start of a new group (for reporting)", |
| 2344 | }, |
| 2345 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2346 | .name = "thread", |
| 2347 | .type = FIO_OPT_STR_SET, |
| 2348 | .off1 = td_var_offset(use_thread), |
| 2349 | .help = "Use threads instead of forks", |
| 2350 | }, |
| 2351 | { |
| 2352 | .name = "write_bw_log", |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 2353 | .type = FIO_OPT_STR, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2354 | .off1 = td_var_offset(write_bw_log), |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 2355 | .cb = str_write_bw_log_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2356 | .help = "Write log of bandwidth during run", |
| 2357 | }, |
| 2358 | { |
| 2359 | .name = "write_lat_log", |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 2360 | .type = FIO_OPT_STR, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2361 | .off1 = td_var_offset(write_lat_log), |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 2362 | .cb = str_write_lat_log_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2363 | .help = "Write log of latency during run", |
| 2364 | }, |
| 2365 | { |
Jens Axboe | c8eeb9d | 2011-10-05 14:02:22 +0200 | [diff] [blame] | 2366 | .name = "write_iops_log", |
| 2367 | .type = FIO_OPT_STR, |
| 2368 | .off1 = td_var_offset(write_iops_log), |
| 2369 | .cb = str_write_iops_log_cb, |
| 2370 | .help = "Write log of IOPS during run", |
| 2371 | }, |
| 2372 | { |
Jens Axboe | b8bc8cb | 2011-12-01 09:04:31 +0100 | [diff] [blame] | 2373 | .name = "log_avg_msec", |
| 2374 | .type = FIO_OPT_INT, |
| 2375 | .off1 = td_var_offset(log_avg_msec), |
| 2376 | .help = "Average bw/iops/lat logs over this period of time", |
| 2377 | .def = "0", |
| 2378 | }, |
| 2379 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2380 | .name = "hugepage-size", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 2381 | .type = FIO_OPT_INT, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2382 | .off1 = td_var_offset(hugepage_size), |
| 2383 | .help = "When using hugepages, specify size of each page", |
Jens Axboe | 81179ee | 2011-10-04 12:42:06 +0200 | [diff] [blame] | 2384 | .def = __fio_stringify(FIO_HUGE_PAGE), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2385 | }, |
| 2386 | { |
| 2387 | .name = "group_reporting", |
| 2388 | .type = FIO_OPT_STR_SET, |
| 2389 | .off1 = td_var_offset(group_reporting), |
| 2390 | .help = "Do reporting on a per-group basis", |
| 2391 | }, |
| 2392 | { |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 2393 | .name = "zero_buffers", |
| 2394 | .type = FIO_OPT_STR_SET, |
| 2395 | .off1 = td_var_offset(zero_buffers), |
| 2396 | .help = "Init IO buffers to all zeroes", |
| 2397 | }, |
Jens Axboe | 5973caf | 2008-05-21 19:52:35 +0200 | [diff] [blame] | 2398 | { |
| 2399 | .name = "refill_buffers", |
| 2400 | .type = FIO_OPT_STR_SET, |
| 2401 | .off1 = td_var_offset(refill_buffers), |
| 2402 | .help = "Refill IO buffers on every IO submit", |
| 2403 | }, |
Yu-ju Hong | 8334919 | 2011-08-13 00:53:44 +0200 | [diff] [blame] | 2404 | { |
Jens Axboe | fd68418 | 2011-09-19 09:24:44 +0200 | [diff] [blame] | 2405 | .name = "scramble_buffers", |
| 2406 | .type = FIO_OPT_BOOL, |
| 2407 | .off1 = td_var_offset(scramble_buffers), |
| 2408 | .help = "Slightly scramble buffers on every IO submit", |
| 2409 | .def = "1", |
| 2410 | }, |
| 2411 | { |
Jens Axboe | 9c42684 | 2012-03-02 21:02:12 +0100 | [diff] [blame] | 2412 | .name = "buffer_compress_percentage", |
| 2413 | .type = FIO_OPT_INT, |
| 2414 | .off1 = td_var_offset(compress_percentage), |
| 2415 | .maxval = 100, |
| 2416 | .minval = 1, |
| 2417 | .help = "How compressible the buffer is (approximately)", |
| 2418 | }, |
| 2419 | { |
Jens Axboe | f97a43a | 2012-03-09 19:06:24 +0100 | [diff] [blame] | 2420 | .name = "buffer_compress_chunk", |
| 2421 | .type = FIO_OPT_INT, |
| 2422 | .off1 = td_var_offset(compress_chunk), |
Jens Axboe | 207b18e | 2012-03-09 19:11:25 +0100 | [diff] [blame] | 2423 | .parent = "buffer_compress_percentage", |
Jens Axboe | f97a43a | 2012-03-09 19:06:24 +0100 | [diff] [blame] | 2424 | .help = "Size of compressible region in buffer", |
| 2425 | }, |
| 2426 | { |
Yu-ju Hong | 8334919 | 2011-08-13 00:53:44 +0200 | [diff] [blame] | 2427 | .name = "clat_percentiles", |
| 2428 | .type = FIO_OPT_BOOL, |
| 2429 | .off1 = td_var_offset(clat_percentiles), |
| 2430 | .help = "Enable the reporting of completion latency percentiles", |
Jens Axboe | 467b35e | 2011-10-13 08:53:24 +0200 | [diff] [blame] | 2431 | .def = "1", |
Yu-ju Hong | 8334919 | 2011-08-13 00:53:44 +0200 | [diff] [blame] | 2432 | }, |
| 2433 | { |
| 2434 | .name = "percentile_list", |
| 2435 | .type = FIO_OPT_FLOAT_LIST, |
| 2436 | .off1 = td_var_offset(percentile_list), |
| 2437 | .off2 = td_var_offset(overwrite_plist), |
| 2438 | .help = "Specify a custom list of percentiles to report", |
| 2439 | .maxlen = FIO_IO_U_LIST_MAX_LEN, |
| 2440 | .minfp = 0.0, |
| 2441 | .maxfp = 100.0, |
| 2442 | }, |
| 2443 | |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 2444 | #ifdef FIO_HAVE_DISK_UTIL |
| 2445 | { |
| 2446 | .name = "disk_util", |
| 2447 | .type = FIO_OPT_BOOL, |
| 2448 | .off1 = td_var_offset(do_disk_util), |
Jens Axboe | f66ab3c | 2008-06-05 11:48:22 +0200 | [diff] [blame] | 2449 | .help = "Log disk utilization statistics", |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 2450 | .def = "1", |
| 2451 | }, |
| 2452 | #endif |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 2453 | { |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 2454 | .name = "gtod_reduce", |
| 2455 | .type = FIO_OPT_BOOL, |
| 2456 | .help = "Greatly reduce number of gettimeofday() calls", |
| 2457 | .cb = str_gtod_reduce_cb, |
| 2458 | .def = "0", |
| 2459 | }, |
| 2460 | { |
Jens Axboe | 02af098 | 2010-06-24 09:59:34 +0200 | [diff] [blame] | 2461 | .name = "disable_lat", |
| 2462 | .type = FIO_OPT_BOOL, |
| 2463 | .off1 = td_var_offset(disable_lat), |
| 2464 | .help = "Disable latency numbers", |
| 2465 | .parent = "gtod_reduce", |
| 2466 | .def = "0", |
| 2467 | }, |
| 2468 | { |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 2469 | .name = "disable_clat", |
| 2470 | .type = FIO_OPT_BOOL, |
| 2471 | .off1 = td_var_offset(disable_clat), |
| 2472 | .help = "Disable completion latency numbers", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 2473 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 2474 | .def = "0", |
| 2475 | }, |
| 2476 | { |
| 2477 | .name = "disable_slat", |
| 2478 | .type = FIO_OPT_BOOL, |
| 2479 | .off1 = td_var_offset(disable_slat), |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 2480 | .help = "Disable submission latency numbers", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 2481 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 2482 | .def = "0", |
| 2483 | }, |
| 2484 | { |
| 2485 | .name = "disable_bw_measurement", |
| 2486 | .type = FIO_OPT_BOOL, |
| 2487 | .off1 = td_var_offset(disable_bw), |
| 2488 | .help = "Disable bandwidth logging", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 2489 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 2490 | .def = "0", |
| 2491 | }, |
| 2492 | { |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 2493 | .name = "gtod_cpu", |
| 2494 | .type = FIO_OPT_INT, |
| 2495 | .cb = str_gtod_cpu_cb, |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 2496 | .help = "Set up dedicated gettimeofday() thread on this CPU", |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 2497 | .verify = gtod_cpu_verify, |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 2498 | }, |
| 2499 | { |
Jens Axboe | 771e58b | 2013-01-30 12:56:23 +0100 | [diff] [blame^] | 2500 | .name = "unified_rw_reporting", |
| 2501 | .type = FIO_OPT_BOOL, |
| 2502 | .off1 = td_var_offset(unified_rw_rep), |
| 2503 | .help = "Unify reporting across data direction", |
| 2504 | .def = "0", |
| 2505 | }, |
| 2506 | { |
Radha Ramachandran | f2bba18 | 2009-06-15 08:40:16 +0200 | [diff] [blame] | 2507 | .name = "continue_on_error", |
Steven Lang | 0684202 | 2011-11-17 09:45:17 +0100 | [diff] [blame] | 2508 | .type = FIO_OPT_STR, |
Radha Ramachandran | f2bba18 | 2009-06-15 08:40:16 +0200 | [diff] [blame] | 2509 | .off1 = td_var_offset(continue_on_error), |
Bruce Cran | 03e20d6 | 2011-01-02 20:14:54 +0100 | [diff] [blame] | 2510 | .help = "Continue on non-fatal errors during IO", |
Steven Lang | 0684202 | 2011-11-17 09:45:17 +0100 | [diff] [blame] | 2511 | .def = "none", |
| 2512 | .posval = { |
| 2513 | { .ival = "none", |
| 2514 | .oval = ERROR_TYPE_NONE, |
| 2515 | .help = "Exit when an error is encountered", |
| 2516 | }, |
| 2517 | { .ival = "read", |
| 2518 | .oval = ERROR_TYPE_READ, |
| 2519 | .help = "Continue on read errors only", |
| 2520 | }, |
| 2521 | { .ival = "write", |
| 2522 | .oval = ERROR_TYPE_WRITE, |
| 2523 | .help = "Continue on write errors only", |
| 2524 | }, |
| 2525 | { .ival = "io", |
| 2526 | .oval = ERROR_TYPE_READ | ERROR_TYPE_WRITE, |
| 2527 | .help = "Continue on any IO errors", |
| 2528 | }, |
| 2529 | { .ival = "verify", |
| 2530 | .oval = ERROR_TYPE_VERIFY, |
| 2531 | .help = "Continue on verify errors only", |
| 2532 | }, |
| 2533 | { .ival = "all", |
| 2534 | .oval = ERROR_TYPE_ANY, |
| 2535 | .help = "Continue on all io and verify errors", |
| 2536 | }, |
| 2537 | { .ival = "0", |
| 2538 | .oval = ERROR_TYPE_NONE, |
| 2539 | .help = "Alias for 'none'", |
| 2540 | }, |
| 2541 | { .ival = "1", |
| 2542 | .oval = ERROR_TYPE_ANY, |
| 2543 | .help = "Alias for 'all'", |
| 2544 | }, |
| 2545 | }, |
Radha Ramachandran | f2bba18 | 2009-06-15 08:40:16 +0200 | [diff] [blame] | 2546 | }, |
| 2547 | { |
Dmitry Monakhov | 8b28bd4 | 2012-09-23 15:46:09 +0400 | [diff] [blame] | 2548 | .name = "ignore_error", |
| 2549 | .type = FIO_OPT_STR, |
| 2550 | .cb = str_ignore_error_cb, |
| 2551 | .help = "Set a specific list of errors to ignore", |
| 2552 | .parent = "rw", |
| 2553 | }, |
| 2554 | { |
| 2555 | .name = "error_dump", |
| 2556 | .type = FIO_OPT_BOOL, |
| 2557 | .off1 = td_var_offset(error_dump), |
| 2558 | .def = "0", |
| 2559 | .help = "Dump info on each error", |
| 2560 | }, |
| 2561 | |
| 2562 | { |
Jens Axboe | 9ac8a79 | 2009-11-13 21:23:07 +0100 | [diff] [blame] | 2563 | .name = "profile", |
Jens Axboe | 79d1631 | 2010-03-04 12:43:20 +0100 | [diff] [blame] | 2564 | .type = FIO_OPT_STR_STORE, |
Jens Axboe | 9ac8a79 | 2009-11-13 21:23:07 +0100 | [diff] [blame] | 2565 | .off1 = td_var_offset(profile), |
Jens Axboe | 9ac8a79 | 2009-11-13 21:23:07 +0100 | [diff] [blame] | 2566 | .help = "Select a specific builtin performance test", |
| 2567 | }, |
| 2568 | { |
Jens Axboe | a696fa2 | 2009-12-04 10:05:02 +0100 | [diff] [blame] | 2569 | .name = "cgroup", |
| 2570 | .type = FIO_OPT_STR_STORE, |
| 2571 | .off1 = td_var_offset(cgroup), |
| 2572 | .help = "Add job to cgroup of this name", |
| 2573 | }, |
| 2574 | { |
| 2575 | .name = "cgroup_weight", |
| 2576 | .type = FIO_OPT_INT, |
| 2577 | .off1 = td_var_offset(cgroup_weight), |
| 2578 | .help = "Use given weight for cgroup", |
| 2579 | .minval = 100, |
| 2580 | .maxval = 1000, |
Jens Axboe | a696fa2 | 2009-12-04 10:05:02 +0100 | [diff] [blame] | 2581 | }, |
| 2582 | { |
Vivek Goyal | 7de8709 | 2010-03-31 22:55:15 +0200 | [diff] [blame] | 2583 | .name = "cgroup_nodelete", |
| 2584 | .type = FIO_OPT_BOOL, |
| 2585 | .off1 = td_var_offset(cgroup_nodelete), |
| 2586 | .help = "Do not delete cgroups after job completion", |
| 2587 | .def = "0", |
| 2588 | }, |
| 2589 | { |
Jens Axboe | e0b0d89 | 2009-12-08 10:10:14 +0100 | [diff] [blame] | 2590 | .name = "uid", |
| 2591 | .type = FIO_OPT_INT, |
| 2592 | .off1 = td_var_offset(uid), |
| 2593 | .help = "Run job with this user ID", |
| 2594 | }, |
| 2595 | { |
| 2596 | .name = "gid", |
| 2597 | .type = FIO_OPT_INT, |
| 2598 | .off1 = td_var_offset(gid), |
| 2599 | .help = "Run job with this group ID", |
| 2600 | }, |
| 2601 | { |
Dan Ehrenberg | 9e684a4 | 2012-02-20 11:05:14 +0100 | [diff] [blame] | 2602 | .name = "flow_id", |
| 2603 | .type = FIO_OPT_INT, |
| 2604 | .off1 = td_var_offset(flow_id), |
| 2605 | .help = "The flow index ID to use", |
| 2606 | .def = "0", |
| 2607 | }, |
| 2608 | { |
| 2609 | .name = "flow", |
| 2610 | .type = FIO_OPT_INT, |
| 2611 | .off1 = td_var_offset(flow), |
| 2612 | .help = "Weight for flow control of this job", |
| 2613 | .parent = "flow_id", |
| 2614 | .def = "0", |
| 2615 | }, |
| 2616 | { |
| 2617 | .name = "flow_watermark", |
| 2618 | .type = FIO_OPT_INT, |
| 2619 | .off1 = td_var_offset(flow_watermark), |
| 2620 | .help = "High watermark for flow control. This option" |
| 2621 | " should be set to the same value for all threads" |
| 2622 | " with non-zero flow.", |
| 2623 | .parent = "flow_id", |
| 2624 | .def = "1024", |
| 2625 | }, |
| 2626 | { |
| 2627 | .name = "flow_sleep", |
| 2628 | .type = FIO_OPT_INT, |
| 2629 | .off1 = td_var_offset(flow_sleep), |
| 2630 | .help = "How many microseconds to sleep after being held" |
| 2631 | " back by the flow control mechanism", |
| 2632 | .parent = "flow_id", |
| 2633 | .def = "0", |
| 2634 | }, |
| 2635 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2636 | .name = NULL, |
| 2637 | }, |
| 2638 | }; |
| 2639 | |
Jens Axboe | 17af15d | 2010-04-13 10:38:16 +0200 | [diff] [blame] | 2640 | static void add_to_lopt(struct option *lopt, struct fio_option *o, |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2641 | const char *name, int val) |
Jens Axboe | 9f81736 | 2010-03-04 14:38:10 +0100 | [diff] [blame] | 2642 | { |
Jens Axboe | 17af15d | 2010-04-13 10:38:16 +0200 | [diff] [blame] | 2643 | lopt->name = (char *) name; |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2644 | lopt->val = val; |
Jens Axboe | 9f81736 | 2010-03-04 14:38:10 +0100 | [diff] [blame] | 2645 | if (o->type == FIO_OPT_STR_SET) |
| 2646 | lopt->has_arg = no_argument; |
| 2647 | else |
| 2648 | lopt->has_arg = required_argument; |
| 2649 | } |
| 2650 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2651 | static void options_to_lopts(struct fio_option *opts, |
| 2652 | struct option *long_options, |
| 2653 | int i, int option_type) |
| 2654 | { |
| 2655 | struct fio_option *o = &opts[0]; |
| 2656 | while (o->name) { |
| 2657 | add_to_lopt(&long_options[i], o, o->name, option_type); |
| 2658 | if (o->alias) { |
| 2659 | i++; |
| 2660 | add_to_lopt(&long_options[i], o, o->alias, option_type); |
| 2661 | } |
| 2662 | |
| 2663 | i++; |
| 2664 | o++; |
| 2665 | assert(i < FIO_NR_OPTIONS); |
| 2666 | } |
| 2667 | } |
| 2668 | |
| 2669 | void fio_options_set_ioengine_opts(struct option *long_options, |
| 2670 | struct thread_data *td) |
| 2671 | { |
| 2672 | unsigned int i; |
| 2673 | |
| 2674 | i = 0; |
| 2675 | while (long_options[i].name) { |
| 2676 | if (long_options[i].val == FIO_GETOPT_IOENGINE) { |
| 2677 | memset(&long_options[i], 0, sizeof(*long_options)); |
| 2678 | break; |
| 2679 | } |
| 2680 | i++; |
| 2681 | } |
| 2682 | |
| 2683 | /* |
| 2684 | * Just clear out the prior ioengine options. |
| 2685 | */ |
| 2686 | if (!td || !td->eo) |
| 2687 | return; |
| 2688 | |
| 2689 | options_to_lopts(td->io_ops->options, long_options, i, |
| 2690 | FIO_GETOPT_IOENGINE); |
| 2691 | } |
| 2692 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2693 | void fio_options_dup_and_init(struct option *long_options) |
| 2694 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2695 | unsigned int i; |
| 2696 | |
| 2697 | options_init(options); |
| 2698 | |
| 2699 | i = 0; |
| 2700 | while (long_options[i].name) |
| 2701 | i++; |
| 2702 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2703 | options_to_lopts(options, long_options, i, FIO_GETOPT_JOB); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2704 | } |
| 2705 | |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2706 | struct fio_keyword { |
| 2707 | const char *word; |
| 2708 | const char *desc; |
| 2709 | char *replace; |
| 2710 | }; |
| 2711 | |
| 2712 | static struct fio_keyword fio_keywords[] = { |
| 2713 | { |
| 2714 | .word = "$pagesize", |
| 2715 | .desc = "Page size in the system", |
| 2716 | }, |
| 2717 | { |
| 2718 | .word = "$mb_memory", |
| 2719 | .desc = "Megabytes of memory online", |
| 2720 | }, |
| 2721 | { |
| 2722 | .word = "$ncpus", |
| 2723 | .desc = "Number of CPUs online in the system", |
| 2724 | }, |
| 2725 | { |
| 2726 | .word = NULL, |
| 2727 | }, |
| 2728 | }; |
| 2729 | |
| 2730 | void fio_keywords_init(void) |
| 2731 | { |
Jens Axboe | 3b2e146 | 2009-12-15 08:58:10 +0100 | [diff] [blame] | 2732 | unsigned long long mb_memory; |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2733 | char buf[128]; |
| 2734 | long l; |
| 2735 | |
Jens Axboe | a4cfc47 | 2012-10-09 10:30:48 -0600 | [diff] [blame] | 2736 | sprintf(buf, "%lu", (unsigned long) page_size); |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2737 | fio_keywords[0].replace = strdup(buf); |
| 2738 | |
Jens Axboe | 8eb016d | 2011-07-11 10:24:20 +0200 | [diff] [blame] | 2739 | mb_memory = os_phys_mem() / (1024 * 1024); |
Jens Axboe | 3b2e146 | 2009-12-15 08:58:10 +0100 | [diff] [blame] | 2740 | sprintf(buf, "%llu", mb_memory); |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2741 | fio_keywords[1].replace = strdup(buf); |
| 2742 | |
Jens Axboe | c00a228 | 2011-07-08 20:56:06 +0200 | [diff] [blame] | 2743 | l = cpus_online(); |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2744 | sprintf(buf, "%lu", l); |
| 2745 | fio_keywords[2].replace = strdup(buf); |
| 2746 | } |
| 2747 | |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2748 | #define BC_APP "bc" |
| 2749 | |
| 2750 | static char *bc_calc(char *str) |
| 2751 | { |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2752 | char buf[128], *tmp; |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2753 | FILE *f; |
| 2754 | int ret; |
| 2755 | |
| 2756 | /* |
| 2757 | * No math, just return string |
| 2758 | */ |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2759 | if ((!strchr(str, '+') && !strchr(str, '-') && !strchr(str, '*') && |
| 2760 | !strchr(str, '/')) || strchr(str, '\'')) |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2761 | return str; |
| 2762 | |
| 2763 | /* |
| 2764 | * Split option from value, we only need to calculate the value |
| 2765 | */ |
| 2766 | tmp = strchr(str, '='); |
| 2767 | if (!tmp) |
| 2768 | return str; |
| 2769 | |
| 2770 | tmp++; |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2771 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2772 | /* |
| 2773 | * Prevent buffer overflows; such a case isn't reasonable anyway |
| 2774 | */ |
| 2775 | if (strlen(str) >= 128 || strlen(tmp) > 100) |
| 2776 | return str; |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2777 | |
| 2778 | sprintf(buf, "which %s > /dev/null", BC_APP); |
| 2779 | if (system(buf)) { |
| 2780 | log_err("fio: bc is needed for performing math\n"); |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2781 | return NULL; |
| 2782 | } |
| 2783 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2784 | sprintf(buf, "echo '%s' | %s", tmp, BC_APP); |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2785 | f = popen(buf, "r"); |
| 2786 | if (!f) { |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2787 | return NULL; |
| 2788 | } |
| 2789 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2790 | ret = fread(&buf[tmp - str], 1, 128 - (tmp - str), f); |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2791 | if (ret <= 0) { |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2792 | return NULL; |
| 2793 | } |
| 2794 | |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2795 | pclose(f); |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2796 | buf[(tmp - str) + ret - 1] = '\0'; |
| 2797 | memcpy(buf, str, tmp - str); |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2798 | free(str); |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2799 | return strdup(buf); |
| 2800 | } |
| 2801 | |
| 2802 | /* |
| 2803 | * Return a copy of the input string with substrings of the form ${VARNAME} |
| 2804 | * substituted with the value of the environment variable VARNAME. The |
| 2805 | * substitution always occurs, even if VARNAME is empty or the corresponding |
| 2806 | * environment variable undefined. |
| 2807 | */ |
| 2808 | static char *option_dup_subs(const char *opt) |
| 2809 | { |
| 2810 | char out[OPT_LEN_MAX+1]; |
| 2811 | char in[OPT_LEN_MAX+1]; |
| 2812 | char *outptr = out; |
| 2813 | char *inptr = in; |
| 2814 | char *ch1, *ch2, *env; |
| 2815 | ssize_t nchr = OPT_LEN_MAX; |
| 2816 | size_t envlen; |
| 2817 | |
| 2818 | if (strlen(opt) + 1 > OPT_LEN_MAX) { |
| 2819 | log_err("OPT_LEN_MAX (%d) is too small\n", OPT_LEN_MAX); |
| 2820 | return NULL; |
| 2821 | } |
| 2822 | |
| 2823 | in[OPT_LEN_MAX] = '\0'; |
| 2824 | strncpy(in, opt, OPT_LEN_MAX); |
| 2825 | |
| 2826 | while (*inptr && nchr > 0) { |
| 2827 | if (inptr[0] == '$' && inptr[1] == '{') { |
| 2828 | ch2 = strchr(inptr, '}'); |
| 2829 | if (ch2 && inptr+1 < ch2) { |
| 2830 | ch1 = inptr+2; |
| 2831 | inptr = ch2+1; |
| 2832 | *ch2 = '\0'; |
| 2833 | |
| 2834 | env = getenv(ch1); |
| 2835 | if (env) { |
| 2836 | envlen = strlen(env); |
| 2837 | if (envlen <= nchr) { |
| 2838 | memcpy(outptr, env, envlen); |
| 2839 | outptr += envlen; |
| 2840 | nchr -= envlen; |
| 2841 | } |
| 2842 | } |
| 2843 | |
| 2844 | continue; |
| 2845 | } |
| 2846 | } |
| 2847 | |
| 2848 | *outptr++ = *inptr++; |
| 2849 | --nchr; |
| 2850 | } |
| 2851 | |
| 2852 | *outptr = '\0'; |
| 2853 | return strdup(out); |
Jens Axboe | 892a6ff | 2009-11-13 12:19:49 +0100 | [diff] [blame] | 2854 | } |
| 2855 | |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2856 | /* |
| 2857 | * Look for reserved variable names and replace them with real values |
| 2858 | */ |
| 2859 | static char *fio_keyword_replace(char *opt) |
| 2860 | { |
| 2861 | char *s; |
| 2862 | int i; |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2863 | int docalc = 0; |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2864 | |
| 2865 | for (i = 0; fio_keywords[i].word != NULL; i++) { |
| 2866 | struct fio_keyword *kw = &fio_keywords[i]; |
| 2867 | |
| 2868 | while ((s = strstr(opt, kw->word)) != NULL) { |
| 2869 | char *new = malloc(strlen(opt) + 1); |
| 2870 | char *o_org = opt; |
| 2871 | int olen = s - opt; |
| 2872 | int len; |
| 2873 | |
| 2874 | /* |
| 2875 | * Copy part of the string before the keyword and |
| 2876 | * sprintf() the replacement after it. |
| 2877 | */ |
| 2878 | memcpy(new, opt, olen); |
| 2879 | len = sprintf(new + olen, "%s", kw->replace); |
| 2880 | |
| 2881 | /* |
| 2882 | * If there's more in the original string, copy that |
| 2883 | * in too |
| 2884 | */ |
| 2885 | opt += strlen(kw->word) + olen; |
| 2886 | if (strlen(opt)) |
| 2887 | memcpy(new + olen + len, opt, opt - o_org - 1); |
| 2888 | |
| 2889 | /* |
| 2890 | * replace opt and free the old opt |
| 2891 | */ |
| 2892 | opt = new; |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2893 | free(o_org); |
Jens Axboe | 7a958bd | 2009-11-13 12:33:54 +0100 | [diff] [blame] | 2894 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2895 | docalc = 1; |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2896 | } |
| 2897 | } |
| 2898 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2899 | /* |
| 2900 | * Check for potential math and invoke bc, if possible |
| 2901 | */ |
| 2902 | if (docalc) |
| 2903 | opt = bc_calc(opt); |
| 2904 | |
Jens Axboe | 7a958bd | 2009-11-13 12:33:54 +0100 | [diff] [blame] | 2905 | return opt; |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2906 | } |
| 2907 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2908 | static char **dup_and_sub_options(char **opts, int num_opts) |
| 2909 | { |
| 2910 | int i; |
| 2911 | char **opts_copy = malloc(num_opts * sizeof(*opts)); |
| 2912 | for (i = 0; i < num_opts; i++) { |
| 2913 | opts_copy[i] = option_dup_subs(opts[i]); |
| 2914 | if (!opts_copy[i]) |
| 2915 | continue; |
| 2916 | opts_copy[i] = fio_keyword_replace(opts_copy[i]); |
| 2917 | } |
| 2918 | return opts_copy; |
| 2919 | } |
| 2920 | |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 2921 | int fio_options_parse(struct thread_data *td, char **opts, int num_opts) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2922 | { |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2923 | int i, ret, unknown; |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2924 | char **opts_copy; |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 2925 | |
| 2926 | sort_options(opts, options, num_opts); |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2927 | opts_copy = dup_and_sub_options(opts, num_opts); |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 2928 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2929 | for (ret = 0, i = 0, unknown = 0; i < num_opts; i++) { |
| 2930 | struct fio_option *o; |
| 2931 | int newret = parse_option(opts_copy[i], opts[i], options, &o, |
| 2932 | td); |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2933 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2934 | if (opts_copy[i]) { |
| 2935 | if (newret && !o) { |
| 2936 | unknown++; |
| 2937 | continue; |
| 2938 | } |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2939 | free(opts_copy[i]); |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2940 | opts_copy[i] = NULL; |
| 2941 | } |
| 2942 | |
| 2943 | ret |= newret; |
| 2944 | } |
| 2945 | |
| 2946 | if (unknown) { |
| 2947 | ret |= ioengine_load(td); |
| 2948 | if (td->eo) { |
| 2949 | sort_options(opts_copy, td->io_ops->options, num_opts); |
| 2950 | opts = opts_copy; |
| 2951 | } |
| 2952 | for (i = 0; i < num_opts; i++) { |
| 2953 | struct fio_option *o = NULL; |
| 2954 | int newret = 1; |
| 2955 | if (!opts_copy[i]) |
| 2956 | continue; |
| 2957 | |
| 2958 | if (td->eo) |
| 2959 | newret = parse_option(opts_copy[i], opts[i], |
| 2960 | td->io_ops->options, &o, |
| 2961 | td->eo); |
| 2962 | |
| 2963 | ret |= newret; |
| 2964 | if (!o) |
| 2965 | log_err("Bad option <%s>\n", opts[i]); |
| 2966 | |
| 2967 | free(opts_copy[i]); |
| 2968 | opts_copy[i] = NULL; |
| 2969 | } |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 2970 | } |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 2971 | |
Steven Lang | d0c814e | 2011-10-28 08:37:13 +0200 | [diff] [blame] | 2972 | free(opts_copy); |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 2973 | return ret; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2974 | } |
| 2975 | |
| 2976 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) |
| 2977 | { |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 2978 | return parse_cmd_option(opt, val, options, td); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2979 | } |
| 2980 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2981 | int fio_cmd_ioengine_option_parse(struct thread_data *td, const char *opt, |
| 2982 | char *val) |
| 2983 | { |
| 2984 | return parse_cmd_option(opt, val, td->io_ops->options, td); |
| 2985 | } |
| 2986 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2987 | void fio_fill_default_options(struct thread_data *td) |
| 2988 | { |
| 2989 | fill_default_options(td, options); |
| 2990 | } |
| 2991 | |
| 2992 | int fio_show_option_help(const char *opt) |
| 2993 | { |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 2994 | return show_cmd_help(options, opt); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 2995 | } |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 2996 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 2997 | void options_mem_dupe(void *data, struct fio_option *options) |
| 2998 | { |
| 2999 | struct fio_option *o; |
| 3000 | char **ptr; |
| 3001 | |
| 3002 | for (o = &options[0]; o->name; o++) { |
| 3003 | if (o->type != FIO_OPT_STR_STORE) |
| 3004 | continue; |
| 3005 | |
| 3006 | ptr = td_var(data, o->off1); |
| 3007 | if (*ptr) |
| 3008 | *ptr = strdup(*ptr); |
| 3009 | } |
| 3010 | } |
| 3011 | |
Jens Axboe | 7e356b2 | 2011-10-14 10:55:16 +0200 | [diff] [blame] | 3012 | /* |
| 3013 | * dupe FIO_OPT_STR_STORE options |
| 3014 | */ |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 3015 | void fio_options_mem_dupe(struct thread_data *td) |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 3016 | { |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 3017 | options_mem_dupe(&td->o, options); |
Jens Axboe | 1647f59 | 2011-11-09 20:25:21 +0100 | [diff] [blame] | 3018 | |
| 3019 | if (td->eo && td->io_ops) { |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 3020 | void *oldeo = td->eo; |
Jens Axboe | 1647f59 | 2011-11-09 20:25:21 +0100 | [diff] [blame] | 3021 | |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 3022 | td->eo = malloc(td->io_ops->option_struct_size); |
| 3023 | memcpy(td->eo, oldeo, td->io_ops->option_struct_size); |
| 3024 | options_mem_dupe(td->eo, td->io_ops->options); |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 3025 | } |
| 3026 | } |
| 3027 | |
Jens Axboe | d6978a3 | 2009-07-18 21:04:09 +0200 | [diff] [blame] | 3028 | unsigned int fio_get_kb_base(void *data) |
| 3029 | { |
| 3030 | struct thread_data *td = data; |
| 3031 | unsigned int kb_base = 0; |
| 3032 | |
| 3033 | if (td) |
| 3034 | kb_base = td->o.kb_base; |
| 3035 | if (!kb_base) |
| 3036 | kb_base = 1024; |
| 3037 | |
| 3038 | return kb_base; |
| 3039 | } |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 3040 | |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 3041 | int add_option(struct fio_option *o) |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 3042 | { |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 3043 | struct fio_option *__o; |
| 3044 | int opt_index = 0; |
| 3045 | |
| 3046 | __o = options; |
| 3047 | while (__o->name) { |
| 3048 | opt_index++; |
| 3049 | __o++; |
| 3050 | } |
| 3051 | |
| 3052 | memcpy(&options[opt_index], o, sizeof(*o)); |
| 3053 | return 0; |
Jens Axboe | 9f988e2 | 2010-03-04 10:42:38 +0100 | [diff] [blame] | 3054 | } |
Jens Axboe | e2de69d | 2010-03-04 14:05:48 +0100 | [diff] [blame] | 3055 | |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 3056 | void invalidate_profile_options(const char *prof_name) |
Jens Axboe | e2de69d | 2010-03-04 14:05:48 +0100 | [diff] [blame] | 3057 | { |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 3058 | struct fio_option *o; |
Jens Axboe | e2de69d | 2010-03-04 14:05:48 +0100 | [diff] [blame] | 3059 | |
Jens Axboe | 07b3232 | 2010-03-05 09:48:44 +0100 | [diff] [blame] | 3060 | o = options; |
| 3061 | while (o->name) { |
| 3062 | if (o->prof_name && !strcmp(o->prof_name, prof_name)) { |
| 3063 | o->type = FIO_OPT_INVALID; |
| 3064 | o->prof_name = NULL; |
| 3065 | } |
| 3066 | o++; |
Jens Axboe | e2de69d | 2010-03-04 14:05:48 +0100 | [diff] [blame] | 3067 | } |
| 3068 | } |
Jens Axboe | f5b6bb8 | 2010-03-05 10:09:59 +0100 | [diff] [blame] | 3069 | |
| 3070 | void add_opt_posval(const char *optname, const char *ival, const char *help) |
| 3071 | { |
| 3072 | struct fio_option *o; |
| 3073 | unsigned int i; |
| 3074 | |
| 3075 | o = find_option(options, optname); |
| 3076 | if (!o) |
| 3077 | return; |
| 3078 | |
| 3079 | for (i = 0; i < PARSE_MAX_VP; i++) { |
| 3080 | if (o->posval[i].ival) |
| 3081 | continue; |
| 3082 | |
| 3083 | o->posval[i].ival = ival; |
| 3084 | o->posval[i].help = help; |
| 3085 | break; |
| 3086 | } |
| 3087 | } |
| 3088 | |
| 3089 | void del_opt_posval(const char *optname, const char *ival) |
| 3090 | { |
| 3091 | struct fio_option *o; |
| 3092 | unsigned int i; |
| 3093 | |
| 3094 | o = find_option(options, optname); |
| 3095 | if (!o) |
| 3096 | return; |
| 3097 | |
| 3098 | for (i = 0; i < PARSE_MAX_VP; i++) { |
| 3099 | if (!o->posval[i].ival) |
| 3100 | continue; |
| 3101 | if (strcmp(o->posval[i].ival, ival)) |
| 3102 | continue; |
| 3103 | |
| 3104 | o->posval[i].ival = NULL; |
| 3105 | o->posval[i].help = NULL; |
| 3106 | } |
| 3107 | } |
Jens Axboe | 7e356b2 | 2011-10-14 10:55:16 +0200 | [diff] [blame] | 3108 | |
| 3109 | void fio_options_free(struct thread_data *td) |
| 3110 | { |
| 3111 | options_free(options, td); |
Steven Lang | de890a1 | 2011-11-09 14:03:34 +0100 | [diff] [blame] | 3112 | if (td->eo && td->io_ops && td->io_ops->options) { |
| 3113 | options_free(td->io_ops->options, td->eo); |
| 3114 | free(td->eo); |
| 3115 | td->eo = NULL; |
| 3116 | } |
Jens Axboe | 7e356b2 | 2011-10-14 10:55:16 +0200 | [diff] [blame] | 3117 | } |