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