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