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