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> |
| 6 | #include <getopt.h> |
| 7 | #include <assert.h> |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 8 | #include <libgen.h> |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 9 | #include <fcntl.h> |
| 10 | #include <sys/types.h> |
| 11 | #include <sys/stat.h> |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 12 | |
| 13 | #include "fio.h" |
Jens Axboe | 4f5af7b | 2009-06-03 08:45:40 +0200 | [diff] [blame] | 14 | #include "verify.h" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 15 | #include "parse.h" |
Jens Axboe | eef3235 | 2008-06-02 13:31:26 +0200 | [diff] [blame] | 16 | #include "lib/fls.h" |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 17 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 18 | #define td_var_offset(var) ((size_t) &((struct thread_options *)0)->var) |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 19 | |
| 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 | |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 36 | static int bs_cmp(const void *p1, const void *p2) |
| 37 | { |
| 38 | const struct bssplit *bsp1 = p1; |
| 39 | const struct bssplit *bsp2 = p2; |
| 40 | |
| 41 | return bsp1->perc < bsp2->perc; |
| 42 | } |
| 43 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 44 | static int bssplit_ddir(struct thread_data *td, int ddir, char *str) |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 45 | { |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 46 | struct bssplit *bssplit; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 47 | unsigned int i, perc, perc_missing; |
| 48 | unsigned int max_bs, min_bs; |
| 49 | long long val; |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 50 | char *fname; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 51 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 52 | td->o.bssplit_nr[ddir] = 4; |
| 53 | bssplit = malloc(4 * sizeof(struct bssplit)); |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 54 | |
| 55 | i = 0; |
| 56 | max_bs = 0; |
| 57 | min_bs = -1; |
| 58 | while ((fname = strsep(&str, ":")) != NULL) { |
| 59 | char *perc_str; |
| 60 | |
| 61 | if (!strlen(fname)) |
| 62 | break; |
| 63 | |
| 64 | /* |
| 65 | * grow struct buffer, if needed |
| 66 | */ |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 67 | if (i == td->o.bssplit_nr[ddir]) { |
| 68 | td->o.bssplit_nr[ddir] <<= 1; |
| 69 | bssplit = realloc(bssplit, td->o.bssplit_nr[ddir] |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 70 | * sizeof(struct bssplit)); |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | perc_str = strstr(fname, "/"); |
| 74 | if (perc_str) { |
| 75 | *perc_str = '\0'; |
| 76 | perc_str++; |
| 77 | perc = atoi(perc_str); |
| 78 | if (perc > 100) |
| 79 | perc = 100; |
| 80 | else if (!perc) |
| 81 | perc = -1; |
| 82 | } else |
| 83 | perc = -1; |
| 84 | |
| 85 | if (str_to_decimal(fname, &val, 1)) { |
| 86 | log_err("fio: bssplit conversion failed\n"); |
| 87 | free(td->o.bssplit); |
| 88 | return 1; |
| 89 | } |
| 90 | |
| 91 | if (val > max_bs) |
| 92 | max_bs = val; |
| 93 | if (val < min_bs) |
| 94 | min_bs = val; |
| 95 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 96 | bssplit[i].bs = val; |
| 97 | bssplit[i].perc = perc; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 98 | i++; |
| 99 | } |
| 100 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 101 | td->o.bssplit_nr[ddir] = i; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 102 | |
| 103 | /* |
| 104 | * Now check if the percentages add up, and how much is missing |
| 105 | */ |
| 106 | perc = perc_missing = 0; |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 107 | for (i = 0; i < td->o.bssplit_nr[ddir]; i++) { |
| 108 | struct bssplit *bsp = &bssplit[i]; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 109 | |
| 110 | if (bsp->perc == (unsigned char) -1) |
| 111 | perc_missing++; |
| 112 | else |
| 113 | perc += bsp->perc; |
| 114 | } |
| 115 | |
| 116 | if (perc > 100) { |
| 117 | log_err("fio: bssplit percentages add to more than 100%%\n"); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 118 | free(bssplit); |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 119 | return 1; |
| 120 | } |
| 121 | /* |
| 122 | * If values didn't have a percentage set, divide the remains between |
| 123 | * them. |
| 124 | */ |
| 125 | if (perc_missing) { |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 126 | for (i = 0; i < td->o.bssplit_nr[ddir]; i++) { |
| 127 | struct bssplit *bsp = &bssplit[i]; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 128 | |
| 129 | if (bsp->perc == (unsigned char) -1) |
| 130 | bsp->perc = (100 - perc) / perc_missing; |
| 131 | } |
| 132 | } |
| 133 | |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 134 | td->o.min_bs[ddir] = min_bs; |
| 135 | td->o.max_bs[ddir] = max_bs; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 136 | |
| 137 | /* |
| 138 | * now sort based on percentages, for ease of lookup |
| 139 | */ |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 140 | qsort(bssplit, td->o.bssplit_nr[ddir], sizeof(struct bssplit), bs_cmp); |
| 141 | td->o.bssplit[ddir] = bssplit; |
| 142 | return 0; |
| 143 | |
| 144 | } |
| 145 | |
| 146 | static int str_bssplit_cb(void *data, const char *input) |
| 147 | { |
| 148 | struct thread_data *td = data; |
| 149 | char *str, *p, *odir; |
| 150 | int ret = 0; |
| 151 | |
| 152 | p = str = strdup(input); |
| 153 | |
| 154 | strip_blank_front(&str); |
| 155 | strip_blank_end(str); |
| 156 | |
| 157 | odir = strchr(str, ','); |
| 158 | if (odir) { |
| 159 | ret = bssplit_ddir(td, DDIR_WRITE, odir + 1); |
| 160 | if (!ret) { |
| 161 | *odir = '\0'; |
| 162 | ret = bssplit_ddir(td, DDIR_READ, str); |
| 163 | } |
| 164 | } else { |
| 165 | char *op; |
| 166 | |
| 167 | op = strdup(str); |
| 168 | |
| 169 | ret = bssplit_ddir(td, DDIR_READ, str); |
| 170 | if (!ret) |
| 171 | ret = bssplit_ddir(td, DDIR_WRITE, op); |
| 172 | |
| 173 | free(op); |
| 174 | } |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 175 | |
| 176 | free(p); |
Jens Axboe | 720e84a | 2009-04-21 08:29:55 +0200 | [diff] [blame] | 177 | return ret; |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 178 | } |
| 179 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 180 | static int str_rw_cb(void *data, const char *str) |
| 181 | { |
| 182 | struct thread_data *td = data; |
| 183 | char *nr = get_opt_postfix(str); |
| 184 | |
Jens Axboe | fafdba3 | 2007-03-26 10:09:12 +0200 | [diff] [blame] | 185 | td->o.ddir_nr = 1; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 186 | if (nr) { |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 187 | td->o.ddir_nr = atoi(nr); |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 188 | free(nr); |
| 189 | } |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 190 | |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 191 | return 0; |
| 192 | } |
| 193 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 194 | static int str_mem_cb(void *data, const char *mem) |
| 195 | { |
| 196 | struct thread_data *td = data; |
| 197 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 198 | 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] | 199 | td->mmapfile = get_opt_postfix(mem); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 200 | if (td->o.mem_type == MEM_MMAPHUGE && !td->mmapfile) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 201 | log_err("fio: mmaphuge:/path/to/file\n"); |
| 202 | return 1; |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | return 0; |
| 207 | } |
| 208 | |
| 209 | static int str_lockmem_cb(void fio_unused *data, unsigned long *val) |
| 210 | { |
| 211 | mlock_size = *val; |
| 212 | return 0; |
| 213 | } |
| 214 | |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 215 | static int str_rwmix_read_cb(void *data, unsigned int *val) |
| 216 | { |
| 217 | struct thread_data *td = data; |
| 218 | |
| 219 | td->o.rwmix[DDIR_READ] = *val; |
| 220 | td->o.rwmix[DDIR_WRITE] = 100 - *val; |
| 221 | return 0; |
| 222 | } |
| 223 | |
| 224 | static int str_rwmix_write_cb(void *data, unsigned int *val) |
| 225 | { |
| 226 | struct thread_data *td = data; |
| 227 | |
| 228 | td->o.rwmix[DDIR_WRITE] = *val; |
| 229 | td->o.rwmix[DDIR_READ] = 100 - *val; |
| 230 | return 0; |
| 231 | } |
| 232 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 233 | #ifdef FIO_HAVE_IOPRIO |
| 234 | static int str_prioclass_cb(void *data, unsigned int *val) |
| 235 | { |
| 236 | struct thread_data *td = data; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 237 | unsigned short mask; |
| 238 | |
| 239 | /* |
| 240 | * mask off old class bits, str_prio_cb() may have set a default class |
| 241 | */ |
| 242 | mask = (1 << IOPRIO_CLASS_SHIFT) - 1; |
| 243 | td->ioprio &= mask; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 244 | |
| 245 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; |
Jens Axboe | ac68478 | 2007-11-08 08:29:07 +0100 | [diff] [blame] | 246 | td->ioprio_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | static int str_prio_cb(void *data, unsigned int *val) |
| 251 | { |
| 252 | struct thread_data *td = data; |
| 253 | |
| 254 | td->ioprio |= *val; |
Jens Axboe | 6cefbe3 | 2007-04-18 12:46:56 +0200 | [diff] [blame] | 255 | |
| 256 | /* |
| 257 | * If no class is set, assume BE |
| 258 | */ |
| 259 | if ((td->ioprio >> IOPRIO_CLASS_SHIFT) == 0) |
| 260 | td->ioprio |= IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT; |
| 261 | |
Jens Axboe | ac68478 | 2007-11-08 08:29:07 +0100 | [diff] [blame] | 262 | td->ioprio_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 263 | return 0; |
| 264 | } |
| 265 | #endif |
| 266 | |
| 267 | static int str_exitall_cb(void) |
| 268 | { |
| 269 | exitall_on_terminate = 1; |
| 270 | return 0; |
| 271 | } |
| 272 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 273 | #ifdef FIO_HAVE_CPU_AFFINITY |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 274 | static int str_cpumask_cb(void *data, unsigned int *val) |
| 275 | { |
| 276 | struct thread_data *td = data; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 277 | unsigned int i; |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 278 | long max_cpu; |
Jens Axboe | d2ce18b | 2008-12-12 20:51:40 +0100 | [diff] [blame] | 279 | int ret; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 280 | |
Jens Axboe | d2ce18b | 2008-12-12 20:51:40 +0100 | [diff] [blame] | 281 | ret = fio_cpuset_init(&td->o.cpumask); |
| 282 | if (ret < 0) { |
| 283 | log_err("fio: cpuset_init failed\n"); |
| 284 | td_verror(td, ret, "fio_cpuset_init"); |
| 285 | return 1; |
| 286 | } |
| 287 | |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 288 | max_cpu = sysconf(_SC_NPROCESSORS_ONLN); |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 289 | |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 290 | for (i = 0; i < sizeof(int) * 8; i++) { |
| 291 | if ((1 << i) & *val) { |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 292 | if (i > max_cpu) { |
| 293 | log_err("fio: CPU %d too large (max=%ld)\n", i, |
| 294 | max_cpu); |
| 295 | return 1; |
| 296 | } |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 297 | dprint(FD_PARSE, "set cpu allowed %d\n", i); |
Jens Axboe | 6d459ee | 2008-12-12 20:02:58 +0100 | [diff] [blame] | 298 | fio_cpu_set(&td->o.cpumask, i); |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 299 | } |
| 300 | } |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 301 | |
Jens Axboe | 375b269 | 2007-05-22 09:13:02 +0200 | [diff] [blame] | 302 | td->o.cpumask_set = 1; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 303 | return 0; |
| 304 | } |
| 305 | |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 306 | static int set_cpus_allowed(struct thread_data *td, os_cpu_mask_t *mask, |
| 307 | const char *input) |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 308 | { |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 309 | char *cpu, *str, *p; |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 310 | long max_cpu; |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 311 | int ret = 0; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 312 | |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 313 | ret = fio_cpuset_init(mask); |
Jens Axboe | d2ce18b | 2008-12-12 20:51:40 +0100 | [diff] [blame] | 314 | if (ret < 0) { |
| 315 | log_err("fio: cpuset_init failed\n"); |
| 316 | td_verror(td, ret, "fio_cpuset_init"); |
| 317 | return 1; |
| 318 | } |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 319 | |
| 320 | p = str = strdup(input); |
| 321 | |
| 322 | strip_blank_front(&str); |
| 323 | strip_blank_end(str); |
| 324 | |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 325 | max_cpu = sysconf(_SC_NPROCESSORS_ONLN); |
| 326 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 327 | while ((cpu = strsep(&str, ",")) != NULL) { |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 328 | char *str2, *cpu2; |
| 329 | int icpu, icpu2; |
| 330 | |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 331 | if (!strlen(cpu)) |
| 332 | break; |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 333 | |
| 334 | str2 = cpu; |
| 335 | icpu2 = -1; |
| 336 | while ((cpu2 = strsep(&str2, "-")) != NULL) { |
| 337 | if (!strlen(cpu2)) |
| 338 | break; |
| 339 | |
| 340 | icpu2 = atoi(cpu2); |
| 341 | } |
| 342 | |
| 343 | icpu = atoi(cpu); |
| 344 | if (icpu2 == -1) |
| 345 | icpu2 = icpu; |
| 346 | while (icpu <= icpu2) { |
Jens Axboe | 6d459ee | 2008-12-12 20:02:58 +0100 | [diff] [blame] | 347 | if (icpu >= FIO_MAX_CPUS) { |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 348 | log_err("fio: your OS only supports up to" |
Jens Axboe | 6d459ee | 2008-12-12 20:02:58 +0100 | [diff] [blame] | 349 | " %d CPUs\n", (int) FIO_MAX_CPUS); |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 350 | ret = 1; |
| 351 | break; |
| 352 | } |
Jens Axboe | b03daaf | 2008-12-08 20:31:43 +0100 | [diff] [blame] | 353 | if (icpu > max_cpu) { |
| 354 | log_err("fio: CPU %d too large (max=%ld)\n", |
| 355 | icpu, max_cpu); |
| 356 | ret = 1; |
| 357 | break; |
| 358 | } |
| 359 | |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 360 | dprint(FD_PARSE, "set cpu allowed %d\n", icpu); |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 361 | fio_cpu_set(mask, icpu); |
Jens Axboe | 62a7273 | 2008-12-08 11:37:01 +0100 | [diff] [blame] | 362 | icpu++; |
| 363 | } |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 364 | if (ret) |
| 365 | break; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | free(p); |
Jens Axboe | 19608d6 | 2008-12-08 15:03:12 +0100 | [diff] [blame] | 369 | if (!ret) |
| 370 | td->o.cpumask_set = 1; |
| 371 | return ret; |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 372 | } |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 373 | |
| 374 | static int str_cpus_allowed_cb(void *data, const char *input) |
| 375 | { |
| 376 | struct thread_data *td = data; |
| 377 | int ret; |
| 378 | |
| 379 | ret = set_cpus_allowed(td, &td->o.cpumask, input); |
| 380 | if (!ret) |
| 381 | td->o.cpumask_set = 1; |
| 382 | |
| 383 | return ret; |
| 384 | } |
| 385 | |
| 386 | static int str_verify_cpus_allowed_cb(void *data, const char *input) |
| 387 | { |
| 388 | struct thread_data *td = data; |
| 389 | int ret; |
| 390 | |
| 391 | ret = set_cpus_allowed(td, &td->o.verify_cpumask, input); |
| 392 | if (!ret) |
| 393 | td->o.verify_cpumask_set = 1; |
| 394 | |
| 395 | return ret; |
| 396 | } |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 397 | #endif |
| 398 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 399 | static int str_fst_cb(void *data, const char *str) |
| 400 | { |
| 401 | struct thread_data *td = data; |
| 402 | char *nr = get_opt_postfix(str); |
| 403 | |
| 404 | td->file_service_nr = 1; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 405 | if (nr) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 406 | td->file_service_nr = atoi(nr); |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 407 | free(nr); |
| 408 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 409 | |
| 410 | return 0; |
| 411 | } |
| 412 | |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 413 | static int check_dir(struct thread_data *td, char *fname) |
| 414 | { |
| 415 | char file[PATH_MAX], *dir; |
Jens Axboe | bc83891 | 2008-04-07 09:00:54 +0200 | [diff] [blame] | 416 | int elen = 0; |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 417 | |
Jens Axboe | bc83891 | 2008-04-07 09:00:54 +0200 | [diff] [blame] | 418 | if (td->o.directory) { |
| 419 | strcpy(file, td->o.directory); |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 420 | strcat(file, "/"); |
Jens Axboe | bc83891 | 2008-04-07 09:00:54 +0200 | [diff] [blame] | 421 | elen = strlen(file); |
| 422 | } |
| 423 | |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 424 | sprintf(file + elen, "%s", fname); |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 425 | dir = dirname(file); |
| 426 | |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 427 | #if 0 |
| 428 | { |
| 429 | struct stat sb; |
| 430 | /* |
| 431 | * We can't do this on FIO_DISKLESSIO engines. The engine isn't loaded |
| 432 | * yet, so we can't do this check right here... |
| 433 | */ |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 434 | if (lstat(dir, &sb) < 0) { |
| 435 | int ret = errno; |
| 436 | |
| 437 | log_err("fio: %s is not a directory\n", dir); |
| 438 | td_verror(td, ret, "lstat"); |
| 439 | return 1; |
| 440 | } |
| 441 | |
| 442 | if (!S_ISDIR(sb.st_mode)) { |
| 443 | log_err("fio: %s is not a directory\n", dir); |
| 444 | return 1; |
| 445 | } |
Jens Axboe | fcef0b3 | 2008-05-26 14:53:24 +0200 | [diff] [blame] | 446 | } |
| 447 | #endif |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 448 | |
| 449 | return 0; |
| 450 | } |
| 451 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 452 | static int str_filename_cb(void *data, const char *input) |
| 453 | { |
| 454 | struct thread_data *td = data; |
| 455 | char *fname, *str, *p; |
| 456 | |
| 457 | p = str = strdup(input); |
| 458 | |
| 459 | strip_blank_front(&str); |
| 460 | strip_blank_end(str); |
| 461 | |
| 462 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 463 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 464 | |
| 465 | while ((fname = strsep(&str, ":")) != NULL) { |
| 466 | if (!strlen(fname)) |
| 467 | break; |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 468 | if (check_dir(td, fname)) { |
| 469 | free(p); |
| 470 | return 1; |
| 471 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 472 | add_file(td, fname); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 473 | td->o.nr_files++; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 474 | } |
| 475 | |
| 476 | free(p); |
| 477 | return 0; |
| 478 | } |
| 479 | |
| 480 | static int str_directory_cb(void *data, const char fio_unused *str) |
| 481 | { |
| 482 | struct thread_data *td = data; |
| 483 | struct stat sb; |
| 484 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 485 | if (lstat(td->o.directory, &sb) < 0) { |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 486 | int ret = errno; |
| 487 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 488 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 489 | td_verror(td, ret, "lstat"); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 490 | return 1; |
| 491 | } |
| 492 | if (!S_ISDIR(sb.st_mode)) { |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 493 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 494 | return 1; |
| 495 | } |
| 496 | |
| 497 | return 0; |
| 498 | } |
| 499 | |
| 500 | static int str_opendir_cb(void *data, const char fio_unused *str) |
| 501 | { |
| 502 | struct thread_data *td = data; |
| 503 | |
| 504 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 505 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 506 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 507 | return add_dir_files(td, td->o.opendir); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 508 | } |
| 509 | |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 510 | static int str_verify_offset_cb(void *data, unsigned int *off) |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 511 | { |
| 512 | struct thread_data *td = data; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 513 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 514 | if (*off && *off < sizeof(struct verify_header)) { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 515 | log_err("fio: verify_offset too small\n"); |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 516 | return 1; |
| 517 | } |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 518 | |
| 519 | td->o.verify_offset = *off; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 520 | return 0; |
| 521 | } |
| 522 | |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 523 | static int str_verify_pattern_cb(void *data, unsigned int *off) |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 524 | { |
| 525 | struct thread_data *td = data; |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 526 | unsigned int msb; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 527 | |
Jens Axboe | 3c48c2c | 2008-06-02 12:22:30 +0200 | [diff] [blame] | 528 | msb = __fls(*off); |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 529 | if (msb <= 8) |
| 530 | td->o.verify_pattern_bytes = 1; |
| 531 | else if (msb <= 16) |
| 532 | td->o.verify_pattern_bytes = 2; |
| 533 | else if (msb <= 24) |
| 534 | td->o.verify_pattern_bytes = 3; |
| 535 | else |
| 536 | td->o.verify_pattern_bytes = 4; |
| 537 | |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 538 | td->o.verify_pattern = *off; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 539 | return 0; |
| 540 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 541 | |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 542 | static int str_lockfile_cb(void *data, const char *str) |
| 543 | { |
| 544 | struct thread_data *td = data; |
| 545 | char *nr = get_opt_postfix(str); |
| 546 | |
| 547 | td->o.lockfile_batch = 1; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 548 | if (nr) { |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 549 | td->o.lockfile_batch = atoi(nr); |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 550 | free(nr); |
| 551 | } |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 552 | |
| 553 | return 0; |
| 554 | } |
| 555 | |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 556 | static int str_write_bw_log_cb(void *data, const char *str) |
| 557 | { |
| 558 | struct thread_data *td = data; |
| 559 | |
| 560 | if (str) |
| 561 | td->o.bw_log_file = strdup(str); |
| 562 | |
| 563 | td->o.write_bw_log = 1; |
| 564 | return 0; |
| 565 | } |
| 566 | |
| 567 | static int str_write_lat_log_cb(void *data, const char *str) |
| 568 | { |
| 569 | struct thread_data *td = data; |
| 570 | |
| 571 | if (str) |
| 572 | td->o.lat_log_file = strdup(str); |
| 573 | |
| 574 | td->o.write_lat_log = 1; |
| 575 | return 0; |
| 576 | } |
| 577 | |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 578 | static int str_gtod_reduce_cb(void *data, int *il) |
| 579 | { |
| 580 | struct thread_data *td = data; |
| 581 | int val = *il; |
| 582 | |
| 583 | td->o.disable_clat = !!val; |
| 584 | td->o.disable_slat = !!val; |
| 585 | td->o.disable_bw = !!val; |
| 586 | if (val) |
| 587 | td->tv_cache_mask = 63; |
| 588 | |
| 589 | return 0; |
| 590 | } |
| 591 | |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 592 | static int str_gtod_cpu_cb(void *data, int *il) |
| 593 | { |
| 594 | struct thread_data *td = data; |
| 595 | int val = *il; |
| 596 | |
| 597 | td->o.gtod_cpu = val; |
| 598 | td->o.gtod_offload = 1; |
| 599 | return 0; |
| 600 | } |
| 601 | |
Jens Axboe | 896cac2 | 2009-07-01 10:38:35 +0200 | [diff] [blame] | 602 | static int rw_verify(struct fio_option *o, void *data) |
| 603 | { |
| 604 | struct thread_data *td = data; |
| 605 | |
| 606 | if (read_only && td_write(td)) { |
| 607 | log_err("fio: job <%s> has write bit set, but fio is in" |
| 608 | " read-only mode\n", td->o.name); |
| 609 | return 1; |
| 610 | } |
| 611 | |
| 612 | return 0; |
| 613 | } |
| 614 | |
Jens Axboe | 276ca4f | 2009-07-01 10:43:05 +0200 | [diff] [blame] | 615 | static int gtod_cpu_verify(struct fio_option *o, void *data) |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 616 | { |
Jens Axboe | 276ca4f | 2009-07-01 10:43:05 +0200 | [diff] [blame] | 617 | #ifndef FIO_HAVE_CPU_AFFINITY |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 618 | struct thread_data *td = data; |
| 619 | |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 620 | if (td->o.gtod_cpu) { |
| 621 | log_err("fio: platform must support CPU affinity for" |
| 622 | "gettimeofday() offloading\n"); |
| 623 | return 1; |
| 624 | } |
| 625 | #endif |
| 626 | |
| 627 | return 0; |
| 628 | } |
| 629 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 630 | #define __stringify_1(x) #x |
| 631 | #define __stringify(x) __stringify_1(x) |
| 632 | |
| 633 | /* |
| 634 | * Map of job/command line options |
| 635 | */ |
| 636 | static struct fio_option options[] = { |
| 637 | { |
| 638 | .name = "description", |
| 639 | .type = FIO_OPT_STR_STORE, |
| 640 | .off1 = td_var_offset(description), |
| 641 | .help = "Text job description", |
| 642 | }, |
| 643 | { |
| 644 | .name = "name", |
| 645 | .type = FIO_OPT_STR_STORE, |
| 646 | .off1 = td_var_offset(name), |
| 647 | .help = "Name of this job", |
| 648 | }, |
| 649 | { |
| 650 | .name = "directory", |
| 651 | .type = FIO_OPT_STR_STORE, |
| 652 | .off1 = td_var_offset(directory), |
| 653 | .cb = str_directory_cb, |
| 654 | .help = "Directory to store files in", |
| 655 | }, |
| 656 | { |
| 657 | .name = "filename", |
| 658 | .type = FIO_OPT_STR_STORE, |
| 659 | .off1 = td_var_offset(filename), |
| 660 | .cb = str_filename_cb, |
Jens Axboe | f0d524b | 2009-04-27 08:00:48 +0200 | [diff] [blame] | 661 | .prio = -1, /* must come after "directory" */ |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 662 | .help = "File(s) to use for the workload", |
| 663 | }, |
| 664 | { |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 665 | .name = "lockfile", |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 666 | .type = FIO_OPT_STR, |
| 667 | .cb = str_lockfile_cb, |
| 668 | .off1 = td_var_offset(file_lock_mode), |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 669 | .help = "Lock file when doing IO to it", |
| 670 | .parent = "filename", |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 671 | .def = "none", |
| 672 | .posval = { |
| 673 | { .ival = "none", |
| 674 | .oval = FILE_LOCK_NONE, |
| 675 | .help = "No file locking", |
| 676 | }, |
| 677 | { .ival = "exclusive", |
| 678 | .oval = FILE_LOCK_EXCLUSIVE, |
| 679 | .help = "Exclusive file lock", |
| 680 | }, |
| 681 | { |
| 682 | .ival = "readwrite", |
| 683 | .oval = FILE_LOCK_READWRITE, |
| 684 | .help = "Read vs write lock", |
| 685 | }, |
| 686 | }, |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 687 | }, |
| 688 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 689 | .name = "opendir", |
| 690 | .type = FIO_OPT_STR_STORE, |
| 691 | .off1 = td_var_offset(opendir), |
| 692 | .cb = str_opendir_cb, |
| 693 | .help = "Recursively add files from this directory and down", |
| 694 | }, |
| 695 | { |
| 696 | .name = "rw", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 697 | .alias = "readwrite", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 698 | .type = FIO_OPT_STR, |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 699 | .cb = str_rw_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 700 | .off1 = td_var_offset(td_ddir), |
| 701 | .help = "IO direction", |
| 702 | .def = "read", |
Jens Axboe | 896cac2 | 2009-07-01 10:38:35 +0200 | [diff] [blame] | 703 | .verify = rw_verify, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 704 | .posval = { |
| 705 | { .ival = "read", |
| 706 | .oval = TD_DDIR_READ, |
| 707 | .help = "Sequential read", |
| 708 | }, |
| 709 | { .ival = "write", |
| 710 | .oval = TD_DDIR_WRITE, |
| 711 | .help = "Sequential write", |
| 712 | }, |
| 713 | { .ival = "randread", |
| 714 | .oval = TD_DDIR_RANDREAD, |
| 715 | .help = "Random read", |
| 716 | }, |
| 717 | { .ival = "randwrite", |
| 718 | .oval = TD_DDIR_RANDWRITE, |
| 719 | .help = "Random write", |
| 720 | }, |
| 721 | { .ival = "rw", |
| 722 | .oval = TD_DDIR_RW, |
| 723 | .help = "Sequential read and write mix", |
| 724 | }, |
| 725 | { .ival = "randrw", |
| 726 | .oval = TD_DDIR_RANDRW, |
| 727 | .help = "Random read and write mix" |
| 728 | }, |
| 729 | }, |
| 730 | }, |
| 731 | { |
| 732 | .name = "ioengine", |
| 733 | .type = FIO_OPT_STR_STORE, |
| 734 | .off1 = td_var_offset(ioengine), |
| 735 | .help = "IO engine to use", |
| 736 | .def = "sync", |
| 737 | .posval = { |
| 738 | { .ival = "sync", |
| 739 | .help = "Use read/write", |
| 740 | }, |
gurudas pai | a31041e | 2007-10-23 15:12:30 +0200 | [diff] [blame] | 741 | { .ival = "psync", |
| 742 | .help = "Use pread/pwrite", |
| 743 | }, |
Jens Axboe | 1d2af02 | 2008-02-04 10:59:07 +0100 | [diff] [blame] | 744 | { .ival = "vsync", |
| 745 | .help = "Use readv/writev", |
| 746 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 747 | #ifdef FIO_HAVE_LIBAIO |
| 748 | { .ival = "libaio", |
| 749 | .help = "Linux native asynchronous IO", |
| 750 | }, |
| 751 | #endif |
| 752 | #ifdef FIO_HAVE_POSIXAIO |
| 753 | { .ival = "posixaio", |
| 754 | .help = "POSIX asynchronous IO", |
| 755 | }, |
| 756 | #endif |
Jens Axboe | 417f006 | 2008-06-02 11:59:30 +0200 | [diff] [blame] | 757 | #ifdef FIO_HAVE_SOLARISAIO |
| 758 | { .ival = "solarisaio", |
| 759 | .help = "Solaris native asynchronous IO", |
| 760 | }, |
| 761 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 762 | { .ival = "mmap", |
| 763 | .help = "Memory mapped IO", |
| 764 | }, |
| 765 | #ifdef FIO_HAVE_SPLICE |
| 766 | { .ival = "splice", |
| 767 | .help = "splice/vmsplice based IO", |
| 768 | }, |
Jens Axboe | 9cce02e | 2007-06-22 15:42:21 +0200 | [diff] [blame] | 769 | { .ival = "netsplice", |
| 770 | .help = "splice/vmsplice to/from the network", |
| 771 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 772 | #endif |
| 773 | #ifdef FIO_HAVE_SGIO |
| 774 | { .ival = "sg", |
| 775 | .help = "SCSI generic v3 IO", |
| 776 | }, |
| 777 | #endif |
| 778 | { .ival = "null", |
| 779 | .help = "Testing engine (no data transfer)", |
| 780 | }, |
| 781 | { .ival = "net", |
| 782 | .help = "Network IO", |
| 783 | }, |
| 784 | #ifdef FIO_HAVE_SYSLET |
| 785 | { .ival = "syslet-rw", |
| 786 | .help = "syslet enabled async pread/pwrite IO", |
| 787 | }, |
| 788 | #endif |
| 789 | { .ival = "cpuio", |
| 790 | .help = "CPU cycler burner engine", |
| 791 | }, |
Jens Axboe | b8c82a4 | 2007-03-21 08:48:26 +0100 | [diff] [blame] | 792 | #ifdef FIO_HAVE_GUASI |
| 793 | { .ival = "guasi", |
| 794 | .help = "GUASI IO engine", |
| 795 | }, |
| 796 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 797 | { .ival = "external", |
| 798 | .help = "Load external engine (append name)", |
| 799 | }, |
| 800 | }, |
| 801 | }, |
| 802 | { |
| 803 | .name = "iodepth", |
| 804 | .type = FIO_OPT_INT, |
| 805 | .off1 = td_var_offset(iodepth), |
| 806 | .help = "Amount of IO buffers to keep in flight", |
Jens Axboe | 757aff4 | 2007-12-12 19:42:13 +0100 | [diff] [blame] | 807 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 808 | .def = "1", |
| 809 | }, |
| 810 | { |
| 811 | .name = "iodepth_batch", |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 812 | .alias = "iodepth_batch_submit", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 813 | .type = FIO_OPT_INT, |
| 814 | .off1 = td_var_offset(iodepth_batch), |
Jens Axboe | d65db44 | 2009-01-16 19:15:33 +0100 | [diff] [blame] | 815 | .help = "Number of IO buffers to submit in one go", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 816 | .parent = "iodepth", |
Jens Axboe | a2e6f8a | 2008-01-18 10:28:11 +0100 | [diff] [blame] | 817 | .minval = 1, |
| 818 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 819 | }, |
| 820 | { |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 821 | .name = "iodepth_batch_complete", |
| 822 | .type = FIO_OPT_INT, |
| 823 | .off1 = td_var_offset(iodepth_batch_complete), |
Jens Axboe | d65db44 | 2009-01-16 19:15:33 +0100 | [diff] [blame] | 824 | .help = "Number of IO buffers to retrieve in one go", |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 825 | .parent = "iodepth", |
| 826 | .minval = 0, |
| 827 | .def = "1", |
| 828 | }, |
| 829 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 830 | .name = "iodepth_low", |
| 831 | .type = FIO_OPT_INT, |
| 832 | .off1 = td_var_offset(iodepth_low), |
| 833 | .help = "Low water mark for queuing depth", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 834 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 835 | }, |
| 836 | { |
| 837 | .name = "size", |
| 838 | .type = FIO_OPT_STR_VAL, |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 839 | .off1 = td_var_offset(size), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 840 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 841 | .help = "Total size of device or files", |
| 842 | }, |
| 843 | { |
Shawn Lewis | aa31f1f | 2008-01-11 09:45:11 +0100 | [diff] [blame] | 844 | .name = "fill_device", |
| 845 | .type = FIO_OPT_BOOL, |
| 846 | .off1 = td_var_offset(fill_device), |
| 847 | .help = "Write until an ENOSPC error occurs", |
| 848 | .def = "0", |
| 849 | }, |
| 850 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 851 | .name = "filesize", |
| 852 | .type = FIO_OPT_STR_VAL, |
| 853 | .off1 = td_var_offset(file_size_low), |
| 854 | .off2 = td_var_offset(file_size_high), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 855 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 856 | .help = "Size of individual files", |
| 857 | }, |
| 858 | { |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 859 | .name = "offset", |
| 860 | .alias = "fileoffset", |
| 861 | .type = FIO_OPT_STR_VAL, |
| 862 | .off1 = td_var_offset(start_offset), |
| 863 | .help = "Start IO from this offset", |
| 864 | .def = "0", |
| 865 | }, |
| 866 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 867 | .name = "bs", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 868 | .alias = "blocksize", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 869 | .type = FIO_OPT_INT, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 870 | .off1 = td_var_offset(bs[DDIR_READ]), |
| 871 | .off2 = td_var_offset(bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 872 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 873 | .help = "Block size unit", |
| 874 | .def = "4k", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 875 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 876 | }, |
| 877 | { |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 878 | .name = "ba", |
| 879 | .alias = "blockalign", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 880 | .type = FIO_OPT_INT, |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 881 | .off1 = td_var_offset(ba[DDIR_READ]), |
| 882 | .off2 = td_var_offset(ba[DDIR_WRITE]), |
| 883 | .minval = 1, |
| 884 | .help = "IO block offset alignment", |
| 885 | .parent = "rw", |
| 886 | }, |
| 887 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 888 | .name = "bsrange", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 889 | .alias = "blocksize_range", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 890 | .type = FIO_OPT_RANGE, |
| 891 | .off1 = td_var_offset(min_bs[DDIR_READ]), |
| 892 | .off2 = td_var_offset(max_bs[DDIR_READ]), |
| 893 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), |
| 894 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 895 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 896 | .help = "Set block size range (in more detail than bs)", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 897 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 898 | }, |
| 899 | { |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 900 | .name = "bssplit", |
| 901 | .type = FIO_OPT_STR, |
| 902 | .cb = str_bssplit_cb, |
| 903 | .help = "Set a specific mix of block sizes", |
| 904 | .parent = "rw", |
| 905 | }, |
| 906 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 907 | .name = "bs_unaligned", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 908 | .alias = "blocksize_unaligned", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 909 | .type = FIO_OPT_STR_SET, |
| 910 | .off1 = td_var_offset(bs_unaligned), |
| 911 | .help = "Don't sector align IO buffer sizes", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 912 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 913 | }, |
| 914 | { |
| 915 | .name = "randrepeat", |
| 916 | .type = FIO_OPT_BOOL, |
| 917 | .off1 = td_var_offset(rand_repeatable), |
| 918 | .help = "Use repeatable random IO pattern", |
| 919 | .def = "1", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 920 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 921 | }, |
| 922 | { |
| 923 | .name = "norandommap", |
| 924 | .type = FIO_OPT_STR_SET, |
| 925 | .off1 = td_var_offset(norandommap), |
| 926 | .help = "Accept potential duplicate random blocks", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 927 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 928 | }, |
| 929 | { |
Jens Axboe | 2b386d2 | 2008-03-26 10:32:57 +0100 | [diff] [blame] | 930 | .name = "softrandommap", |
| 931 | .type = FIO_OPT_BOOL, |
| 932 | .off1 = td_var_offset(softrandommap), |
Jens Axboe | f66ab3c | 2008-06-05 11:48:22 +0200 | [diff] [blame] | 933 | .help = "Set norandommap if randommap allocation fails", |
Jens Axboe | 2b386d2 | 2008-03-26 10:32:57 +0100 | [diff] [blame] | 934 | .parent = "norandommap", |
| 935 | .def = "0", |
| 936 | }, |
| 937 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 938 | .name = "nrfiles", |
| 939 | .type = FIO_OPT_INT, |
| 940 | .off1 = td_var_offset(nr_files), |
| 941 | .help = "Split job workload between this number of files", |
| 942 | .def = "1", |
| 943 | }, |
| 944 | { |
| 945 | .name = "openfiles", |
| 946 | .type = FIO_OPT_INT, |
| 947 | .off1 = td_var_offset(open_files), |
| 948 | .help = "Number of files to keep open at the same time", |
| 949 | }, |
| 950 | { |
| 951 | .name = "file_service_type", |
| 952 | .type = FIO_OPT_STR, |
| 953 | .cb = str_fst_cb, |
| 954 | .off1 = td_var_offset(file_service_type), |
| 955 | .help = "How to select which file to service next", |
| 956 | .def = "roundrobin", |
| 957 | .posval = { |
| 958 | { .ival = "random", |
| 959 | .oval = FIO_FSERVICE_RANDOM, |
| 960 | .help = "Choose a file at random", |
| 961 | }, |
| 962 | { .ival = "roundrobin", |
| 963 | .oval = FIO_FSERVICE_RR, |
| 964 | .help = "Round robin select files", |
| 965 | }, |
Jens Axboe | a086c25 | 2009-03-04 08:27:37 +0100 | [diff] [blame] | 966 | { .ival = "sequential", |
| 967 | .oval = FIO_FSERVICE_SEQ, |
| 968 | .help = "Finish one file before moving to the next", |
| 969 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 970 | }, |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 971 | .parent = "nrfiles", |
| 972 | }, |
| 973 | { |
| 974 | .name = "fadvise_hint", |
| 975 | .type = FIO_OPT_BOOL, |
| 976 | .off1 = td_var_offset(fadvise_hint), |
| 977 | .help = "Use fadvise() to advise the kernel on IO pattern", |
| 978 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 979 | }, |
| 980 | { |
| 981 | .name = "fsync", |
| 982 | .type = FIO_OPT_INT, |
| 983 | .off1 = td_var_offset(fsync_blocks), |
| 984 | .help = "Issue fsync for writes every given number of blocks", |
| 985 | .def = "0", |
| 986 | }, |
| 987 | { |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 988 | .name = "fdatasync", |
| 989 | .type = FIO_OPT_INT, |
| 990 | .off1 = td_var_offset(fdatasync_blocks), |
| 991 | .help = "Issue fdatasync for writes every given number of blocks", |
| 992 | .def = "0", |
| 993 | }, |
| 994 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 995 | .name = "direct", |
| 996 | .type = FIO_OPT_BOOL, |
| 997 | .off1 = td_var_offset(odirect), |
| 998 | .help = "Use O_DIRECT IO (negates buffered)", |
| 999 | .def = "0", |
| 1000 | }, |
| 1001 | { |
| 1002 | .name = "buffered", |
| 1003 | .type = FIO_OPT_BOOL, |
| 1004 | .off1 = td_var_offset(odirect), |
| 1005 | .neg = 1, |
| 1006 | .help = "Use buffered IO (negates direct)", |
| 1007 | .def = "1", |
| 1008 | }, |
| 1009 | { |
| 1010 | .name = "overwrite", |
| 1011 | .type = FIO_OPT_BOOL, |
| 1012 | .off1 = td_var_offset(overwrite), |
| 1013 | .help = "When writing, set whether to overwrite current data", |
| 1014 | .def = "0", |
| 1015 | }, |
| 1016 | { |
| 1017 | .name = "loops", |
| 1018 | .type = FIO_OPT_INT, |
| 1019 | .off1 = td_var_offset(loops), |
| 1020 | .help = "Number of times to run the job", |
| 1021 | .def = "1", |
| 1022 | }, |
| 1023 | { |
| 1024 | .name = "numjobs", |
| 1025 | .type = FIO_OPT_INT, |
| 1026 | .off1 = td_var_offset(numjobs), |
| 1027 | .help = "Duplicate this job this many times", |
| 1028 | .def = "1", |
| 1029 | }, |
| 1030 | { |
| 1031 | .name = "startdelay", |
| 1032 | .type = FIO_OPT_INT, |
| 1033 | .off1 = td_var_offset(start_delay), |
| 1034 | .help = "Only start job when this period has passed", |
| 1035 | .def = "0", |
| 1036 | }, |
| 1037 | { |
| 1038 | .name = "runtime", |
| 1039 | .alias = "timeout", |
| 1040 | .type = FIO_OPT_STR_VAL_TIME, |
| 1041 | .off1 = td_var_offset(timeout), |
| 1042 | .help = "Stop workload when this amount of time has passed", |
| 1043 | .def = "0", |
| 1044 | }, |
| 1045 | { |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 1046 | .name = "time_based", |
| 1047 | .type = FIO_OPT_STR_SET, |
| 1048 | .off1 = td_var_offset(time_based), |
| 1049 | .help = "Keep running until runtime/timeout is met", |
| 1050 | }, |
| 1051 | { |
Jens Axboe | 721938a | 2008-09-10 09:46:16 +0200 | [diff] [blame] | 1052 | .name = "ramp_time", |
| 1053 | .type = FIO_OPT_STR_VAL_TIME, |
| 1054 | .off1 = td_var_offset(ramp_time), |
| 1055 | .help = "Ramp up time before measuring performance", |
| 1056 | }, |
| 1057 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1058 | .name = "mem", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1059 | .alias = "iomem", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1060 | .type = FIO_OPT_STR, |
| 1061 | .cb = str_mem_cb, |
| 1062 | .off1 = td_var_offset(mem_type), |
| 1063 | .help = "Backing type for IO buffers", |
| 1064 | .def = "malloc", |
| 1065 | .posval = { |
| 1066 | { .ival = "malloc", |
| 1067 | .oval = MEM_MALLOC, |
| 1068 | .help = "Use malloc(3) for IO buffers", |
| 1069 | }, |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 1070 | { .ival = "shm", |
| 1071 | .oval = MEM_SHM, |
| 1072 | .help = "Use shared memory segments for IO buffers", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1073 | }, |
| 1074 | #ifdef FIO_HAVE_HUGETLB |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 1075 | { .ival = "shmhuge", |
| 1076 | .oval = MEM_SHMHUGE, |
| 1077 | .help = "Like shm, but use huge pages", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1078 | }, |
| 1079 | #endif |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 1080 | { .ival = "mmap", |
| 1081 | .oval = MEM_MMAP, |
| 1082 | .help = "Use mmap(2) (file or anon) for IO buffers", |
| 1083 | }, |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 1084 | #ifdef FIO_HAVE_HUGETLB |
| 1085 | { .ival = "mmaphuge", |
| 1086 | .oval = MEM_MMAPHUGE, |
| 1087 | .help = "Like mmap, but use huge pages", |
| 1088 | }, |
| 1089 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1090 | }, |
| 1091 | }, |
| 1092 | { |
Jens Axboe | d529ee1 | 2009-07-01 10:33:03 +0200 | [diff] [blame] | 1093 | .name = "iomem_align", |
| 1094 | .alias = "mem_align", |
| 1095 | .type = FIO_OPT_INT, |
| 1096 | .off1 = td_var_offset(mem_align), |
| 1097 | .minval = 0, |
| 1098 | .help = "IO memory buffer offset alignment", |
| 1099 | .def = "0", |
| 1100 | .parent = "iomem", |
| 1101 | }, |
| 1102 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1103 | .name = "verify", |
| 1104 | .type = FIO_OPT_STR, |
| 1105 | .off1 = td_var_offset(verify), |
| 1106 | .help = "Verify data written", |
| 1107 | .def = "0", |
| 1108 | .posval = { |
| 1109 | { .ival = "0", |
| 1110 | .oval = VERIFY_NONE, |
| 1111 | .help = "Don't do IO verification", |
| 1112 | }, |
Jens Axboe | fcca4b5 | 2007-07-27 15:42:00 +0200 | [diff] [blame] | 1113 | { .ival = "md5", |
| 1114 | .oval = VERIFY_MD5, |
| 1115 | .help = "Use md5 checksums for verification", |
| 1116 | }, |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 1117 | { .ival = "crc64", |
| 1118 | .oval = VERIFY_CRC64, |
| 1119 | .help = "Use crc64 checksums for verification", |
| 1120 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1121 | { .ival = "crc32", |
| 1122 | .oval = VERIFY_CRC32, |
| 1123 | .help = "Use crc32 checksums for verification", |
| 1124 | }, |
Jens Axboe | af497e6 | 2008-08-04 15:40:35 +0200 | [diff] [blame] | 1125 | { .ival = "crc32c-intel", |
| 1126 | .oval = VERIFY_CRC32C_INTEL, |
| 1127 | .help = "Use hw crc32c checksums for verification", |
| 1128 | }, |
Jens Axboe | bac39e0 | 2008-06-11 20:46:19 +0200 | [diff] [blame] | 1129 | { .ival = "crc32c", |
| 1130 | .oval = VERIFY_CRC32C, |
| 1131 | .help = "Use crc32c checksums for verification", |
| 1132 | }, |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 1133 | { .ival = "crc16", |
| 1134 | .oval = VERIFY_CRC16, |
| 1135 | .help = "Use crc16 checksums for verification", |
| 1136 | }, |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 1137 | { .ival = "crc7", |
| 1138 | .oval = VERIFY_CRC7, |
| 1139 | .help = "Use crc7 checksums for verification", |
| 1140 | }, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 1141 | { .ival = "sha256", |
| 1142 | .oval = VERIFY_SHA256, |
| 1143 | .help = "Use sha256 checksums for verification", |
| 1144 | }, |
| 1145 | { .ival = "sha512", |
| 1146 | .oval = VERIFY_SHA512, |
| 1147 | .help = "Use sha512 checksums for verification", |
| 1148 | }, |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 1149 | { .ival = "meta", |
| 1150 | .oval = VERIFY_META, |
| 1151 | .help = "Use io information", |
| 1152 | }, |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 1153 | { |
| 1154 | .ival = "null", |
| 1155 | .oval = VERIFY_NULL, |
| 1156 | .help = "Pretend to verify", |
| 1157 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1158 | }, |
| 1159 | }, |
| 1160 | { |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 1161 | .name = "do_verify", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 1162 | .type = FIO_OPT_BOOL, |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 1163 | .off1 = td_var_offset(do_verify), |
| 1164 | .help = "Run verification stage after write", |
| 1165 | .def = "1", |
| 1166 | .parent = "verify", |
| 1167 | }, |
| 1168 | { |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 1169 | .name = "verifysort", |
| 1170 | .type = FIO_OPT_BOOL, |
| 1171 | .off1 = td_var_offset(verifysort), |
| 1172 | .help = "Sort written verify blocks for read back", |
| 1173 | .def = "1", |
Jens Axboe | c83f2df | 2007-07-31 22:51:47 +0200 | [diff] [blame] | 1174 | .parent = "verify", |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 1175 | }, |
| 1176 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1177 | .name = "verify_interval", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1178 | .type = FIO_OPT_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1179 | .off1 = td_var_offset(verify_interval), |
Jens Axboe | 819a968 | 2007-07-28 21:30:31 +0200 | [diff] [blame] | 1180 | .minval = 2 * sizeof(struct verify_header), |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1181 | .help = "Store verify buffer header every N bytes", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1182 | .parent = "verify", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 1183 | }, |
| 1184 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1185 | .name = "verify_offset", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1186 | .type = FIO_OPT_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1187 | .help = "Offset verify header location by N bytes", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 1188 | .def = "0", |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 1189 | .cb = str_verify_offset_cb, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1190 | .parent = "verify", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 1191 | }, |
| 1192 | { |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 1193 | .name = "verify_pattern", |
| 1194 | .type = FIO_OPT_INT, |
| 1195 | .cb = str_verify_pattern_cb, |
| 1196 | .help = "Fill pattern for IO buffers", |
| 1197 | .parent = "verify", |
| 1198 | }, |
| 1199 | { |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 1200 | .name = "verify_fatal", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 1201 | .type = FIO_OPT_BOOL, |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 1202 | .off1 = td_var_offset(verify_fatal), |
| 1203 | .def = "0", |
| 1204 | .help = "Exit on a single verify failure, don't continue", |
| 1205 | .parent = "verify", |
| 1206 | }, |
| 1207 | { |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 1208 | .name = "verify_async", |
| 1209 | .type = FIO_OPT_INT, |
| 1210 | .off1 = td_var_offset(verify_async), |
| 1211 | .def = "0", |
| 1212 | .help = "Number of async verifier threads to use", |
| 1213 | .parent = "verify", |
| 1214 | }, |
| 1215 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 1216 | { |
| 1217 | .name = "verify_async_cpus", |
| 1218 | .type = FIO_OPT_STR, |
| 1219 | .cb = str_verify_cpus_allowed_cb, |
| 1220 | .help = "Set CPUs allowed for async verify threads", |
| 1221 | .parent = "verify_async", |
| 1222 | }, |
| 1223 | #endif |
| 1224 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1225 | .name = "write_iolog", |
| 1226 | .type = FIO_OPT_STR_STORE, |
| 1227 | .off1 = td_var_offset(write_iolog_file), |
| 1228 | .help = "Store IO pattern to file", |
| 1229 | }, |
| 1230 | { |
| 1231 | .name = "read_iolog", |
| 1232 | .type = FIO_OPT_STR_STORE, |
| 1233 | .off1 = td_var_offset(read_iolog_file), |
| 1234 | .help = "Playback IO pattern from file", |
| 1235 | }, |
| 1236 | { |
| 1237 | .name = "exec_prerun", |
| 1238 | .type = FIO_OPT_STR_STORE, |
| 1239 | .off1 = td_var_offset(exec_prerun), |
| 1240 | .help = "Execute this file prior to running job", |
| 1241 | }, |
| 1242 | { |
| 1243 | .name = "exec_postrun", |
| 1244 | .type = FIO_OPT_STR_STORE, |
| 1245 | .off1 = td_var_offset(exec_postrun), |
| 1246 | .help = "Execute this file after running job", |
| 1247 | }, |
| 1248 | #ifdef FIO_HAVE_IOSCHED_SWITCH |
| 1249 | { |
| 1250 | .name = "ioscheduler", |
| 1251 | .type = FIO_OPT_STR_STORE, |
| 1252 | .off1 = td_var_offset(ioscheduler), |
| 1253 | .help = "Use this IO scheduler on the backing device", |
| 1254 | }, |
| 1255 | #endif |
| 1256 | { |
| 1257 | .name = "zonesize", |
| 1258 | .type = FIO_OPT_STR_VAL, |
| 1259 | .off1 = td_var_offset(zone_size), |
| 1260 | .help = "Give size of an IO zone", |
| 1261 | .def = "0", |
| 1262 | }, |
| 1263 | { |
| 1264 | .name = "zoneskip", |
| 1265 | .type = FIO_OPT_STR_VAL, |
| 1266 | .off1 = td_var_offset(zone_skip), |
| 1267 | .help = "Space between IO zones", |
| 1268 | .def = "0", |
| 1269 | }, |
| 1270 | { |
| 1271 | .name = "lockmem", |
| 1272 | .type = FIO_OPT_STR_VAL, |
| 1273 | .cb = str_lockmem_cb, |
| 1274 | .help = "Lock down this amount of memory", |
| 1275 | .def = "0", |
| 1276 | }, |
| 1277 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1278 | .name = "rwmixread", |
| 1279 | .type = FIO_OPT_INT, |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 1280 | .cb = str_rwmix_read_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1281 | .maxval = 100, |
| 1282 | .help = "Percentage of mixed workload that is reads", |
| 1283 | .def = "50", |
| 1284 | }, |
| 1285 | { |
| 1286 | .name = "rwmixwrite", |
| 1287 | .type = FIO_OPT_INT, |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 1288 | .cb = str_rwmix_write_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1289 | .maxval = 100, |
| 1290 | .help = "Percentage of mixed workload that is writes", |
| 1291 | .def = "50", |
| 1292 | }, |
| 1293 | { |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1294 | .name = "rwmixcycle", |
Jens Axboe | 15ca150 | 2008-04-07 09:26:02 +0200 | [diff] [blame] | 1295 | .type = FIO_OPT_DEPRECATED, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1296 | }, |
| 1297 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1298 | .name = "nice", |
| 1299 | .type = FIO_OPT_INT, |
| 1300 | .off1 = td_var_offset(nice), |
| 1301 | .help = "Set job CPU nice value", |
| 1302 | .minval = -19, |
| 1303 | .maxval = 20, |
| 1304 | .def = "0", |
| 1305 | }, |
| 1306 | #ifdef FIO_HAVE_IOPRIO |
| 1307 | { |
| 1308 | .name = "prio", |
| 1309 | .type = FIO_OPT_INT, |
| 1310 | .cb = str_prio_cb, |
| 1311 | .help = "Set job IO priority value", |
| 1312 | .minval = 0, |
| 1313 | .maxval = 7, |
| 1314 | }, |
| 1315 | { |
| 1316 | .name = "prioclass", |
| 1317 | .type = FIO_OPT_INT, |
| 1318 | .cb = str_prioclass_cb, |
| 1319 | .help = "Set job IO priority class", |
| 1320 | .minval = 0, |
| 1321 | .maxval = 3, |
| 1322 | }, |
| 1323 | #endif |
| 1324 | { |
| 1325 | .name = "thinktime", |
| 1326 | .type = FIO_OPT_INT, |
| 1327 | .off1 = td_var_offset(thinktime), |
| 1328 | .help = "Idle time between IO buffers (usec)", |
| 1329 | .def = "0", |
| 1330 | }, |
| 1331 | { |
| 1332 | .name = "thinktime_spin", |
| 1333 | .type = FIO_OPT_INT, |
| 1334 | .off1 = td_var_offset(thinktime_spin), |
| 1335 | .help = "Start think time by spinning this amount (usec)", |
| 1336 | .def = "0", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1337 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1338 | }, |
| 1339 | { |
| 1340 | .name = "thinktime_blocks", |
| 1341 | .type = FIO_OPT_INT, |
| 1342 | .off1 = td_var_offset(thinktime_blocks), |
| 1343 | .help = "IO buffer period between 'thinktime'", |
| 1344 | .def = "1", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1345 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1346 | }, |
| 1347 | { |
| 1348 | .name = "rate", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1349 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1350 | .off1 = td_var_offset(rate[0]), |
| 1351 | .off2 = td_var_offset(rate[1]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1352 | .help = "Set bandwidth rate", |
| 1353 | }, |
| 1354 | { |
| 1355 | .name = "ratemin", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1356 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1357 | .off1 = td_var_offset(ratemin[0]), |
| 1358 | .off2 = td_var_offset(ratemin[1]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1359 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1360 | .parent = "rate", |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1361 | }, |
| 1362 | { |
| 1363 | .name = "rate_iops", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1364 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1365 | .off1 = td_var_offset(rate_iops[0]), |
| 1366 | .off2 = td_var_offset(rate_iops[1]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1367 | .help = "Limit IO used to this number of IO operations/sec", |
| 1368 | }, |
| 1369 | { |
| 1370 | .name = "rate_iops_min", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1371 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1372 | .off1 = td_var_offset(rate_iops_min[0]), |
| 1373 | .off2 = td_var_offset(rate_iops_min[1]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1374 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1375 | .parent = "rate_iops", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1376 | }, |
| 1377 | { |
| 1378 | .name = "ratecycle", |
| 1379 | .type = FIO_OPT_INT, |
| 1380 | .off1 = td_var_offset(ratecycle), |
| 1381 | .help = "Window average for rate limits (msec)", |
| 1382 | .def = "1000", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1383 | .parent = "rate", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1384 | }, |
| 1385 | { |
| 1386 | .name = "invalidate", |
| 1387 | .type = FIO_OPT_BOOL, |
| 1388 | .off1 = td_var_offset(invalidate_cache), |
| 1389 | .help = "Invalidate buffer/page cache prior to running job", |
| 1390 | .def = "1", |
| 1391 | }, |
| 1392 | { |
| 1393 | .name = "sync", |
| 1394 | .type = FIO_OPT_BOOL, |
| 1395 | .off1 = td_var_offset(sync_io), |
| 1396 | .help = "Use O_SYNC for buffered writes", |
| 1397 | .def = "0", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1398 | .parent = "buffered", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1399 | }, |
| 1400 | { |
| 1401 | .name = "bwavgtime", |
| 1402 | .type = FIO_OPT_INT, |
| 1403 | .off1 = td_var_offset(bw_avg_time), |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 1404 | .help = "Time window over which to calculate bandwidth" |
| 1405 | " (msec)", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1406 | .def = "500", |
| 1407 | }, |
| 1408 | { |
| 1409 | .name = "create_serialize", |
| 1410 | .type = FIO_OPT_BOOL, |
| 1411 | .off1 = td_var_offset(create_serialize), |
| 1412 | .help = "Serialize creating of job files", |
| 1413 | .def = "1", |
| 1414 | }, |
| 1415 | { |
| 1416 | .name = "create_fsync", |
| 1417 | .type = FIO_OPT_BOOL, |
| 1418 | .off1 = td_var_offset(create_fsync), |
| 1419 | .help = "Fsync file after creation", |
| 1420 | .def = "1", |
| 1421 | }, |
| 1422 | { |
Jens Axboe | 814452b | 2009-03-04 12:53:13 +0100 | [diff] [blame] | 1423 | .name = "create_on_open", |
| 1424 | .type = FIO_OPT_BOOL, |
| 1425 | .off1 = td_var_offset(create_on_open), |
| 1426 | .help = "Create files when they are opened for IO", |
| 1427 | .def = "0", |
| 1428 | }, |
Zhang, Yanmin | afad68f | 2009-05-20 11:30:55 +0200 | [diff] [blame] | 1429 | { |
| 1430 | .name = "pre_read", |
| 1431 | .type = FIO_OPT_BOOL, |
| 1432 | .off1 = td_var_offset(pre_read), |
| 1433 | .help = "Preread files before starting official testing", |
| 1434 | .def = "0", |
| 1435 | }, |
Jens Axboe | 814452b | 2009-03-04 12:53:13 +0100 | [diff] [blame] | 1436 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1437 | .name = "cpuload", |
| 1438 | .type = FIO_OPT_INT, |
| 1439 | .off1 = td_var_offset(cpuload), |
| 1440 | .help = "Use this percentage of CPU", |
| 1441 | }, |
| 1442 | { |
| 1443 | .name = "cpuchunks", |
| 1444 | .type = FIO_OPT_INT, |
| 1445 | .off1 = td_var_offset(cpucycle), |
| 1446 | .help = "Length of the CPU burn cycles (usecs)", |
| 1447 | .def = "50000", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1448 | .parent = "cpuload", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1449 | }, |
| 1450 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 1451 | { |
| 1452 | .name = "cpumask", |
| 1453 | .type = FIO_OPT_INT, |
| 1454 | .cb = str_cpumask_cb, |
| 1455 | .help = "CPU affinity mask", |
| 1456 | }, |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 1457 | { |
| 1458 | .name = "cpus_allowed", |
| 1459 | .type = FIO_OPT_STR, |
| 1460 | .cb = str_cpus_allowed_cb, |
| 1461 | .help = "Set CPUs allowed", |
| 1462 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1463 | #endif |
| 1464 | { |
| 1465 | .name = "end_fsync", |
| 1466 | .type = FIO_OPT_BOOL, |
| 1467 | .off1 = td_var_offset(end_fsync), |
| 1468 | .help = "Include fsync at the end of job", |
| 1469 | .def = "0", |
| 1470 | }, |
| 1471 | { |
| 1472 | .name = "fsync_on_close", |
| 1473 | .type = FIO_OPT_BOOL, |
| 1474 | .off1 = td_var_offset(fsync_on_close), |
| 1475 | .help = "fsync files on close", |
| 1476 | .def = "0", |
| 1477 | }, |
| 1478 | { |
| 1479 | .name = "unlink", |
| 1480 | .type = FIO_OPT_BOOL, |
| 1481 | .off1 = td_var_offset(unlink), |
| 1482 | .help = "Unlink created files after job has completed", |
| 1483 | .def = "0", |
| 1484 | }, |
| 1485 | { |
| 1486 | .name = "exitall", |
| 1487 | .type = FIO_OPT_STR_SET, |
| 1488 | .cb = str_exitall_cb, |
| 1489 | .help = "Terminate all jobs when one exits", |
| 1490 | }, |
| 1491 | { |
| 1492 | .name = "stonewall", |
| 1493 | .type = FIO_OPT_STR_SET, |
| 1494 | .off1 = td_var_offset(stonewall), |
| 1495 | .help = "Insert a hard barrier between this job and previous", |
| 1496 | }, |
| 1497 | { |
Jens Axboe | b3d62a7 | 2007-03-20 14:23:26 +0100 | [diff] [blame] | 1498 | .name = "new_group", |
| 1499 | .type = FIO_OPT_STR_SET, |
| 1500 | .off1 = td_var_offset(new_group), |
| 1501 | .help = "Mark the start of a new group (for reporting)", |
| 1502 | }, |
| 1503 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1504 | .name = "thread", |
| 1505 | .type = FIO_OPT_STR_SET, |
| 1506 | .off1 = td_var_offset(use_thread), |
| 1507 | .help = "Use threads instead of forks", |
| 1508 | }, |
| 1509 | { |
| 1510 | .name = "write_bw_log", |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1511 | .type = FIO_OPT_STR, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1512 | .off1 = td_var_offset(write_bw_log), |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1513 | .cb = str_write_bw_log_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1514 | .help = "Write log of bandwidth during run", |
| 1515 | }, |
| 1516 | { |
| 1517 | .name = "write_lat_log", |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1518 | .type = FIO_OPT_STR, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1519 | .off1 = td_var_offset(write_lat_log), |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1520 | .cb = str_write_lat_log_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1521 | .help = "Write log of latency during run", |
| 1522 | }, |
| 1523 | { |
| 1524 | .name = "hugepage-size", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1525 | .type = FIO_OPT_INT, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1526 | .off1 = td_var_offset(hugepage_size), |
| 1527 | .help = "When using hugepages, specify size of each page", |
| 1528 | .def = __stringify(FIO_HUGE_PAGE), |
| 1529 | }, |
| 1530 | { |
| 1531 | .name = "group_reporting", |
| 1532 | .type = FIO_OPT_STR_SET, |
| 1533 | .off1 = td_var_offset(group_reporting), |
| 1534 | .help = "Do reporting on a per-group basis", |
| 1535 | }, |
| 1536 | { |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 1537 | .name = "zero_buffers", |
| 1538 | .type = FIO_OPT_STR_SET, |
| 1539 | .off1 = td_var_offset(zero_buffers), |
| 1540 | .help = "Init IO buffers to all zeroes", |
| 1541 | }, |
Jens Axboe | 5973caf | 2008-05-21 19:52:35 +0200 | [diff] [blame] | 1542 | { |
| 1543 | .name = "refill_buffers", |
| 1544 | .type = FIO_OPT_STR_SET, |
| 1545 | .off1 = td_var_offset(refill_buffers), |
| 1546 | .help = "Refill IO buffers on every IO submit", |
| 1547 | }, |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 1548 | #ifdef FIO_HAVE_DISK_UTIL |
| 1549 | { |
| 1550 | .name = "disk_util", |
| 1551 | .type = FIO_OPT_BOOL, |
| 1552 | .off1 = td_var_offset(do_disk_util), |
Jens Axboe | f66ab3c | 2008-06-05 11:48:22 +0200 | [diff] [blame] | 1553 | .help = "Log disk utilization statistics", |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 1554 | .def = "1", |
| 1555 | }, |
| 1556 | #endif |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 1557 | { |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1558 | .name = "gtod_reduce", |
| 1559 | .type = FIO_OPT_BOOL, |
| 1560 | .help = "Greatly reduce number of gettimeofday() calls", |
| 1561 | .cb = str_gtod_reduce_cb, |
| 1562 | .def = "0", |
| 1563 | }, |
| 1564 | { |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1565 | .name = "disable_clat", |
| 1566 | .type = FIO_OPT_BOOL, |
| 1567 | .off1 = td_var_offset(disable_clat), |
| 1568 | .help = "Disable completion latency numbers", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1569 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1570 | .def = "0", |
| 1571 | }, |
| 1572 | { |
| 1573 | .name = "disable_slat", |
| 1574 | .type = FIO_OPT_BOOL, |
| 1575 | .off1 = td_var_offset(disable_slat), |
| 1576 | .help = "Disable submissionn latency numbers", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1577 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1578 | .def = "0", |
| 1579 | }, |
| 1580 | { |
| 1581 | .name = "disable_bw_measurement", |
| 1582 | .type = FIO_OPT_BOOL, |
| 1583 | .off1 = td_var_offset(disable_bw), |
| 1584 | .help = "Disable bandwidth logging", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1585 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1586 | .def = "0", |
| 1587 | }, |
| 1588 | { |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 1589 | .name = "gtod_cpu", |
| 1590 | .type = FIO_OPT_INT, |
| 1591 | .cb = str_gtod_cpu_cb, |
| 1592 | .help = "Setup dedicated gettimeofday() thread on this CPU", |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 1593 | .verify = gtod_cpu_verify, |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 1594 | }, |
| 1595 | { |
Radha Ramachandran | f2bba18 | 2009-06-15 08:40:16 +0200 | [diff] [blame] | 1596 | .name = "continue_on_error", |
| 1597 | .type = FIO_OPT_BOOL, |
| 1598 | .off1 = td_var_offset(continue_on_error), |
| 1599 | .help = "Continue on non-fatal errors during I/O", |
| 1600 | .def = "0", |
| 1601 | }, |
| 1602 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1603 | .name = NULL, |
| 1604 | }, |
| 1605 | }; |
| 1606 | |
| 1607 | void fio_options_dup_and_init(struct option *long_options) |
| 1608 | { |
| 1609 | struct fio_option *o; |
| 1610 | unsigned int i; |
| 1611 | |
| 1612 | options_init(options); |
| 1613 | |
| 1614 | i = 0; |
| 1615 | while (long_options[i].name) |
| 1616 | i++; |
| 1617 | |
| 1618 | o = &options[0]; |
| 1619 | while (o->name) { |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 1620 | long_options[i].name = (char *) o->name; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1621 | long_options[i].val = FIO_GETOPT_JOB; |
| 1622 | if (o->type == FIO_OPT_STR_SET) |
| 1623 | long_options[i].has_arg = no_argument; |
| 1624 | else |
| 1625 | long_options[i].has_arg = required_argument; |
| 1626 | |
| 1627 | i++; |
| 1628 | o++; |
| 1629 | assert(i < FIO_NR_OPTIONS); |
| 1630 | } |
| 1631 | } |
| 1632 | |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 1633 | 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] | 1634 | { |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 1635 | int i, ret; |
| 1636 | |
| 1637 | sort_options(opts, options, num_opts); |
| 1638 | |
| 1639 | for (ret = 0, i = 0; i < num_opts; i++) |
| 1640 | ret |= parse_option(opts[i], options, td); |
| 1641 | |
| 1642 | return ret; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1643 | } |
| 1644 | |
| 1645 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) |
| 1646 | { |
| 1647 | return parse_cmd_option(opt, val, options, td); |
| 1648 | } |
| 1649 | |
| 1650 | void fio_fill_default_options(struct thread_data *td) |
| 1651 | { |
| 1652 | fill_default_options(td, options); |
| 1653 | } |
| 1654 | |
| 1655 | int fio_show_option_help(const char *opt) |
| 1656 | { |
| 1657 | return show_cmd_help(options, opt); |
| 1658 | } |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1659 | |
| 1660 | static void __options_mem(struct thread_data *td, int alloc) |
| 1661 | { |
| 1662 | struct thread_options *o = &td->o; |
| 1663 | struct fio_option *opt; |
| 1664 | char **ptr; |
| 1665 | int i; |
| 1666 | |
| 1667 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { |
| 1668 | if (opt->type != FIO_OPT_STR_STORE) |
| 1669 | continue; |
| 1670 | |
| 1671 | ptr = (void *) o + opt->off1; |
| 1672 | if (*ptr) { |
| 1673 | if (alloc) |
| 1674 | *ptr = strdup(*ptr); |
| 1675 | else { |
| 1676 | free(*ptr); |
| 1677 | *ptr = NULL; |
| 1678 | } |
| 1679 | } |
| 1680 | } |
| 1681 | } |
| 1682 | |
| 1683 | /* |
| 1684 | * dupe FIO_OPT_STR_STORE options |
| 1685 | */ |
| 1686 | void options_mem_dupe(struct thread_data *td) |
| 1687 | { |
| 1688 | __options_mem(td, 1); |
| 1689 | } |
| 1690 | |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1691 | void options_mem_free(struct thread_data fio_unused *td) |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1692 | { |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1693 | #if 0 |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1694 | __options_mem(td, 0); |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1695 | #endif |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1696 | } |