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