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 | |
Jens Axboe | d6978a3 | 2009-07-18 21:04:09 +0200 | [diff] [blame] | 85 | if (str_to_decimal(fname, &val, 1, &td)) { |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 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 | } |
Jens Axboe | 0b9d69e | 2009-09-11 22:29:54 +0200 | [diff] [blame^] | 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 | 8e827d3 | 2009-08-04 09:51:48 +0200 | [diff] [blame] | 452 | /* |
| 453 | * Return next file in the string. Files are separated with ':'. If the ':' |
| 454 | * is escaped with a '\', then that ':' is part of the filename and does not |
| 455 | * indicate a new file. |
| 456 | */ |
| 457 | static char *get_next_file_name(char **ptr) |
| 458 | { |
| 459 | char *str = *ptr; |
| 460 | char *p, *start; |
| 461 | |
| 462 | if (!str || !strlen(str)) |
| 463 | return NULL; |
| 464 | |
| 465 | start = str; |
| 466 | do { |
| 467 | /* |
| 468 | * No colon, we are done |
| 469 | */ |
| 470 | p = strchr(str, ':'); |
| 471 | if (!p) { |
| 472 | *ptr = NULL; |
| 473 | break; |
| 474 | } |
| 475 | |
| 476 | /* |
| 477 | * We got a colon, but it's the first character. Skip and |
| 478 | * continue |
| 479 | */ |
| 480 | if (p == start) { |
| 481 | str = ++start; |
| 482 | continue; |
| 483 | } |
| 484 | |
| 485 | if (*(p - 1) != '\\') { |
| 486 | *p = '\0'; |
| 487 | *ptr = p + 1; |
| 488 | break; |
| 489 | } |
| 490 | |
| 491 | memmove(p - 1, p, strlen(p) + 1); |
| 492 | str = p; |
| 493 | } while (1); |
| 494 | |
| 495 | return start; |
| 496 | } |
| 497 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 498 | static int str_filename_cb(void *data, const char *input) |
| 499 | { |
| 500 | struct thread_data *td = data; |
| 501 | char *fname, *str, *p; |
| 502 | |
| 503 | p = str = strdup(input); |
| 504 | |
| 505 | strip_blank_front(&str); |
| 506 | strip_blank_end(str); |
| 507 | |
| 508 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 509 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 510 | |
Jens Axboe | 8e827d3 | 2009-08-04 09:51:48 +0200 | [diff] [blame] | 511 | while ((fname = get_next_file_name(&str)) != NULL) { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 512 | if (!strlen(fname)) |
| 513 | break; |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 514 | if (check_dir(td, fname)) { |
| 515 | free(p); |
| 516 | return 1; |
| 517 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 518 | add_file(td, fname); |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 519 | td->o.nr_files++; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 520 | } |
| 521 | |
| 522 | free(p); |
| 523 | return 0; |
| 524 | } |
| 525 | |
| 526 | static int str_directory_cb(void *data, const char fio_unused *str) |
| 527 | { |
| 528 | struct thread_data *td = data; |
| 529 | struct stat sb; |
| 530 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 531 | if (lstat(td->o.directory, &sb) < 0) { |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 532 | int ret = errno; |
| 533 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 534 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 921c766 | 2008-03-26 09:17:55 +0100 | [diff] [blame] | 535 | td_verror(td, ret, "lstat"); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 536 | return 1; |
| 537 | } |
| 538 | if (!S_ISDIR(sb.st_mode)) { |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 539 | log_err("fio: %s is not a directory\n", td->o.directory); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 540 | return 1; |
| 541 | } |
| 542 | |
| 543 | return 0; |
| 544 | } |
| 545 | |
| 546 | static int str_opendir_cb(void *data, const char fio_unused *str) |
| 547 | { |
| 548 | struct thread_data *td = data; |
| 549 | |
| 550 | if (!td->files_index) |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 551 | td->o.nr_files = 0; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 552 | |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 553 | return add_dir_files(td, td->o.opendir); |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 554 | } |
| 555 | |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 556 | static int str_verify_offset_cb(void *data, unsigned int *off) |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 557 | { |
| 558 | struct thread_data *td = data; |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 559 | |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 560 | if (*off && *off < sizeof(struct verify_header)) { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 561 | log_err("fio: verify_offset too small\n"); |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 562 | return 1; |
| 563 | } |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 564 | |
| 565 | td->o.verify_offset = *off; |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 566 | return 0; |
| 567 | } |
| 568 | |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 569 | static int str_verify_pattern_cb(void *data, unsigned int *off) |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 570 | { |
| 571 | struct thread_data *td = data; |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 572 | unsigned int msb; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 573 | |
Jens Axboe | 3c48c2c | 2008-06-02 12:22:30 +0200 | [diff] [blame] | 574 | msb = __fls(*off); |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 575 | if (msb <= 8) |
| 576 | td->o.verify_pattern_bytes = 1; |
| 577 | else if (msb <= 16) |
| 578 | td->o.verify_pattern_bytes = 2; |
| 579 | else if (msb <= 24) |
| 580 | td->o.verify_pattern_bytes = 3; |
| 581 | else |
| 582 | td->o.verify_pattern_bytes = 4; |
| 583 | |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 584 | td->o.verify_pattern = *off; |
Jens Axboe | 90059d6 | 2007-07-30 09:33:12 +0200 | [diff] [blame] | 585 | return 0; |
| 586 | } |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 587 | |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 588 | static int str_lockfile_cb(void *data, const char *str) |
| 589 | { |
| 590 | struct thread_data *td = data; |
| 591 | char *nr = get_opt_postfix(str); |
| 592 | |
| 593 | td->o.lockfile_batch = 1; |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 594 | if (nr) { |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 595 | td->o.lockfile_batch = atoi(nr); |
Jens Axboe | 182ec6e | 2008-11-14 13:06:06 +0100 | [diff] [blame] | 596 | free(nr); |
| 597 | } |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 598 | |
| 599 | return 0; |
| 600 | } |
| 601 | |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 602 | static int str_write_bw_log_cb(void *data, const char *str) |
| 603 | { |
| 604 | struct thread_data *td = data; |
| 605 | |
| 606 | if (str) |
| 607 | td->o.bw_log_file = strdup(str); |
| 608 | |
| 609 | td->o.write_bw_log = 1; |
| 610 | return 0; |
| 611 | } |
| 612 | |
| 613 | static int str_write_lat_log_cb(void *data, const char *str) |
| 614 | { |
| 615 | struct thread_data *td = data; |
| 616 | |
| 617 | if (str) |
| 618 | td->o.lat_log_file = strdup(str); |
| 619 | |
| 620 | td->o.write_lat_log = 1; |
| 621 | return 0; |
| 622 | } |
| 623 | |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 624 | static int str_gtod_reduce_cb(void *data, int *il) |
| 625 | { |
| 626 | struct thread_data *td = data; |
| 627 | int val = *il; |
| 628 | |
| 629 | td->o.disable_clat = !!val; |
| 630 | td->o.disable_slat = !!val; |
| 631 | td->o.disable_bw = !!val; |
| 632 | if (val) |
| 633 | td->tv_cache_mask = 63; |
| 634 | |
| 635 | return 0; |
| 636 | } |
| 637 | |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 638 | static int str_gtod_cpu_cb(void *data, int *il) |
| 639 | { |
| 640 | struct thread_data *td = data; |
| 641 | int val = *il; |
| 642 | |
| 643 | td->o.gtod_cpu = val; |
| 644 | td->o.gtod_offload = 1; |
| 645 | return 0; |
| 646 | } |
| 647 | |
Jens Axboe | 896cac2 | 2009-07-01 10:38:35 +0200 | [diff] [blame] | 648 | static int rw_verify(struct fio_option *o, void *data) |
| 649 | { |
| 650 | struct thread_data *td = data; |
| 651 | |
| 652 | if (read_only && td_write(td)) { |
| 653 | log_err("fio: job <%s> has write bit set, but fio is in" |
| 654 | " read-only mode\n", td->o.name); |
| 655 | return 1; |
| 656 | } |
| 657 | |
| 658 | return 0; |
| 659 | } |
| 660 | |
Jens Axboe | 276ca4f | 2009-07-01 10:43:05 +0200 | [diff] [blame] | 661 | static int gtod_cpu_verify(struct fio_option *o, void *data) |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 662 | { |
Jens Axboe | 276ca4f | 2009-07-01 10:43:05 +0200 | [diff] [blame] | 663 | #ifndef FIO_HAVE_CPU_AFFINITY |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 664 | struct thread_data *td = data; |
| 665 | |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 666 | if (td->o.gtod_cpu) { |
| 667 | log_err("fio: platform must support CPU affinity for" |
| 668 | "gettimeofday() offloading\n"); |
| 669 | return 1; |
| 670 | } |
| 671 | #endif |
| 672 | |
| 673 | return 0; |
| 674 | } |
| 675 | |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 676 | static int kb_base_verify(struct fio_option *o, void *data) |
| 677 | { |
| 678 | struct thread_data *td = data; |
| 679 | |
| 680 | if (td->o.kb_base != 1024 && td->o.kb_base != 1000) { |
| 681 | log_err("fio: kb_base set to nonsensical value: %u\n", |
| 682 | td->o.kb_base); |
| 683 | return 1; |
| 684 | } |
| 685 | |
| 686 | return 0; |
| 687 | } |
| 688 | |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 689 | #define __stringify_1(x) #x |
| 690 | #define __stringify(x) __stringify_1(x) |
| 691 | |
| 692 | /* |
| 693 | * Map of job/command line options |
| 694 | */ |
| 695 | static struct fio_option options[] = { |
| 696 | { |
| 697 | .name = "description", |
| 698 | .type = FIO_OPT_STR_STORE, |
| 699 | .off1 = td_var_offset(description), |
| 700 | .help = "Text job description", |
| 701 | }, |
| 702 | { |
| 703 | .name = "name", |
| 704 | .type = FIO_OPT_STR_STORE, |
| 705 | .off1 = td_var_offset(name), |
| 706 | .help = "Name of this job", |
| 707 | }, |
| 708 | { |
| 709 | .name = "directory", |
| 710 | .type = FIO_OPT_STR_STORE, |
| 711 | .off1 = td_var_offset(directory), |
| 712 | .cb = str_directory_cb, |
| 713 | .help = "Directory to store files in", |
| 714 | }, |
| 715 | { |
| 716 | .name = "filename", |
| 717 | .type = FIO_OPT_STR_STORE, |
| 718 | .off1 = td_var_offset(filename), |
| 719 | .cb = str_filename_cb, |
Jens Axboe | f0d524b | 2009-04-27 08:00:48 +0200 | [diff] [blame] | 720 | .prio = -1, /* must come after "directory" */ |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 721 | .help = "File(s) to use for the workload", |
| 722 | }, |
| 723 | { |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 724 | .name = "kb_base", |
| 725 | .type = FIO_OPT_INT, |
| 726 | .off1 = td_var_offset(kb_base), |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 727 | .verify = kb_base_verify, |
Jens Axboe | a639f0b | 2009-07-18 08:25:35 +0200 | [diff] [blame] | 728 | .prio = 1, |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 729 | .def = "1024", |
Jens Axboe | a639f0b | 2009-07-18 08:25:35 +0200 | [diff] [blame] | 730 | .help = "How many bytes per KB for reporting (1000 or 1024)", |
Jens Axboe | 90fef2d | 2009-07-17 22:33:32 +0200 | [diff] [blame] | 731 | }, |
| 732 | { |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 733 | .name = "lockfile", |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 734 | .type = FIO_OPT_STR, |
| 735 | .cb = str_lockfile_cb, |
| 736 | .off1 = td_var_offset(file_lock_mode), |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 737 | .help = "Lock file when doing IO to it", |
| 738 | .parent = "filename", |
Jens Axboe | 4d4e80f | 2008-03-04 10:18:56 +0100 | [diff] [blame] | 739 | .def = "none", |
| 740 | .posval = { |
| 741 | { .ival = "none", |
| 742 | .oval = FILE_LOCK_NONE, |
| 743 | .help = "No file locking", |
| 744 | }, |
| 745 | { .ival = "exclusive", |
| 746 | .oval = FILE_LOCK_EXCLUSIVE, |
| 747 | .help = "Exclusive file lock", |
| 748 | }, |
| 749 | { |
| 750 | .ival = "readwrite", |
| 751 | .oval = FILE_LOCK_READWRITE, |
| 752 | .help = "Read vs write lock", |
| 753 | }, |
| 754 | }, |
Jens Axboe | 29c1349 | 2008-03-01 19:25:20 +0100 | [diff] [blame] | 755 | }, |
| 756 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 757 | .name = "opendir", |
| 758 | .type = FIO_OPT_STR_STORE, |
| 759 | .off1 = td_var_offset(opendir), |
| 760 | .cb = str_opendir_cb, |
| 761 | .help = "Recursively add files from this directory and down", |
| 762 | }, |
| 763 | { |
| 764 | .name = "rw", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 765 | .alias = "readwrite", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 766 | .type = FIO_OPT_STR, |
Jens Axboe | 211097b | 2007-03-22 18:56:45 +0100 | [diff] [blame] | 767 | .cb = str_rw_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 768 | .off1 = td_var_offset(td_ddir), |
| 769 | .help = "IO direction", |
| 770 | .def = "read", |
Jens Axboe | 896cac2 | 2009-07-01 10:38:35 +0200 | [diff] [blame] | 771 | .verify = rw_verify, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 772 | .posval = { |
| 773 | { .ival = "read", |
| 774 | .oval = TD_DDIR_READ, |
| 775 | .help = "Sequential read", |
| 776 | }, |
| 777 | { .ival = "write", |
| 778 | .oval = TD_DDIR_WRITE, |
| 779 | .help = "Sequential write", |
| 780 | }, |
| 781 | { .ival = "randread", |
| 782 | .oval = TD_DDIR_RANDREAD, |
| 783 | .help = "Random read", |
| 784 | }, |
| 785 | { .ival = "randwrite", |
| 786 | .oval = TD_DDIR_RANDWRITE, |
| 787 | .help = "Random write", |
| 788 | }, |
| 789 | { .ival = "rw", |
| 790 | .oval = TD_DDIR_RW, |
| 791 | .help = "Sequential read and write mix", |
| 792 | }, |
| 793 | { .ival = "randrw", |
| 794 | .oval = TD_DDIR_RANDRW, |
| 795 | .help = "Random read and write mix" |
| 796 | }, |
| 797 | }, |
| 798 | }, |
| 799 | { |
| 800 | .name = "ioengine", |
| 801 | .type = FIO_OPT_STR_STORE, |
| 802 | .off1 = td_var_offset(ioengine), |
| 803 | .help = "IO engine to use", |
| 804 | .def = "sync", |
| 805 | .posval = { |
| 806 | { .ival = "sync", |
| 807 | .help = "Use read/write", |
| 808 | }, |
gurudas pai | a31041e | 2007-10-23 15:12:30 +0200 | [diff] [blame] | 809 | { .ival = "psync", |
| 810 | .help = "Use pread/pwrite", |
| 811 | }, |
Jens Axboe | 1d2af02 | 2008-02-04 10:59:07 +0100 | [diff] [blame] | 812 | { .ival = "vsync", |
| 813 | .help = "Use readv/writev", |
| 814 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 815 | #ifdef FIO_HAVE_LIBAIO |
| 816 | { .ival = "libaio", |
| 817 | .help = "Linux native asynchronous IO", |
| 818 | }, |
| 819 | #endif |
| 820 | #ifdef FIO_HAVE_POSIXAIO |
| 821 | { .ival = "posixaio", |
| 822 | .help = "POSIX asynchronous IO", |
| 823 | }, |
| 824 | #endif |
Jens Axboe | 417f006 | 2008-06-02 11:59:30 +0200 | [diff] [blame] | 825 | #ifdef FIO_HAVE_SOLARISAIO |
| 826 | { .ival = "solarisaio", |
| 827 | .help = "Solaris native asynchronous IO", |
| 828 | }, |
| 829 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 830 | { .ival = "mmap", |
| 831 | .help = "Memory mapped IO", |
| 832 | }, |
| 833 | #ifdef FIO_HAVE_SPLICE |
| 834 | { .ival = "splice", |
| 835 | .help = "splice/vmsplice based IO", |
| 836 | }, |
Jens Axboe | 9cce02e | 2007-06-22 15:42:21 +0200 | [diff] [blame] | 837 | { .ival = "netsplice", |
| 838 | .help = "splice/vmsplice to/from the network", |
| 839 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 840 | #endif |
| 841 | #ifdef FIO_HAVE_SGIO |
| 842 | { .ival = "sg", |
| 843 | .help = "SCSI generic v3 IO", |
| 844 | }, |
| 845 | #endif |
| 846 | { .ival = "null", |
| 847 | .help = "Testing engine (no data transfer)", |
| 848 | }, |
| 849 | { .ival = "net", |
| 850 | .help = "Network IO", |
| 851 | }, |
| 852 | #ifdef FIO_HAVE_SYSLET |
| 853 | { .ival = "syslet-rw", |
| 854 | .help = "syslet enabled async pread/pwrite IO", |
| 855 | }, |
| 856 | #endif |
| 857 | { .ival = "cpuio", |
| 858 | .help = "CPU cycler burner engine", |
| 859 | }, |
Jens Axboe | b8c82a4 | 2007-03-21 08:48:26 +0100 | [diff] [blame] | 860 | #ifdef FIO_HAVE_GUASI |
| 861 | { .ival = "guasi", |
| 862 | .help = "GUASI IO engine", |
| 863 | }, |
| 864 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 865 | { .ival = "external", |
| 866 | .help = "Load external engine (append name)", |
| 867 | }, |
| 868 | }, |
| 869 | }, |
| 870 | { |
| 871 | .name = "iodepth", |
| 872 | .type = FIO_OPT_INT, |
| 873 | .off1 = td_var_offset(iodepth), |
| 874 | .help = "Amount of IO buffers to keep in flight", |
Jens Axboe | 757aff4 | 2007-12-12 19:42:13 +0100 | [diff] [blame] | 875 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 876 | .def = "1", |
| 877 | }, |
| 878 | { |
| 879 | .name = "iodepth_batch", |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 880 | .alias = "iodepth_batch_submit", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 881 | .type = FIO_OPT_INT, |
| 882 | .off1 = td_var_offset(iodepth_batch), |
Jens Axboe | d65db44 | 2009-01-16 19:15:33 +0100 | [diff] [blame] | 883 | .help = "Number of IO buffers to submit in one go", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 884 | .parent = "iodepth", |
Jens Axboe | a2e6f8a | 2008-01-18 10:28:11 +0100 | [diff] [blame] | 885 | .minval = 1, |
| 886 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 887 | }, |
| 888 | { |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 889 | .name = "iodepth_batch_complete", |
| 890 | .type = FIO_OPT_INT, |
| 891 | .off1 = td_var_offset(iodepth_batch_complete), |
Jens Axboe | d65db44 | 2009-01-16 19:15:33 +0100 | [diff] [blame] | 892 | .help = "Number of IO buffers to retrieve in one go", |
Jens Axboe | 4950421 | 2008-06-05 09:03:30 +0200 | [diff] [blame] | 893 | .parent = "iodepth", |
| 894 | .minval = 0, |
| 895 | .def = "1", |
| 896 | }, |
| 897 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 898 | .name = "iodepth_low", |
| 899 | .type = FIO_OPT_INT, |
| 900 | .off1 = td_var_offset(iodepth_low), |
| 901 | .help = "Low water mark for queuing depth", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 902 | .parent = "iodepth", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 903 | }, |
| 904 | { |
| 905 | .name = "size", |
| 906 | .type = FIO_OPT_STR_VAL, |
Jens Axboe | 2dc1bbe | 2007-03-15 15:01:33 +0100 | [diff] [blame] | 907 | .off1 = td_var_offset(size), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 908 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 909 | .help = "Total size of device or files", |
| 910 | }, |
| 911 | { |
Shawn Lewis | aa31f1f | 2008-01-11 09:45:11 +0100 | [diff] [blame] | 912 | .name = "fill_device", |
| 913 | .type = FIO_OPT_BOOL, |
| 914 | .off1 = td_var_offset(fill_device), |
| 915 | .help = "Write until an ENOSPC error occurs", |
| 916 | .def = "0", |
| 917 | }, |
| 918 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 919 | .name = "filesize", |
| 920 | .type = FIO_OPT_STR_VAL, |
| 921 | .off1 = td_var_offset(file_size_low), |
| 922 | .off2 = td_var_offset(file_size_high), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 923 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 924 | .help = "Size of individual files", |
| 925 | }, |
| 926 | { |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 927 | .name = "offset", |
| 928 | .alias = "fileoffset", |
| 929 | .type = FIO_OPT_STR_VAL, |
| 930 | .off1 = td_var_offset(start_offset), |
| 931 | .help = "Start IO from this offset", |
| 932 | .def = "0", |
| 933 | }, |
| 934 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 935 | .name = "bs", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 936 | .alias = "blocksize", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 937 | .type = FIO_OPT_INT, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 938 | .off1 = td_var_offset(bs[DDIR_READ]), |
| 939 | .off2 = td_var_offset(bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 940 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 941 | .help = "Block size unit", |
| 942 | .def = "4k", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 943 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 944 | }, |
| 945 | { |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 946 | .name = "ba", |
| 947 | .alias = "blockalign", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 948 | .type = FIO_OPT_INT, |
Jens Axboe | 2b7a01d | 2009-03-11 11:00:13 +0100 | [diff] [blame] | 949 | .off1 = td_var_offset(ba[DDIR_READ]), |
| 950 | .off2 = td_var_offset(ba[DDIR_WRITE]), |
| 951 | .minval = 1, |
| 952 | .help = "IO block offset alignment", |
| 953 | .parent = "rw", |
| 954 | }, |
| 955 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 956 | .name = "bsrange", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 957 | .alias = "blocksize_range", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 958 | .type = FIO_OPT_RANGE, |
| 959 | .off1 = td_var_offset(min_bs[DDIR_READ]), |
| 960 | .off2 = td_var_offset(max_bs[DDIR_READ]), |
| 961 | .off3 = td_var_offset(min_bs[DDIR_WRITE]), |
| 962 | .off4 = td_var_offset(max_bs[DDIR_WRITE]), |
Jens Axboe | c3edbdb | 2007-07-20 14:25:31 +0200 | [diff] [blame] | 963 | .minval = 1, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 964 | .help = "Set block size range (in more detail than bs)", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 965 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 966 | }, |
| 967 | { |
Jens Axboe | 564ca97 | 2007-12-14 12:21:19 +0100 | [diff] [blame] | 968 | .name = "bssplit", |
| 969 | .type = FIO_OPT_STR, |
| 970 | .cb = str_bssplit_cb, |
| 971 | .help = "Set a specific mix of block sizes", |
| 972 | .parent = "rw", |
| 973 | }, |
| 974 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 975 | .name = "bs_unaligned", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 976 | .alias = "blocksize_unaligned", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 977 | .type = FIO_OPT_STR_SET, |
| 978 | .off1 = td_var_offset(bs_unaligned), |
| 979 | .help = "Don't sector align IO buffer sizes", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 980 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 981 | }, |
| 982 | { |
| 983 | .name = "randrepeat", |
| 984 | .type = FIO_OPT_BOOL, |
| 985 | .off1 = td_var_offset(rand_repeatable), |
| 986 | .help = "Use repeatable random IO pattern", |
| 987 | .def = "1", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 988 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 989 | }, |
| 990 | { |
| 991 | .name = "norandommap", |
| 992 | .type = FIO_OPT_STR_SET, |
| 993 | .off1 = td_var_offset(norandommap), |
| 994 | .help = "Accept potential duplicate random blocks", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 995 | .parent = "rw", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 996 | }, |
| 997 | { |
Jens Axboe | 2b386d2 | 2008-03-26 10:32:57 +0100 | [diff] [blame] | 998 | .name = "softrandommap", |
| 999 | .type = FIO_OPT_BOOL, |
| 1000 | .off1 = td_var_offset(softrandommap), |
Jens Axboe | f66ab3c | 2008-06-05 11:48:22 +0200 | [diff] [blame] | 1001 | .help = "Set norandommap if randommap allocation fails", |
Jens Axboe | 2b386d2 | 2008-03-26 10:32:57 +0100 | [diff] [blame] | 1002 | .parent = "norandommap", |
| 1003 | .def = "0", |
| 1004 | }, |
| 1005 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1006 | .name = "nrfiles", |
| 1007 | .type = FIO_OPT_INT, |
| 1008 | .off1 = td_var_offset(nr_files), |
| 1009 | .help = "Split job workload between this number of files", |
| 1010 | .def = "1", |
| 1011 | }, |
| 1012 | { |
| 1013 | .name = "openfiles", |
| 1014 | .type = FIO_OPT_INT, |
| 1015 | .off1 = td_var_offset(open_files), |
| 1016 | .help = "Number of files to keep open at the same time", |
| 1017 | }, |
| 1018 | { |
| 1019 | .name = "file_service_type", |
| 1020 | .type = FIO_OPT_STR, |
| 1021 | .cb = str_fst_cb, |
| 1022 | .off1 = td_var_offset(file_service_type), |
| 1023 | .help = "How to select which file to service next", |
| 1024 | .def = "roundrobin", |
| 1025 | .posval = { |
| 1026 | { .ival = "random", |
| 1027 | .oval = FIO_FSERVICE_RANDOM, |
| 1028 | .help = "Choose a file at random", |
| 1029 | }, |
| 1030 | { .ival = "roundrobin", |
| 1031 | .oval = FIO_FSERVICE_RR, |
| 1032 | .help = "Round robin select files", |
| 1033 | }, |
Jens Axboe | a086c25 | 2009-03-04 08:27:37 +0100 | [diff] [blame] | 1034 | { .ival = "sequential", |
| 1035 | .oval = FIO_FSERVICE_SEQ, |
| 1036 | .help = "Finish one file before moving to the next", |
| 1037 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1038 | }, |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1039 | .parent = "nrfiles", |
| 1040 | }, |
| 1041 | { |
| 1042 | .name = "fadvise_hint", |
| 1043 | .type = FIO_OPT_BOOL, |
| 1044 | .off1 = td_var_offset(fadvise_hint), |
| 1045 | .help = "Use fadvise() to advise the kernel on IO pattern", |
| 1046 | .def = "1", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1047 | }, |
| 1048 | { |
| 1049 | .name = "fsync", |
| 1050 | .type = FIO_OPT_INT, |
| 1051 | .off1 = td_var_offset(fsync_blocks), |
| 1052 | .help = "Issue fsync for writes every given number of blocks", |
| 1053 | .def = "0", |
| 1054 | }, |
| 1055 | { |
Jens Axboe | 5f9099e | 2009-06-16 22:40:26 +0200 | [diff] [blame] | 1056 | .name = "fdatasync", |
| 1057 | .type = FIO_OPT_INT, |
| 1058 | .off1 = td_var_offset(fdatasync_blocks), |
| 1059 | .help = "Issue fdatasync for writes every given number of blocks", |
| 1060 | .def = "0", |
| 1061 | }, |
| 1062 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1063 | .name = "direct", |
| 1064 | .type = FIO_OPT_BOOL, |
| 1065 | .off1 = td_var_offset(odirect), |
| 1066 | .help = "Use O_DIRECT IO (negates buffered)", |
| 1067 | .def = "0", |
| 1068 | }, |
| 1069 | { |
| 1070 | .name = "buffered", |
| 1071 | .type = FIO_OPT_BOOL, |
| 1072 | .off1 = td_var_offset(odirect), |
| 1073 | .neg = 1, |
| 1074 | .help = "Use buffered IO (negates direct)", |
| 1075 | .def = "1", |
| 1076 | }, |
| 1077 | { |
| 1078 | .name = "overwrite", |
| 1079 | .type = FIO_OPT_BOOL, |
| 1080 | .off1 = td_var_offset(overwrite), |
| 1081 | .help = "When writing, set whether to overwrite current data", |
| 1082 | .def = "0", |
| 1083 | }, |
| 1084 | { |
| 1085 | .name = "loops", |
| 1086 | .type = FIO_OPT_INT, |
| 1087 | .off1 = td_var_offset(loops), |
| 1088 | .help = "Number of times to run the job", |
| 1089 | .def = "1", |
| 1090 | }, |
| 1091 | { |
| 1092 | .name = "numjobs", |
| 1093 | .type = FIO_OPT_INT, |
| 1094 | .off1 = td_var_offset(numjobs), |
| 1095 | .help = "Duplicate this job this many times", |
| 1096 | .def = "1", |
| 1097 | }, |
| 1098 | { |
| 1099 | .name = "startdelay", |
| 1100 | .type = FIO_OPT_INT, |
| 1101 | .off1 = td_var_offset(start_delay), |
| 1102 | .help = "Only start job when this period has passed", |
| 1103 | .def = "0", |
| 1104 | }, |
| 1105 | { |
| 1106 | .name = "runtime", |
| 1107 | .alias = "timeout", |
| 1108 | .type = FIO_OPT_STR_VAL_TIME, |
| 1109 | .off1 = td_var_offset(timeout), |
| 1110 | .help = "Stop workload when this amount of time has passed", |
| 1111 | .def = "0", |
| 1112 | }, |
| 1113 | { |
Jens Axboe | cf4464c | 2007-04-17 20:14:42 +0200 | [diff] [blame] | 1114 | .name = "time_based", |
| 1115 | .type = FIO_OPT_STR_SET, |
| 1116 | .off1 = td_var_offset(time_based), |
| 1117 | .help = "Keep running until runtime/timeout is met", |
| 1118 | }, |
| 1119 | { |
Jens Axboe | 721938a | 2008-09-10 09:46:16 +0200 | [diff] [blame] | 1120 | .name = "ramp_time", |
| 1121 | .type = FIO_OPT_STR_VAL_TIME, |
| 1122 | .off1 = td_var_offset(ramp_time), |
| 1123 | .help = "Ramp up time before measuring performance", |
| 1124 | }, |
| 1125 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1126 | .name = "mem", |
Jens Axboe | d3aad8f | 2007-03-15 14:12:05 +0100 | [diff] [blame] | 1127 | .alias = "iomem", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1128 | .type = FIO_OPT_STR, |
| 1129 | .cb = str_mem_cb, |
| 1130 | .off1 = td_var_offset(mem_type), |
| 1131 | .help = "Backing type for IO buffers", |
| 1132 | .def = "malloc", |
| 1133 | .posval = { |
| 1134 | { .ival = "malloc", |
| 1135 | .oval = MEM_MALLOC, |
| 1136 | .help = "Use malloc(3) for IO buffers", |
| 1137 | }, |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 1138 | { .ival = "shm", |
| 1139 | .oval = MEM_SHM, |
| 1140 | .help = "Use shared memory segments for IO buffers", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1141 | }, |
| 1142 | #ifdef FIO_HAVE_HUGETLB |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 1143 | { .ival = "shmhuge", |
| 1144 | .oval = MEM_SHMHUGE, |
| 1145 | .help = "Like shm, but use huge pages", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1146 | }, |
| 1147 | #endif |
Jens Axboe | b370e46 | 2007-03-19 10:51:49 +0100 | [diff] [blame] | 1148 | { .ival = "mmap", |
| 1149 | .oval = MEM_MMAP, |
| 1150 | .help = "Use mmap(2) (file or anon) for IO buffers", |
| 1151 | }, |
Jens Axboe | 37c8cdf | 2007-03-19 13:14:03 +0100 | [diff] [blame] | 1152 | #ifdef FIO_HAVE_HUGETLB |
| 1153 | { .ival = "mmaphuge", |
| 1154 | .oval = MEM_MMAPHUGE, |
| 1155 | .help = "Like mmap, but use huge pages", |
| 1156 | }, |
| 1157 | #endif |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1158 | }, |
| 1159 | }, |
| 1160 | { |
Jens Axboe | d529ee1 | 2009-07-01 10:33:03 +0200 | [diff] [blame] | 1161 | .name = "iomem_align", |
| 1162 | .alias = "mem_align", |
| 1163 | .type = FIO_OPT_INT, |
| 1164 | .off1 = td_var_offset(mem_align), |
| 1165 | .minval = 0, |
| 1166 | .help = "IO memory buffer offset alignment", |
| 1167 | .def = "0", |
| 1168 | .parent = "iomem", |
| 1169 | }, |
| 1170 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1171 | .name = "verify", |
| 1172 | .type = FIO_OPT_STR, |
| 1173 | .off1 = td_var_offset(verify), |
| 1174 | .help = "Verify data written", |
| 1175 | .def = "0", |
| 1176 | .posval = { |
| 1177 | { .ival = "0", |
| 1178 | .oval = VERIFY_NONE, |
| 1179 | .help = "Don't do IO verification", |
| 1180 | }, |
Jens Axboe | fcca4b5 | 2007-07-27 15:42:00 +0200 | [diff] [blame] | 1181 | { .ival = "md5", |
| 1182 | .oval = VERIFY_MD5, |
| 1183 | .help = "Use md5 checksums for verification", |
| 1184 | }, |
Jens Axboe | d77a7af | 2007-07-27 15:35:06 +0200 | [diff] [blame] | 1185 | { .ival = "crc64", |
| 1186 | .oval = VERIFY_CRC64, |
| 1187 | .help = "Use crc64 checksums for verification", |
| 1188 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1189 | { .ival = "crc32", |
| 1190 | .oval = VERIFY_CRC32, |
| 1191 | .help = "Use crc32 checksums for verification", |
| 1192 | }, |
Jens Axboe | af497e6 | 2008-08-04 15:40:35 +0200 | [diff] [blame] | 1193 | { .ival = "crc32c-intel", |
| 1194 | .oval = VERIFY_CRC32C_INTEL, |
| 1195 | .help = "Use hw crc32c checksums for verification", |
| 1196 | }, |
Jens Axboe | bac39e0 | 2008-06-11 20:46:19 +0200 | [diff] [blame] | 1197 | { .ival = "crc32c", |
| 1198 | .oval = VERIFY_CRC32C, |
| 1199 | .help = "Use crc32c checksums for verification", |
| 1200 | }, |
Jens Axboe | 969f7ed | 2007-07-27 09:07:17 +0200 | [diff] [blame] | 1201 | { .ival = "crc16", |
| 1202 | .oval = VERIFY_CRC16, |
| 1203 | .help = "Use crc16 checksums for verification", |
| 1204 | }, |
Jens Axboe | 1e154bd | 2007-07-27 09:52:40 +0200 | [diff] [blame] | 1205 | { .ival = "crc7", |
| 1206 | .oval = VERIFY_CRC7, |
| 1207 | .help = "Use crc7 checksums for verification", |
| 1208 | }, |
Jens Axboe | 7c353ce | 2009-08-09 22:40:33 +0200 | [diff] [blame] | 1209 | { .ival = "sha1", |
| 1210 | .oval = VERIFY_SHA1, |
| 1211 | .help = "Use sha1 checksums for verification", |
| 1212 | }, |
Jens Axboe | cd14cc1 | 2007-07-30 10:59:33 +0200 | [diff] [blame] | 1213 | { .ival = "sha256", |
| 1214 | .oval = VERIFY_SHA256, |
| 1215 | .help = "Use sha256 checksums for verification", |
| 1216 | }, |
| 1217 | { .ival = "sha512", |
| 1218 | .oval = VERIFY_SHA512, |
| 1219 | .help = "Use sha512 checksums for verification", |
| 1220 | }, |
Shawn Lewis | 7437ee8 | 2007-08-02 21:05:58 +0200 | [diff] [blame] | 1221 | { .ival = "meta", |
| 1222 | .oval = VERIFY_META, |
| 1223 | .help = "Use io information", |
| 1224 | }, |
Jens Axboe | 36690c9 | 2007-03-26 10:23:34 +0200 | [diff] [blame] | 1225 | { |
| 1226 | .ival = "null", |
| 1227 | .oval = VERIFY_NULL, |
| 1228 | .help = "Pretend to verify", |
| 1229 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1230 | }, |
| 1231 | }, |
| 1232 | { |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 1233 | .name = "do_verify", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 1234 | .type = FIO_OPT_BOOL, |
Jens Axboe | 005c565 | 2007-08-02 22:21:36 +0200 | [diff] [blame] | 1235 | .off1 = td_var_offset(do_verify), |
| 1236 | .help = "Run verification stage after write", |
| 1237 | .def = "1", |
| 1238 | .parent = "verify", |
| 1239 | }, |
| 1240 | { |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 1241 | .name = "verifysort", |
| 1242 | .type = FIO_OPT_BOOL, |
| 1243 | .off1 = td_var_offset(verifysort), |
| 1244 | .help = "Sort written verify blocks for read back", |
| 1245 | .def = "1", |
Jens Axboe | c83f2df | 2007-07-31 22:51:47 +0200 | [diff] [blame] | 1246 | .parent = "verify", |
Jens Axboe | 160b966 | 2007-03-27 10:59:49 +0200 | [diff] [blame] | 1247 | }, |
| 1248 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1249 | .name = "verify_interval", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1250 | .type = FIO_OPT_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1251 | .off1 = td_var_offset(verify_interval), |
Jens Axboe | 819a968 | 2007-07-28 21:30:31 +0200 | [diff] [blame] | 1252 | .minval = 2 * sizeof(struct verify_header), |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1253 | .help = "Store verify buffer header every N bytes", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1254 | .parent = "verify", |
Shawn Lewis | 3f9f4e2 | 2007-07-28 21:10:37 +0200 | [diff] [blame] | 1255 | }, |
| 1256 | { |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1257 | .name = "verify_offset", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1258 | .type = FIO_OPT_INT, |
Jens Axboe | a59e170 | 2007-07-30 08:53:27 +0200 | [diff] [blame] | 1259 | .help = "Offset verify header location by N bytes", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 1260 | .def = "0", |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 1261 | .cb = str_verify_offset_cb, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1262 | .parent = "verify", |
Shawn Lewis | 546a914 | 2007-07-28 21:11:37 +0200 | [diff] [blame] | 1263 | }, |
| 1264 | { |
Shawn Lewis | e28218f | 2008-01-16 11:01:33 +0100 | [diff] [blame] | 1265 | .name = "verify_pattern", |
| 1266 | .type = FIO_OPT_INT, |
| 1267 | .cb = str_verify_pattern_cb, |
| 1268 | .help = "Fill pattern for IO buffers", |
| 1269 | .parent = "verify", |
| 1270 | }, |
| 1271 | { |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 1272 | .name = "verify_fatal", |
Jens Axboe | 68e1f29 | 2007-08-10 10:32:14 +0200 | [diff] [blame] | 1273 | .type = FIO_OPT_BOOL, |
Jens Axboe | a12a3b4 | 2007-08-09 10:20:54 +0200 | [diff] [blame] | 1274 | .off1 = td_var_offset(verify_fatal), |
| 1275 | .def = "0", |
| 1276 | .help = "Exit on a single verify failure, don't continue", |
| 1277 | .parent = "verify", |
| 1278 | }, |
| 1279 | { |
Jens Axboe | e8462bd | 2009-07-06 12:59:04 +0200 | [diff] [blame] | 1280 | .name = "verify_async", |
| 1281 | .type = FIO_OPT_INT, |
| 1282 | .off1 = td_var_offset(verify_async), |
| 1283 | .def = "0", |
| 1284 | .help = "Number of async verifier threads to use", |
| 1285 | .parent = "verify", |
| 1286 | }, |
| 1287 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 1288 | { |
| 1289 | .name = "verify_async_cpus", |
| 1290 | .type = FIO_OPT_STR, |
| 1291 | .cb = str_verify_cpus_allowed_cb, |
| 1292 | .help = "Set CPUs allowed for async verify threads", |
| 1293 | .parent = "verify_async", |
| 1294 | }, |
| 1295 | #endif |
| 1296 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1297 | .name = "write_iolog", |
| 1298 | .type = FIO_OPT_STR_STORE, |
| 1299 | .off1 = td_var_offset(write_iolog_file), |
| 1300 | .help = "Store IO pattern to file", |
| 1301 | }, |
| 1302 | { |
| 1303 | .name = "read_iolog", |
| 1304 | .type = FIO_OPT_STR_STORE, |
| 1305 | .off1 = td_var_offset(read_iolog_file), |
| 1306 | .help = "Playback IO pattern from file", |
| 1307 | }, |
| 1308 | { |
| 1309 | .name = "exec_prerun", |
| 1310 | .type = FIO_OPT_STR_STORE, |
| 1311 | .off1 = td_var_offset(exec_prerun), |
| 1312 | .help = "Execute this file prior to running job", |
| 1313 | }, |
| 1314 | { |
| 1315 | .name = "exec_postrun", |
| 1316 | .type = FIO_OPT_STR_STORE, |
| 1317 | .off1 = td_var_offset(exec_postrun), |
| 1318 | .help = "Execute this file after running job", |
| 1319 | }, |
| 1320 | #ifdef FIO_HAVE_IOSCHED_SWITCH |
| 1321 | { |
| 1322 | .name = "ioscheduler", |
| 1323 | .type = FIO_OPT_STR_STORE, |
| 1324 | .off1 = td_var_offset(ioscheduler), |
| 1325 | .help = "Use this IO scheduler on the backing device", |
| 1326 | }, |
| 1327 | #endif |
| 1328 | { |
| 1329 | .name = "zonesize", |
| 1330 | .type = FIO_OPT_STR_VAL, |
| 1331 | .off1 = td_var_offset(zone_size), |
| 1332 | .help = "Give size of an IO zone", |
| 1333 | .def = "0", |
| 1334 | }, |
| 1335 | { |
| 1336 | .name = "zoneskip", |
| 1337 | .type = FIO_OPT_STR_VAL, |
| 1338 | .off1 = td_var_offset(zone_skip), |
| 1339 | .help = "Space between IO zones", |
| 1340 | .def = "0", |
| 1341 | }, |
| 1342 | { |
| 1343 | .name = "lockmem", |
| 1344 | .type = FIO_OPT_STR_VAL, |
| 1345 | .cb = str_lockmem_cb, |
| 1346 | .help = "Lock down this amount of memory", |
| 1347 | .def = "0", |
| 1348 | }, |
| 1349 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1350 | .name = "rwmixread", |
| 1351 | .type = FIO_OPT_INT, |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 1352 | .cb = str_rwmix_read_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1353 | .maxval = 100, |
| 1354 | .help = "Percentage of mixed workload that is reads", |
| 1355 | .def = "50", |
| 1356 | }, |
| 1357 | { |
| 1358 | .name = "rwmixwrite", |
| 1359 | .type = FIO_OPT_INT, |
Jens Axboe | cb499fc | 2008-05-28 10:33:32 +0200 | [diff] [blame] | 1360 | .cb = str_rwmix_write_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1361 | .maxval = 100, |
| 1362 | .help = "Percentage of mixed workload that is writes", |
| 1363 | .def = "50", |
| 1364 | }, |
| 1365 | { |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1366 | .name = "rwmixcycle", |
Jens Axboe | 15ca150 | 2008-04-07 09:26:02 +0200 | [diff] [blame] | 1367 | .type = FIO_OPT_DEPRECATED, |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1368 | }, |
| 1369 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1370 | .name = "nice", |
| 1371 | .type = FIO_OPT_INT, |
| 1372 | .off1 = td_var_offset(nice), |
| 1373 | .help = "Set job CPU nice value", |
| 1374 | .minval = -19, |
| 1375 | .maxval = 20, |
| 1376 | .def = "0", |
| 1377 | }, |
| 1378 | #ifdef FIO_HAVE_IOPRIO |
| 1379 | { |
| 1380 | .name = "prio", |
| 1381 | .type = FIO_OPT_INT, |
| 1382 | .cb = str_prio_cb, |
| 1383 | .help = "Set job IO priority value", |
| 1384 | .minval = 0, |
| 1385 | .maxval = 7, |
| 1386 | }, |
| 1387 | { |
| 1388 | .name = "prioclass", |
| 1389 | .type = FIO_OPT_INT, |
| 1390 | .cb = str_prioclass_cb, |
| 1391 | .help = "Set job IO priority class", |
| 1392 | .minval = 0, |
| 1393 | .maxval = 3, |
| 1394 | }, |
| 1395 | #endif |
| 1396 | { |
| 1397 | .name = "thinktime", |
| 1398 | .type = FIO_OPT_INT, |
| 1399 | .off1 = td_var_offset(thinktime), |
| 1400 | .help = "Idle time between IO buffers (usec)", |
| 1401 | .def = "0", |
| 1402 | }, |
| 1403 | { |
| 1404 | .name = "thinktime_spin", |
| 1405 | .type = FIO_OPT_INT, |
| 1406 | .off1 = td_var_offset(thinktime_spin), |
| 1407 | .help = "Start think time by spinning this amount (usec)", |
| 1408 | .def = "0", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1409 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1410 | }, |
| 1411 | { |
| 1412 | .name = "thinktime_blocks", |
| 1413 | .type = FIO_OPT_INT, |
| 1414 | .off1 = td_var_offset(thinktime_blocks), |
| 1415 | .help = "IO buffer period between 'thinktime'", |
| 1416 | .def = "1", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1417 | .parent = "thinktime", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1418 | }, |
| 1419 | { |
| 1420 | .name = "rate", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1421 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1422 | .off1 = td_var_offset(rate[0]), |
| 1423 | .off2 = td_var_offset(rate[1]), |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1424 | .help = "Set bandwidth rate", |
| 1425 | }, |
| 1426 | { |
| 1427 | .name = "ratemin", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1428 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1429 | .off1 = td_var_offset(ratemin[0]), |
| 1430 | .off2 = td_var_offset(ratemin[1]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1431 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1432 | .parent = "rate", |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1433 | }, |
| 1434 | { |
| 1435 | .name = "rate_iops", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1436 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1437 | .off1 = td_var_offset(rate_iops[0]), |
| 1438 | .off2 = td_var_offset(rate_iops[1]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1439 | .help = "Limit IO used to this number of IO operations/sec", |
| 1440 | }, |
| 1441 | { |
| 1442 | .name = "rate_iops_min", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1443 | .type = FIO_OPT_INT, |
Jens Axboe | 581e714 | 2009-06-09 12:47:16 +0200 | [diff] [blame] | 1444 | .off1 = td_var_offset(rate_iops_min[0]), |
| 1445 | .off2 = td_var_offset(rate_iops_min[1]), |
Jens Axboe | 4e991c2 | 2007-03-15 11:41:11 +0100 | [diff] [blame] | 1446 | .help = "Job must meet this rate or it will be shutdown", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1447 | .parent = "rate_iops", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1448 | }, |
| 1449 | { |
| 1450 | .name = "ratecycle", |
| 1451 | .type = FIO_OPT_INT, |
| 1452 | .off1 = td_var_offset(ratecycle), |
| 1453 | .help = "Window average for rate limits (msec)", |
| 1454 | .def = "1000", |
Jens Axboe | afdf935 | 2007-07-31 16:14:34 +0200 | [diff] [blame] | 1455 | .parent = "rate", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1456 | }, |
| 1457 | { |
| 1458 | .name = "invalidate", |
| 1459 | .type = FIO_OPT_BOOL, |
| 1460 | .off1 = td_var_offset(invalidate_cache), |
| 1461 | .help = "Invalidate buffer/page cache prior to running job", |
| 1462 | .def = "1", |
| 1463 | }, |
| 1464 | { |
| 1465 | .name = "sync", |
| 1466 | .type = FIO_OPT_BOOL, |
| 1467 | .off1 = td_var_offset(sync_io), |
| 1468 | .help = "Use O_SYNC for buffered writes", |
| 1469 | .def = "0", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1470 | .parent = "buffered", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1471 | }, |
| 1472 | { |
| 1473 | .name = "bwavgtime", |
| 1474 | .type = FIO_OPT_INT, |
| 1475 | .off1 = td_var_offset(bw_avg_time), |
Jens Axboe | 5ec10ea | 2008-03-06 15:42:00 +0100 | [diff] [blame] | 1476 | .help = "Time window over which to calculate bandwidth" |
| 1477 | " (msec)", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1478 | .def = "500", |
| 1479 | }, |
| 1480 | { |
| 1481 | .name = "create_serialize", |
| 1482 | .type = FIO_OPT_BOOL, |
| 1483 | .off1 = td_var_offset(create_serialize), |
| 1484 | .help = "Serialize creating of job files", |
| 1485 | .def = "1", |
| 1486 | }, |
| 1487 | { |
| 1488 | .name = "create_fsync", |
| 1489 | .type = FIO_OPT_BOOL, |
| 1490 | .off1 = td_var_offset(create_fsync), |
| 1491 | .help = "Fsync file after creation", |
| 1492 | .def = "1", |
| 1493 | }, |
| 1494 | { |
Jens Axboe | 814452b | 2009-03-04 12:53:13 +0100 | [diff] [blame] | 1495 | .name = "create_on_open", |
| 1496 | .type = FIO_OPT_BOOL, |
| 1497 | .off1 = td_var_offset(create_on_open), |
| 1498 | .help = "Create files when they are opened for IO", |
| 1499 | .def = "0", |
| 1500 | }, |
Jens Axboe | 0b9d69e | 2009-09-11 22:29:54 +0200 | [diff] [blame^] | 1501 | { |
Zhang, Yanmin | afad68f | 2009-05-20 11:30:55 +0200 | [diff] [blame] | 1502 | .name = "pre_read", |
| 1503 | .type = FIO_OPT_BOOL, |
| 1504 | .off1 = td_var_offset(pre_read), |
| 1505 | .help = "Preread files before starting official testing", |
| 1506 | .def = "0", |
| 1507 | }, |
Jens Axboe | 814452b | 2009-03-04 12:53:13 +0100 | [diff] [blame] | 1508 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1509 | .name = "cpuload", |
| 1510 | .type = FIO_OPT_INT, |
| 1511 | .off1 = td_var_offset(cpuload), |
| 1512 | .help = "Use this percentage of CPU", |
| 1513 | }, |
| 1514 | { |
| 1515 | .name = "cpuchunks", |
| 1516 | .type = FIO_OPT_INT, |
| 1517 | .off1 = td_var_offset(cpucycle), |
| 1518 | .help = "Length of the CPU burn cycles (usecs)", |
| 1519 | .def = "50000", |
Jens Axboe | 67a1000 | 2007-07-31 23:12:16 +0200 | [diff] [blame] | 1520 | .parent = "cpuload", |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1521 | }, |
| 1522 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 1523 | { |
| 1524 | .name = "cpumask", |
| 1525 | .type = FIO_OPT_INT, |
| 1526 | .cb = str_cpumask_cb, |
| 1527 | .help = "CPU affinity mask", |
| 1528 | }, |
Jens Axboe | d2e268b | 2007-06-15 10:33:49 +0200 | [diff] [blame] | 1529 | { |
| 1530 | .name = "cpus_allowed", |
| 1531 | .type = FIO_OPT_STR, |
| 1532 | .cb = str_cpus_allowed_cb, |
| 1533 | .help = "Set CPUs allowed", |
| 1534 | }, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1535 | #endif |
| 1536 | { |
| 1537 | .name = "end_fsync", |
| 1538 | .type = FIO_OPT_BOOL, |
| 1539 | .off1 = td_var_offset(end_fsync), |
| 1540 | .help = "Include fsync at the end of job", |
| 1541 | .def = "0", |
| 1542 | }, |
| 1543 | { |
| 1544 | .name = "fsync_on_close", |
| 1545 | .type = FIO_OPT_BOOL, |
| 1546 | .off1 = td_var_offset(fsync_on_close), |
| 1547 | .help = "fsync files on close", |
| 1548 | .def = "0", |
| 1549 | }, |
| 1550 | { |
| 1551 | .name = "unlink", |
| 1552 | .type = FIO_OPT_BOOL, |
| 1553 | .off1 = td_var_offset(unlink), |
| 1554 | .help = "Unlink created files after job has completed", |
| 1555 | .def = "0", |
| 1556 | }, |
| 1557 | { |
| 1558 | .name = "exitall", |
| 1559 | .type = FIO_OPT_STR_SET, |
| 1560 | .cb = str_exitall_cb, |
| 1561 | .help = "Terminate all jobs when one exits", |
| 1562 | }, |
| 1563 | { |
| 1564 | .name = "stonewall", |
| 1565 | .type = FIO_OPT_STR_SET, |
| 1566 | .off1 = td_var_offset(stonewall), |
| 1567 | .help = "Insert a hard barrier between this job and previous", |
| 1568 | }, |
| 1569 | { |
Jens Axboe | b3d62a7 | 2007-03-20 14:23:26 +0100 | [diff] [blame] | 1570 | .name = "new_group", |
| 1571 | .type = FIO_OPT_STR_SET, |
| 1572 | .off1 = td_var_offset(new_group), |
| 1573 | .help = "Mark the start of a new group (for reporting)", |
| 1574 | }, |
| 1575 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1576 | .name = "thread", |
| 1577 | .type = FIO_OPT_STR_SET, |
| 1578 | .off1 = td_var_offset(use_thread), |
| 1579 | .help = "Use threads instead of forks", |
| 1580 | }, |
| 1581 | { |
| 1582 | .name = "write_bw_log", |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1583 | .type = FIO_OPT_STR, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1584 | .off1 = td_var_offset(write_bw_log), |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1585 | .cb = str_write_bw_log_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1586 | .help = "Write log of bandwidth during run", |
| 1587 | }, |
| 1588 | { |
| 1589 | .name = "write_lat_log", |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1590 | .type = FIO_OPT_STR, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1591 | .off1 = td_var_offset(write_lat_log), |
Jens Axboe | e3cedca | 2008-11-19 19:57:52 +0100 | [diff] [blame] | 1592 | .cb = str_write_lat_log_cb, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1593 | .help = "Write log of latency during run", |
| 1594 | }, |
| 1595 | { |
| 1596 | .name = "hugepage-size", |
Jens Axboe | e01b22b | 2009-06-09 15:43:25 +0200 | [diff] [blame] | 1597 | .type = FIO_OPT_INT, |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1598 | .off1 = td_var_offset(hugepage_size), |
| 1599 | .help = "When using hugepages, specify size of each page", |
| 1600 | .def = __stringify(FIO_HUGE_PAGE), |
| 1601 | }, |
| 1602 | { |
| 1603 | .name = "group_reporting", |
| 1604 | .type = FIO_OPT_STR_SET, |
| 1605 | .off1 = td_var_offset(group_reporting), |
| 1606 | .help = "Do reporting on a per-group basis", |
| 1607 | }, |
| 1608 | { |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 1609 | .name = "zero_buffers", |
| 1610 | .type = FIO_OPT_STR_SET, |
| 1611 | .off1 = td_var_offset(zero_buffers), |
| 1612 | .help = "Init IO buffers to all zeroes", |
| 1613 | }, |
Jens Axboe | 5973caf | 2008-05-21 19:52:35 +0200 | [diff] [blame] | 1614 | { |
| 1615 | .name = "refill_buffers", |
| 1616 | .type = FIO_OPT_STR_SET, |
| 1617 | .off1 = td_var_offset(refill_buffers), |
| 1618 | .help = "Refill IO buffers on every IO submit", |
| 1619 | }, |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 1620 | #ifdef FIO_HAVE_DISK_UTIL |
| 1621 | { |
| 1622 | .name = "disk_util", |
| 1623 | .type = FIO_OPT_BOOL, |
| 1624 | .off1 = td_var_offset(do_disk_util), |
Jens Axboe | f66ab3c | 2008-06-05 11:48:22 +0200 | [diff] [blame] | 1625 | .help = "Log disk utilization statistics", |
Jens Axboe | 0a839f3 | 2007-04-26 09:02:34 +0200 | [diff] [blame] | 1626 | .def = "1", |
| 1627 | }, |
| 1628 | #endif |
Jens Axboe | e9459e5 | 2007-04-17 15:46:32 +0200 | [diff] [blame] | 1629 | { |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1630 | .name = "gtod_reduce", |
| 1631 | .type = FIO_OPT_BOOL, |
| 1632 | .help = "Greatly reduce number of gettimeofday() calls", |
| 1633 | .cb = str_gtod_reduce_cb, |
| 1634 | .def = "0", |
| 1635 | }, |
| 1636 | { |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1637 | .name = "disable_clat", |
| 1638 | .type = FIO_OPT_BOOL, |
| 1639 | .off1 = td_var_offset(disable_clat), |
| 1640 | .help = "Disable completion latency numbers", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1641 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1642 | .def = "0", |
| 1643 | }, |
| 1644 | { |
| 1645 | .name = "disable_slat", |
| 1646 | .type = FIO_OPT_BOOL, |
| 1647 | .off1 = td_var_offset(disable_slat), |
| 1648 | .help = "Disable submissionn latency numbers", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1649 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1650 | .def = "0", |
| 1651 | }, |
| 1652 | { |
| 1653 | .name = "disable_bw_measurement", |
| 1654 | .type = FIO_OPT_BOOL, |
| 1655 | .off1 = td_var_offset(disable_bw), |
| 1656 | .help = "Disable bandwidth logging", |
Jens Axboe | 993bf48 | 2008-11-14 13:04:53 +0100 | [diff] [blame] | 1657 | .parent = "gtod_reduce", |
Jens Axboe | 9520ebb | 2008-10-16 21:03:27 +0200 | [diff] [blame] | 1658 | .def = "0", |
| 1659 | }, |
| 1660 | { |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 1661 | .name = "gtod_cpu", |
| 1662 | .type = FIO_OPT_INT, |
| 1663 | .cb = str_gtod_cpu_cb, |
| 1664 | .help = "Setup dedicated gettimeofday() thread on this CPU", |
Jens Axboe | 29d43ff | 2009-07-01 10:42:18 +0200 | [diff] [blame] | 1665 | .verify = gtod_cpu_verify, |
Jens Axboe | be4ecfd | 2008-12-08 14:10:52 +0100 | [diff] [blame] | 1666 | }, |
| 1667 | { |
Radha Ramachandran | f2bba18 | 2009-06-15 08:40:16 +0200 | [diff] [blame] | 1668 | .name = "continue_on_error", |
| 1669 | .type = FIO_OPT_BOOL, |
| 1670 | .off1 = td_var_offset(continue_on_error), |
| 1671 | .help = "Continue on non-fatal errors during I/O", |
| 1672 | .def = "0", |
| 1673 | }, |
| 1674 | { |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1675 | .name = NULL, |
| 1676 | }, |
| 1677 | }; |
| 1678 | |
| 1679 | void fio_options_dup_and_init(struct option *long_options) |
| 1680 | { |
| 1681 | struct fio_option *o; |
| 1682 | unsigned int i; |
| 1683 | |
| 1684 | options_init(options); |
| 1685 | |
| 1686 | i = 0; |
| 1687 | while (long_options[i].name) |
| 1688 | i++; |
| 1689 | |
| 1690 | o = &options[0]; |
| 1691 | while (o->name) { |
Jens Axboe | 5921e80 | 2008-05-30 15:02:38 +0200 | [diff] [blame] | 1692 | long_options[i].name = (char *) o->name; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1693 | long_options[i].val = FIO_GETOPT_JOB; |
| 1694 | if (o->type == FIO_OPT_STR_SET) |
| 1695 | long_options[i].has_arg = no_argument; |
| 1696 | else |
| 1697 | long_options[i].has_arg = required_argument; |
| 1698 | |
| 1699 | i++; |
| 1700 | o++; |
| 1701 | assert(i < FIO_NR_OPTIONS); |
| 1702 | } |
| 1703 | } |
| 1704 | |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 1705 | struct fio_keyword { |
| 1706 | const char *word; |
| 1707 | const char *desc; |
| 1708 | char *replace; |
| 1709 | }; |
| 1710 | |
| 1711 | static struct fio_keyword fio_keywords[] = { |
| 1712 | { |
| 1713 | .word = "$pagesize", |
| 1714 | .desc = "Page size in the system", |
| 1715 | }, |
| 1716 | { |
| 1717 | .word = "$mb_memory", |
| 1718 | .desc = "Megabytes of memory online", |
| 1719 | }, |
| 1720 | { |
| 1721 | .word = "$ncpus", |
| 1722 | .desc = "Number of CPUs online in the system", |
| 1723 | }, |
| 1724 | { |
| 1725 | .word = NULL, |
| 1726 | }, |
| 1727 | }; |
| 1728 | |
| 1729 | void fio_keywords_init(void) |
| 1730 | { |
| 1731 | unsigned long mb_memory; |
| 1732 | char buf[128]; |
| 1733 | long l; |
| 1734 | |
| 1735 | sprintf(buf, "%lu", page_size); |
| 1736 | fio_keywords[0].replace = strdup(buf); |
| 1737 | |
| 1738 | l = sysconf(_SC_PHYS_PAGES); |
| 1739 | mb_memory = l * (page_size / 1024UL); |
| 1740 | sprintf(buf, "%lu", mb_memory); |
| 1741 | fio_keywords[1].replace = strdup(buf); |
| 1742 | |
| 1743 | l = sysconf(_SC_NPROCESSORS_ONLN); |
| 1744 | sprintf(buf, "%lu", l); |
| 1745 | fio_keywords[2].replace = strdup(buf); |
| 1746 | } |
| 1747 | |
| 1748 | /* |
| 1749 | * Look for reserved variable names and replace them with real values |
| 1750 | */ |
| 1751 | static char *fio_keyword_replace(char *opt) |
| 1752 | { |
| 1753 | char *s; |
| 1754 | int i; |
| 1755 | |
| 1756 | for (i = 0; fio_keywords[i].word != NULL; i++) { |
| 1757 | struct fio_keyword *kw = &fio_keywords[i]; |
| 1758 | |
| 1759 | while ((s = strstr(opt, kw->word)) != NULL) { |
| 1760 | char *new = malloc(strlen(opt) + 1); |
| 1761 | char *o_org = opt; |
| 1762 | int olen = s - opt; |
| 1763 | int len; |
| 1764 | |
| 1765 | /* |
| 1766 | * Copy part of the string before the keyword and |
| 1767 | * sprintf() the replacement after it. |
| 1768 | */ |
| 1769 | memcpy(new, opt, olen); |
| 1770 | len = sprintf(new + olen, "%s", kw->replace); |
| 1771 | |
| 1772 | /* |
| 1773 | * If there's more in the original string, copy that |
| 1774 | * in too |
| 1775 | */ |
| 1776 | opt += strlen(kw->word) + olen; |
| 1777 | if (strlen(opt)) |
| 1778 | memcpy(new + olen + len, opt, opt - o_org - 1); |
| 1779 | |
| 1780 | /* |
| 1781 | * replace opt and free the old opt |
| 1782 | */ |
| 1783 | opt = new; |
| 1784 | free(o_org); |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | return opt; |
| 1789 | } |
| 1790 | |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 1791 | 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] | 1792 | { |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 1793 | int i, ret; |
| 1794 | |
| 1795 | sort_options(opts, options, num_opts); |
| 1796 | |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 1797 | for (ret = 0, i = 0; i < num_opts; i++) { |
| 1798 | opts[i] = fio_keyword_replace(opts[i]); |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 1799 | ret |= parse_option(opts[i], options, td); |
Jens Axboe | 74929ac | 2009-08-05 11:42:37 +0200 | [diff] [blame] | 1800 | } |
Jens Axboe | 3b8b713 | 2008-06-10 19:46:23 +0200 | [diff] [blame] | 1801 | |
| 1802 | return ret; |
Jens Axboe | 214e1ec | 2007-03-15 10:48:13 +0100 | [diff] [blame] | 1803 | } |
| 1804 | |
| 1805 | int fio_cmd_option_parse(struct thread_data *td, const char *opt, char *val) |
| 1806 | { |
| 1807 | return parse_cmd_option(opt, val, options, td); |
| 1808 | } |
| 1809 | |
| 1810 | void fio_fill_default_options(struct thread_data *td) |
| 1811 | { |
| 1812 | fill_default_options(td, options); |
| 1813 | } |
| 1814 | |
| 1815 | int fio_show_option_help(const char *opt) |
| 1816 | { |
| 1817 | return show_cmd_help(options, opt); |
| 1818 | } |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1819 | |
| 1820 | static void __options_mem(struct thread_data *td, int alloc) |
| 1821 | { |
| 1822 | struct thread_options *o = &td->o; |
| 1823 | struct fio_option *opt; |
| 1824 | char **ptr; |
| 1825 | int i; |
| 1826 | |
| 1827 | for (i = 0, opt = &options[0]; opt->name; i++, opt = &options[i]) { |
| 1828 | if (opt->type != FIO_OPT_STR_STORE) |
| 1829 | continue; |
| 1830 | |
| 1831 | ptr = (void *) o + opt->off1; |
| 1832 | if (*ptr) { |
| 1833 | if (alloc) |
| 1834 | *ptr = strdup(*ptr); |
| 1835 | else { |
| 1836 | free(*ptr); |
| 1837 | *ptr = NULL; |
| 1838 | } |
| 1839 | } |
| 1840 | } |
| 1841 | } |
| 1842 | |
| 1843 | /* |
| 1844 | * dupe FIO_OPT_STR_STORE options |
| 1845 | */ |
| 1846 | void options_mem_dupe(struct thread_data *td) |
| 1847 | { |
| 1848 | __options_mem(td, 1); |
| 1849 | } |
| 1850 | |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1851 | void options_mem_free(struct thread_data fio_unused *td) |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1852 | { |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1853 | #if 0 |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1854 | __options_mem(td, 0); |
Jens Axboe | 22d6621 | 2007-03-27 20:06:25 +0200 | [diff] [blame] | 1855 | #endif |
Jens Axboe | d23bb32 | 2007-03-23 15:57:56 +0100 | [diff] [blame] | 1856 | } |
Jens Axboe | d6978a3 | 2009-07-18 21:04:09 +0200 | [diff] [blame] | 1857 | |
| 1858 | unsigned int fio_get_kb_base(void *data) |
| 1859 | { |
| 1860 | struct thread_data *td = data; |
| 1861 | unsigned int kb_base = 0; |
| 1862 | |
| 1863 | if (td) |
| 1864 | kb_base = td->o.kb_base; |
| 1865 | if (!kb_base) |
| 1866 | kb_base = 1024; |
| 1867 | |
| 1868 | return kb_base; |
| 1869 | } |