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