Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 1 | /* |
Jens Axboe | cb2c86f | 2006-10-26 13:48:34 +0200 | [diff] [blame] | 2 | * This file contains job initialization and setup functions. |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 3 | */ |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 4 | #include <stdio.h> |
| 5 | #include <stdlib.h> |
| 6 | #include <unistd.h> |
| 7 | #include <fcntl.h> |
| 8 | #include <ctype.h> |
| 9 | #include <string.h> |
| 10 | #include <errno.h> |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 11 | #include <getopt.h> |
| 12 | #include <assert.h> |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 13 | #include <sys/ipc.h> |
| 14 | #include <sys/shm.h> |
| 15 | #include <sys/types.h> |
| 16 | #include <sys/stat.h> |
| 17 | |
| 18 | #include "fio.h" |
Jens Axboe | cb2c86f | 2006-10-26 13:48:34 +0200 | [diff] [blame] | 19 | #include "parse.h" |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 20 | |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 21 | /* |
| 22 | * The default options |
| 23 | */ |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 24 | #define DEF_BS (4096) |
| 25 | #define DEF_TIMEOUT (0) |
| 26 | #define DEF_RATE_CYCLE (1000) |
| 27 | #define DEF_ODIRECT (1) |
| 28 | #define DEF_IO_ENGINE (FIO_SYNCIO) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 29 | #define DEF_IO_ENGINE_NAME "sync" |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 30 | #define DEF_SEQUENTIAL (1) |
| 31 | #define DEF_RAND_REPEAT (1) |
| 32 | #define DEF_OVERWRITE (1) |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 33 | #define DEF_INVALIDATE (1) |
| 34 | #define DEF_SYNCIO (0) |
| 35 | #define DEF_RANDSEED (0xb1899bedUL) |
| 36 | #define DEF_BWAVGTIME (500) |
| 37 | #define DEF_CREATE_SER (1) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 38 | #define DEF_CREATE_FSYNC (1) |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 39 | #define DEF_LOOPS (1) |
| 40 | #define DEF_VERIFY (0) |
| 41 | #define DEF_STONEWALL (0) |
| 42 | #define DEF_NUMJOBS (1) |
| 43 | #define DEF_USE_THREAD (0) |
| 44 | #define DEF_FILE_SIZE (1024 * 1024 * 1024UL) |
| 45 | #define DEF_ZONE_SIZE (0) |
| 46 | #define DEF_ZONE_SKIP (0) |
Jens Axboe | a6ccc7b | 2006-06-02 10:14:15 +0200 | [diff] [blame] | 47 | #define DEF_RWMIX_CYCLE (500) |
| 48 | #define DEF_RWMIX_READ (50) |
Jens Axboe | b6f4d88 | 2006-06-02 10:32:51 +0200 | [diff] [blame] | 49 | #define DEF_NICE (0) |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 50 | #define DEF_NR_FILES (1) |
Jens Axboe | f6cbb26 | 2006-10-18 14:16:42 +0200 | [diff] [blame] | 51 | #define DEF_UNLINK (0) |
Jens Axboe | ec94ec5 | 2006-10-20 10:59:19 +0200 | [diff] [blame] | 52 | #define DEF_WRITE_BW_LOG (0) |
| 53 | #define DEF_WRITE_LAT_LOG (0) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 54 | |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 55 | #define td_var_offset(var) ((size_t) &((struct thread_data *)0)->var) |
| 56 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 57 | static int str_rw_cb(void *, const char *); |
| 58 | static int str_ioengine_cb(void *, const char *); |
| 59 | static int str_mem_cb(void *, const char *); |
| 60 | static int str_verify_cb(void *, const char *); |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 61 | static int str_lockmem_cb(void *, unsigned long *); |
| 62 | static int str_prio_cb(void *, unsigned int *); |
| 63 | static int str_prioclass_cb(void *, unsigned int *); |
| 64 | static int str_exitall_cb(void); |
| 65 | static int str_cpumask_cb(void *, unsigned int *); |
| 66 | |
| 67 | /* |
| 68 | * Map of job/command line options |
| 69 | */ |
| 70 | static struct fio_option options[] = { |
| 71 | { |
| 72 | .name = "name", |
| 73 | .type = FIO_OPT_STR_STORE, |
| 74 | .off1 = td_var_offset(name), |
| 75 | }, |
| 76 | { |
| 77 | .name = "directory", |
| 78 | .type = FIO_OPT_STR_STORE, |
| 79 | .off1 = td_var_offset(directory), |
| 80 | }, |
| 81 | { |
| 82 | .name = "filename", |
| 83 | .type = FIO_OPT_STR_STORE, |
| 84 | .off1 = td_var_offset(filename), |
| 85 | }, |
| 86 | { |
| 87 | .name = "rw", |
| 88 | .type = FIO_OPT_STR, |
| 89 | .cb = str_rw_cb, |
| 90 | }, |
| 91 | { |
| 92 | .name = "ioengine", |
| 93 | .type = FIO_OPT_STR, |
| 94 | .cb = str_ioengine_cb, |
| 95 | }, |
| 96 | { |
| 97 | .name = "mem", |
| 98 | .type = FIO_OPT_STR, |
| 99 | .cb = str_mem_cb, |
| 100 | }, |
| 101 | { |
| 102 | .name = "verify", |
| 103 | .type = FIO_OPT_STR, |
| 104 | .cb = str_verify_cb, |
| 105 | }, |
| 106 | { |
| 107 | .name = "write_iolog", |
Jens Axboe | 076efc7 | 2006-10-27 11:24:25 +0200 | [diff] [blame] | 108 | .type = FIO_OPT_STR_STORE, |
| 109 | .off1 = td_var_offset(write_iolog_file), |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 110 | }, |
| 111 | { |
Jens Axboe | 076efc7 | 2006-10-27 11:24:25 +0200 | [diff] [blame] | 112 | .name = "read_iolog", |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 113 | .type = FIO_OPT_STR_STORE, |
Jens Axboe | 076efc7 | 2006-10-27 11:24:25 +0200 | [diff] [blame] | 114 | .off1 = td_var_offset(read_iolog_file), |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 115 | }, |
| 116 | { |
| 117 | .name = "exec_prerun", |
| 118 | .type = FIO_OPT_STR_STORE, |
| 119 | .off1 = td_var_offset(exec_prerun), |
| 120 | }, |
| 121 | { |
| 122 | .name = "exec_postrun", |
| 123 | .type = FIO_OPT_STR_STORE, |
| 124 | .off1 = td_var_offset(exec_postrun), |
| 125 | }, |
| 126 | #ifdef FIO_HAVE_IOSCHED_SWITCH |
| 127 | { |
| 128 | .name = "ioscheduler", |
| 129 | .type = FIO_OPT_STR_STORE, |
| 130 | .off1 = td_var_offset(ioscheduler), |
| 131 | }, |
| 132 | #endif |
| 133 | { |
| 134 | .name = "size", |
| 135 | .type = FIO_OPT_STR_VAL, |
| 136 | .off1 = td_var_offset(total_file_size), |
| 137 | }, |
| 138 | { |
| 139 | .name = "bs", |
| 140 | .type = FIO_OPT_STR_VAL, |
| 141 | .off1 = td_var_offset(bs), |
| 142 | }, |
| 143 | { |
| 144 | .name = "offset", |
| 145 | .type = FIO_OPT_STR_VAL, |
| 146 | .off1 = td_var_offset(start_offset), |
| 147 | }, |
| 148 | { |
| 149 | .name = "zonesize", |
| 150 | .type = FIO_OPT_STR_VAL, |
| 151 | .off1 = td_var_offset(zone_size), |
| 152 | }, |
| 153 | { |
| 154 | .name = "zoneskip", |
| 155 | .type = FIO_OPT_STR_VAL, |
| 156 | .off1 = td_var_offset(zone_skip), |
| 157 | }, |
| 158 | { |
| 159 | .name = "lockmem", |
| 160 | .type = FIO_OPT_STR_VAL, |
| 161 | .cb = str_lockmem_cb, |
| 162 | }, |
| 163 | { |
| 164 | .name = "bsrange", |
| 165 | .type = FIO_OPT_RANGE, |
| 166 | .off1 = td_var_offset(min_bs), |
| 167 | .off2 = td_var_offset(max_bs), |
| 168 | }, |
| 169 | { |
| 170 | .name = "nrfiles", |
| 171 | .type = FIO_OPT_INT, |
| 172 | .off1 = td_var_offset(nr_files), |
| 173 | }, |
| 174 | { |
| 175 | .name = "iodepth", |
| 176 | .type = FIO_OPT_INT, |
| 177 | .off1 = td_var_offset(iodepth), |
| 178 | }, |
| 179 | { |
| 180 | .name = "fsync", |
| 181 | .type = FIO_OPT_INT, |
| 182 | .off1 = td_var_offset(fsync_blocks), |
| 183 | }, |
| 184 | { |
| 185 | .name = "rwmixcycle", |
| 186 | .type = FIO_OPT_INT, |
| 187 | .off1 = td_var_offset(rwmixcycle), |
| 188 | }, |
| 189 | { |
| 190 | .name = "rwmixread", |
| 191 | .type = FIO_OPT_INT, |
| 192 | .off1 = td_var_offset(rwmixread), |
| 193 | .max_val= 100, |
| 194 | }, |
| 195 | { |
| 196 | .name = "rwmixwrite", |
| 197 | .type = FIO_OPT_INT, |
| 198 | .off1 = td_var_offset(rwmixwrite), |
| 199 | .max_val= 100, |
| 200 | }, |
| 201 | { |
| 202 | .name = "nice", |
| 203 | .type = FIO_OPT_INT, |
| 204 | .off1 = td_var_offset(nice), |
| 205 | }, |
| 206 | #ifdef FIO_HAVE_IOPRIO |
| 207 | { |
| 208 | .name = "prio", |
| 209 | .type = FIO_OPT_INT, |
| 210 | .cb = str_prio_cb, |
| 211 | }, |
| 212 | { |
| 213 | .name = "prioclass", |
| 214 | .type = FIO_OPT_INT, |
| 215 | .cb = str_prioclass_cb, |
| 216 | }, |
| 217 | #endif |
| 218 | { |
| 219 | .name = "thinktime", |
| 220 | .type = FIO_OPT_INT, |
| 221 | .off1 = td_var_offset(thinktime) |
| 222 | }, |
| 223 | { |
| 224 | .name = "rate", |
| 225 | .type = FIO_OPT_INT, |
| 226 | .off1 = td_var_offset(rate) |
| 227 | }, |
| 228 | { |
| 229 | .name = "ratemin", |
| 230 | .type = FIO_OPT_INT, |
| 231 | .off1 = td_var_offset(ratemin) |
| 232 | }, |
| 233 | { |
| 234 | .name = "ratecycle", |
| 235 | .type = FIO_OPT_INT, |
| 236 | .off1 = td_var_offset(ratecycle) |
| 237 | }, |
| 238 | { |
| 239 | .name = "startdelay", |
| 240 | .type = FIO_OPT_INT, |
| 241 | .off1 = td_var_offset(start_delay) |
| 242 | }, |
| 243 | { |
| 244 | .name = "timeout", |
| 245 | .type = FIO_OPT_STR_VAL_TIME, |
| 246 | .off1 = td_var_offset(timeout) |
| 247 | }, |
| 248 | { |
| 249 | .name = "invalidate", |
| 250 | .type = FIO_OPT_INT, |
| 251 | .off1 = td_var_offset(invalidate_cache) |
| 252 | }, |
| 253 | { |
| 254 | .name = "sync", |
| 255 | .type = FIO_OPT_INT, |
| 256 | .off1 = td_var_offset(sync_io) |
| 257 | }, |
| 258 | { |
| 259 | .name = "bwavgtime", |
| 260 | .type = FIO_OPT_INT, |
| 261 | .off1 = td_var_offset(bw_avg_time) |
| 262 | }, |
| 263 | { |
| 264 | .name = "create_serialize", |
| 265 | .type = FIO_OPT_INT, |
| 266 | .off1 = td_var_offset(create_serialize) |
| 267 | }, |
| 268 | { |
| 269 | .name = "create_fsync", |
| 270 | .type = FIO_OPT_INT, |
| 271 | .off1 = td_var_offset(create_fsync) |
| 272 | }, |
| 273 | { |
| 274 | .name = "loops", |
| 275 | .type = FIO_OPT_INT, |
| 276 | .off1 = td_var_offset(loops) |
| 277 | }, |
| 278 | { |
| 279 | .name = "numjobs", |
| 280 | .type = FIO_OPT_INT, |
| 281 | .off1 = td_var_offset(numjobs) |
| 282 | }, |
| 283 | { |
| 284 | .name = "cpuload", |
| 285 | .type = FIO_OPT_INT, |
| 286 | .off1 = td_var_offset(cpuload) |
| 287 | }, |
| 288 | { |
| 289 | .name = "cpuchunks", |
| 290 | .type = FIO_OPT_INT, |
| 291 | .off1 = td_var_offset(cpucycle) |
| 292 | }, |
| 293 | { |
| 294 | .name = "direct", |
| 295 | .type = FIO_OPT_INT, |
| 296 | .off1 = td_var_offset(odirect) |
| 297 | }, |
| 298 | { |
| 299 | .name = "overwrite", |
| 300 | .type = FIO_OPT_INT, |
| 301 | .off1 = td_var_offset(overwrite) |
| 302 | }, |
| 303 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 304 | { |
| 305 | .name = "cpumask", |
| 306 | .type = FIO_OPT_INT, |
| 307 | .cb = str_cpumask_cb, |
| 308 | }, |
| 309 | #endif |
| 310 | { |
| 311 | .name = "end_fsync", |
| 312 | .type = FIO_OPT_INT, |
| 313 | .off1 = td_var_offset(end_fsync) |
| 314 | }, |
| 315 | { |
| 316 | .name = "unlink", |
| 317 | .type = FIO_OPT_STR_SET, |
| 318 | .off1 = td_var_offset(unlink), |
| 319 | }, |
| 320 | { |
| 321 | .name = "exitall", |
| 322 | .type = FIO_OPT_STR_SET, |
| 323 | .cb = str_exitall_cb, |
| 324 | }, |
| 325 | { |
| 326 | .name = "stonewall", |
| 327 | .type = FIO_OPT_STR_SET, |
| 328 | .off1 = td_var_offset(stonewall), |
| 329 | }, |
| 330 | { |
| 331 | .name = "thread", |
| 332 | .type = FIO_OPT_STR_SET, |
| 333 | .off1 = td_var_offset(thread), |
| 334 | }, |
| 335 | { |
| 336 | .name = "write_bw_log", |
| 337 | .type = FIO_OPT_STR_SET, |
| 338 | .off1 = td_var_offset(write_bw_log), |
| 339 | }, |
| 340 | { |
| 341 | .name = "write_lat_log", |
| 342 | .type = FIO_OPT_STR_SET, |
| 343 | .off1 = td_var_offset(write_lat_log), |
| 344 | }, |
| 345 | { |
| 346 | .name = NULL, |
| 347 | }, |
| 348 | }; |
| 349 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 350 | #define FIO_JOB_OPTS (sizeof(options) / sizeof(struct fio_option)) |
| 351 | #define FIO_CMD_OPTS (16) |
| 352 | #define FIO_GETOPT_JOB (0x89988998) |
| 353 | |
| 354 | /* |
| 355 | * Command line options. These will contain the above, plus a few |
| 356 | * extra that only pertain to fio itself and not jobs. |
| 357 | */ |
| 358 | static struct option long_options[FIO_JOB_OPTS + FIO_CMD_OPTS] = { |
| 359 | { |
| 360 | .name = "output", |
| 361 | .has_arg = required_argument, |
| 362 | .val = 'o', |
| 363 | }, |
| 364 | { |
| 365 | .name = "timeout", |
| 366 | .has_arg = required_argument, |
| 367 | .val = 't', |
| 368 | }, |
| 369 | { |
| 370 | .name = "latency-log", |
| 371 | .has_arg = required_argument, |
| 372 | .val = 'l', |
| 373 | }, |
| 374 | { |
| 375 | .name = "bandwidth-log", |
| 376 | .has_arg = required_argument, |
| 377 | .val = 'b', |
| 378 | }, |
| 379 | { |
| 380 | .name = "minimal", |
| 381 | .has_arg = optional_argument, |
| 382 | .val = 'm', |
| 383 | }, |
| 384 | { |
| 385 | .name = "version", |
| 386 | .has_arg = no_argument, |
| 387 | .val = 'v', |
| 388 | }, |
| 389 | { |
| 390 | .name = NULL, |
| 391 | }, |
| 392 | }; |
| 393 | |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 394 | static int def_timeout = DEF_TIMEOUT; |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 395 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 396 | static char fio_version_string[] = "fio 1.7"; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 397 | |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 398 | static char **ini_file; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 399 | static int max_jobs = MAX_JOBS; |
| 400 | |
| 401 | struct thread_data def_thread; |
| 402 | struct thread_data *threads = NULL; |
| 403 | |
| 404 | int rate_quit = 0; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 405 | int exitall_on_terminate = 0; |
Jens Axboe | c6ae0a5 | 2006-06-12 11:04:44 +0200 | [diff] [blame] | 406 | int terse_output = 0; |
Jens Axboe | c04f7ec | 2006-05-31 10:13:16 +0200 | [diff] [blame] | 407 | unsigned long long mlock_size = 0; |
Jens Axboe | eb8bbf4 | 2006-06-08 21:40:11 +0200 | [diff] [blame] | 408 | FILE *f_out = NULL; |
| 409 | FILE *f_err = NULL; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 410 | |
Jens Axboe | ec94ec5 | 2006-10-20 10:59:19 +0200 | [diff] [blame] | 411 | static int write_lat_log = DEF_WRITE_LAT_LOG; |
| 412 | static int write_bw_log = DEF_WRITE_BW_LOG; |
| 413 | |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 414 | /* |
| 415 | * Return a free job structure. |
| 416 | */ |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 417 | static struct thread_data *get_new_job(int global, struct thread_data *parent) |
| 418 | { |
| 419 | struct thread_data *td; |
| 420 | |
| 421 | if (global) |
| 422 | return &def_thread; |
| 423 | if (thread_number >= max_jobs) |
| 424 | return NULL; |
| 425 | |
| 426 | td = &threads[thread_number++]; |
Jens Axboe | ddaeaa5 | 2006-06-08 11:00:58 +0200 | [diff] [blame] | 427 | *td = *parent; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 428 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 429 | td->thread_number = thread_number; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 430 | return td; |
| 431 | } |
| 432 | |
| 433 | static void put_job(struct thread_data *td) |
| 434 | { |
| 435 | memset(&threads[td->thread_number - 1], 0, sizeof(*td)); |
| 436 | thread_number--; |
| 437 | } |
| 438 | |
Jens Axboe | dad915e | 2006-10-27 11:10:18 +0200 | [diff] [blame] | 439 | /* |
| 440 | * Lazy way of fixing up options that depend on each other. We could also |
| 441 | * define option callback handlers, but this is easier. |
| 442 | */ |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 443 | static void fixup_options(struct thread_data *td) |
| 444 | { |
| 445 | if (!td->min_bs) |
| 446 | td->min_bs = td->bs; |
| 447 | if (!td->max_bs) |
| 448 | td->max_bs = td->bs; |
| 449 | |
| 450 | if (!td->rwmixread && td->rwmixwrite) |
| 451 | td->rwmixread = 100 - td->rwmixwrite; |
Jens Axboe | dad915e | 2006-10-27 11:10:18 +0200 | [diff] [blame] | 452 | |
Jens Axboe | 076efc7 | 2006-10-27 11:24:25 +0200 | [diff] [blame] | 453 | if (td->write_iolog_file && td->read_iolog_file) { |
| 454 | log_err("fio: read iolog overrides write_iolog\n"); |
| 455 | free(td->write_iolog_file); |
| 456 | td->write_iolog_file = NULL; |
| 457 | } |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 458 | } |
| 459 | |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 460 | /* |
| 461 | * Adds a job to the list of things todo. Sanitizes the various options |
| 462 | * to make sure we don't have conflicts, and initializes various |
| 463 | * members of td. |
| 464 | */ |
Jens Axboe | 7515484 | 2006-06-01 13:56:09 +0200 | [diff] [blame] | 465 | static int add_job(struct thread_data *td, const char *jobname, int job_add_num) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 466 | { |
Jens Axboe | 3d60d1e | 2006-05-25 06:31:06 +0200 | [diff] [blame] | 467 | char *ddir_str[] = { "read", "write", "randread", "randwrite", |
| 468 | "rw", NULL, "randrw" }; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 469 | struct stat sb; |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 470 | int numjobs, ddir, i; |
| 471 | struct fio_file *f; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 472 | |
| 473 | #ifndef FIO_HAVE_LIBAIO |
| 474 | if (td->io_engine == FIO_LIBAIO) { |
Jens Axboe | 3b70d7e | 2006-06-08 21:48:46 +0200 | [diff] [blame] | 475 | log_err("Linux libaio not available\n"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 476 | return 1; |
| 477 | } |
| 478 | #endif |
| 479 | #ifndef FIO_HAVE_POSIXAIO |
| 480 | if (td->io_engine == FIO_POSIXAIO) { |
Jens Axboe | 3b70d7e | 2006-06-08 21:48:46 +0200 | [diff] [blame] | 481 | log_err("posix aio not available\n"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 482 | return 1; |
| 483 | } |
| 484 | #endif |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 485 | |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 486 | fixup_options(td); |
| 487 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 488 | /* |
| 489 | * the def_thread is just for options, it's not a real job |
| 490 | */ |
| 491 | if (td == &def_thread) |
| 492 | return 0; |
| 493 | |
Jens Axboe | df64119 | 2006-10-12 07:55:41 +0200 | [diff] [blame] | 494 | /* |
| 495 | * Set default io engine, if none set |
| 496 | */ |
| 497 | if (!td->io_ops) { |
| 498 | td->io_ops = load_ioengine(td, DEF_IO_ENGINE_NAME); |
| 499 | if (!td->io_ops) { |
| 500 | log_err("default engine %s not there?\n", DEF_IO_ENGINE_NAME); |
| 501 | return 1; |
| 502 | } |
| 503 | } |
| 504 | |
Jens Axboe | 2866c82 | 2006-10-09 15:57:48 +0200 | [diff] [blame] | 505 | if (td->io_ops->flags & FIO_SYNCIO) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 506 | td->iodepth = 1; |
| 507 | else { |
| 508 | if (!td->iodepth) |
Jens Axboe | 841ddd1 | 2006-10-20 09:07:46 +0200 | [diff] [blame] | 509 | td->iodepth = td->nr_files; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 510 | } |
| 511 | |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 512 | /* |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 513 | * only really works for sequential io for now, and with 1 file |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 514 | */ |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 515 | if (td->zone_size && !td->sequential && td->nr_files == 1) |
Jens Axboe | 20dc95c | 2005-12-09 10:29:35 +0100 | [diff] [blame] | 516 | td->zone_size = 0; |
| 517 | |
Jens Axboe | 9cc935a | 2006-06-13 09:11:18 +0200 | [diff] [blame] | 518 | /* |
| 519 | * Reads can do overwrites, we always need to pre-create the file |
| 520 | */ |
| 521 | if (td_read(td) || td_rw(td)) |
| 522 | td->overwrite = 1; |
| 523 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 524 | td->filetype = FIO_TYPE_FILE; |
Jens Axboe | 0af7b54 | 2006-02-17 10:10:12 +0100 | [diff] [blame] | 525 | if (!stat(jobname, &sb)) { |
| 526 | if (S_ISBLK(sb.st_mode)) |
| 527 | td->filetype = FIO_TYPE_BD; |
| 528 | else if (S_ISCHR(sb.st_mode)) |
| 529 | td->filetype = FIO_TYPE_CHAR; |
| 530 | } |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 531 | |
Jens Axboe | b2a1519 | 2006-10-18 14:10:42 +0200 | [diff] [blame] | 532 | if (td->odirect) |
| 533 | td->io_ops->flags |= FIO_RAWIO; |
| 534 | |
Jens Axboe | 13f8e2d | 2006-10-24 09:29:45 +0200 | [diff] [blame] | 535 | if (td->filename) |
| 536 | td->nr_uniq_files = 1; |
| 537 | else |
| 538 | td->nr_uniq_files = td->nr_files; |
| 539 | |
| 540 | if (td->filetype == FIO_TYPE_FILE || td->filename) { |
Jens Axboe | e9c047a | 2006-06-07 21:13:04 +0200 | [diff] [blame] | 541 | char tmp[PATH_MAX]; |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 542 | int len = 0; |
| 543 | int i; |
Jens Axboe | e9c047a | 2006-06-07 21:13:04 +0200 | [diff] [blame] | 544 | |
Jens Axboe | ef899b6 | 2006-06-06 09:31:00 +0200 | [diff] [blame] | 545 | if (td->directory && td->directory[0] != '\0') |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 546 | sprintf(tmp, "%s/", td->directory); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 547 | |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 548 | td->files = malloc(sizeof(struct fio_file) * td->nr_files); |
| 549 | |
| 550 | for_each_file(td, f, i) { |
| 551 | memset(f, 0, sizeof(*f)); |
| 552 | f->fd = -1; |
| 553 | |
Jens Axboe | 13f8e2d | 2006-10-24 09:29:45 +0200 | [diff] [blame] | 554 | if (td->filename) |
| 555 | sprintf(tmp + len, "%s", td->filename); |
| 556 | else |
| 557 | sprintf(tmp + len, "%s.%d.%d", jobname, td->thread_number, i); |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 558 | f->file_name = strdup(tmp); |
| 559 | } |
| 560 | } else { |
| 561 | td->nr_files = 1; |
| 562 | td->files = malloc(sizeof(struct fio_file)); |
| 563 | f = &td->files[0]; |
| 564 | |
| 565 | memset(f, 0, sizeof(*f)); |
| 566 | f->fd = -1; |
| 567 | f->file_name = strdup(jobname); |
| 568 | } |
| 569 | |
| 570 | for_each_file(td, f, i) { |
| 571 | f->file_size = td->total_file_size / td->nr_files; |
| 572 | f->file_offset = td->start_offset; |
| 573 | } |
| 574 | |
Jens Axboe | bbfd6b0 | 2006-06-07 19:42:54 +0200 | [diff] [blame] | 575 | fio_sem_init(&td->mutex, 0); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 576 | |
| 577 | td->clat_stat[0].min_val = td->clat_stat[1].min_val = ULONG_MAX; |
| 578 | td->slat_stat[0].min_val = td->slat_stat[1].min_val = ULONG_MAX; |
| 579 | td->bw_stat[0].min_val = td->bw_stat[1].min_val = ULONG_MAX; |
| 580 | |
| 581 | if (td->min_bs == -1U) |
| 582 | td->min_bs = td->bs; |
| 583 | if (td->max_bs == -1U) |
| 584 | td->max_bs = td->bs; |
Jens Axboe | 3d60d1e | 2006-05-25 06:31:06 +0200 | [diff] [blame] | 585 | if (td_read(td) && !td_rw(td)) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 586 | td->verify = 0; |
| 587 | |
| 588 | if (td->stonewall && td->thread_number > 1) |
| 589 | groupid++; |
| 590 | |
| 591 | td->groupid = groupid; |
| 592 | |
| 593 | if (setup_rate(td)) |
| 594 | goto err; |
| 595 | |
Jens Axboe | ec94ec5 | 2006-10-20 10:59:19 +0200 | [diff] [blame] | 596 | if (td->write_lat_log) { |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 597 | setup_log(&td->slat_log); |
| 598 | setup_log(&td->clat_log); |
| 599 | } |
Jens Axboe | ec94ec5 | 2006-10-20 10:59:19 +0200 | [diff] [blame] | 600 | if (td->write_bw_log) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 601 | setup_log(&td->bw_log); |
| 602 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 603 | if (!td->name) |
| 604 | td->name = strdup(jobname); |
Jens Axboe | 0145205 | 2006-06-07 10:29:47 +0200 | [diff] [blame] | 605 | |
Jens Axboe | 3d60d1e | 2006-05-25 06:31:06 +0200 | [diff] [blame] | 606 | ddir = td->ddir + (!td->sequential << 1) + (td->iomix << 2); |
Jens Axboe | 7515484 | 2006-06-01 13:56:09 +0200 | [diff] [blame] | 607 | |
Jens Axboe | c6ae0a5 | 2006-06-12 11:04:44 +0200 | [diff] [blame] | 608 | if (!terse_output) { |
Jens Axboe | b990b5c | 2006-09-14 09:48:22 +0200 | [diff] [blame] | 609 | if (!job_add_num) { |
Jens Axboe | 2866c82 | 2006-10-09 15:57:48 +0200 | [diff] [blame] | 610 | if (td->io_ops->flags & FIO_CPUIO) |
Jens Axboe | b990b5c | 2006-09-14 09:48:22 +0200 | [diff] [blame] | 611 | fprintf(f_out, "%s: ioengine=cpu, cpuload=%u, cpucycle=%u\n", td->name, td->cpuload, td->cpucycle); |
| 612 | else |
Jens Axboe | 2866c82 | 2006-10-09 15:57:48 +0200 | [diff] [blame] | 613 | fprintf(f_out, "%s: (g=%d): rw=%s, odir=%d, bs=%d-%d, rate=%d, ioengine=%s, iodepth=%d\n", td->name, td->groupid, ddir_str[ddir], td->odirect, td->min_bs, td->max_bs, td->rate, td->io_ops->name, td->iodepth); |
Jens Axboe | b990b5c | 2006-09-14 09:48:22 +0200 | [diff] [blame] | 614 | } else if (job_add_num == 1) |
Jens Axboe | c6ae0a5 | 2006-06-12 11:04:44 +0200 | [diff] [blame] | 615 | fprintf(f_out, "...\n"); |
| 616 | } |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 617 | |
| 618 | /* |
| 619 | * recurse add identical jobs, clear numjobs and stonewall options |
| 620 | * as they don't apply to sub-jobs |
| 621 | */ |
| 622 | numjobs = td->numjobs; |
| 623 | while (--numjobs) { |
| 624 | struct thread_data *td_new = get_new_job(0, td); |
| 625 | |
| 626 | if (!td_new) |
| 627 | goto err; |
| 628 | |
| 629 | td_new->numjobs = 1; |
| 630 | td_new->stonewall = 0; |
Jens Axboe | 7515484 | 2006-06-01 13:56:09 +0200 | [diff] [blame] | 631 | job_add_num = numjobs - 1; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 632 | |
Jens Axboe | 7515484 | 2006-06-01 13:56:09 +0200 | [diff] [blame] | 633 | if (add_job(td_new, jobname, job_add_num)) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 634 | goto err; |
| 635 | } |
| 636 | return 0; |
| 637 | err: |
| 638 | put_job(td); |
| 639 | return -1; |
| 640 | } |
| 641 | |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 642 | /* |
| 643 | * Initialize the various random states we need (random io, block size ranges, |
| 644 | * read/write mix, etc). |
| 645 | */ |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 646 | int init_random_state(struct thread_data *td) |
| 647 | { |
Jens Axboe | a6ccc7b | 2006-06-02 10:14:15 +0200 | [diff] [blame] | 648 | unsigned long seeds[4]; |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 649 | int fd, num_maps, blocks, i; |
Jens Axboe | 0ab8db8 | 2006-10-18 17:16:23 +0200 | [diff] [blame] | 650 | struct fio_file *f; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 651 | |
Jens Axboe | f48b467 | 2006-10-27 11:30:07 +0200 | [diff] [blame] | 652 | if (td->io_ops->flags & FIO_CPUIO) |
| 653 | return 0; |
| 654 | |
Jens Axboe | 1ac267b | 2006-05-31 20:29:00 +0200 | [diff] [blame] | 655 | fd = open("/dev/urandom", O_RDONLY); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 656 | if (fd == -1) { |
| 657 | td_verror(td, errno); |
| 658 | return 1; |
| 659 | } |
| 660 | |
Jens Axboe | a6ccc7b | 2006-06-02 10:14:15 +0200 | [diff] [blame] | 661 | if (read(fd, seeds, sizeof(seeds)) < (int) sizeof(seeds)) { |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 662 | td_verror(td, EIO); |
| 663 | close(fd); |
| 664 | return 1; |
| 665 | } |
| 666 | |
| 667 | close(fd); |
| 668 | |
Jens Axboe | 6dfd46b | 2006-06-07 13:57:06 +0200 | [diff] [blame] | 669 | os_random_seed(seeds[0], &td->bsrange_state); |
| 670 | os_random_seed(seeds[1], &td->verify_state); |
| 671 | os_random_seed(seeds[2], &td->rwmix_state); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 672 | |
| 673 | if (td->sequential) |
| 674 | return 0; |
| 675 | |
Jens Axboe | 9ebc27e | 2006-06-12 10:21:50 +0200 | [diff] [blame] | 676 | if (td->rand_repeatable) |
Jens Axboe | a6ccc7b | 2006-06-02 10:14:15 +0200 | [diff] [blame] | 677 | seeds[3] = DEF_RANDSEED; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 678 | |
Jens Axboe | 0ab8db8 | 2006-10-18 17:16:23 +0200 | [diff] [blame] | 679 | for_each_file(td, f, i) { |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 680 | blocks = (f->file_size + td->min_bs - 1) / td->min_bs; |
| 681 | num_maps = blocks / BLOCKS_PER_MAP; |
| 682 | f->file_map = malloc(num_maps * sizeof(long)); |
| 683 | f->num_maps = num_maps; |
| 684 | memset(f->file_map, 0, num_maps * sizeof(long)); |
| 685 | } |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 686 | |
Jens Axboe | 6dfd46b | 2006-06-07 13:57:06 +0200 | [diff] [blame] | 687 | os_random_seed(seeds[3], &td->random_state); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 688 | return 0; |
| 689 | } |
| 690 | |
| 691 | static void fill_cpu_mask(os_cpu_mask_t cpumask, int cpu) |
| 692 | { |
| 693 | #ifdef FIO_HAVE_CPU_AFFINITY |
| 694 | unsigned int i; |
| 695 | |
| 696 | CPU_ZERO(&cpumask); |
| 697 | |
| 698 | for (i = 0; i < sizeof(int) * 8; i++) { |
| 699 | if ((1 << i) & cpu) |
| 700 | CPU_SET(i, &cpumask); |
| 701 | } |
| 702 | #endif |
| 703 | } |
| 704 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 705 | static int is_empty_or_comment(char *line) |
| 706 | { |
| 707 | unsigned int i; |
| 708 | |
| 709 | for (i = 0; i < strlen(line); i++) { |
| 710 | if (line[i] == ';') |
| 711 | return 1; |
| 712 | if (!isspace(line[i]) && !iscntrl(line[i])) |
| 713 | return 0; |
| 714 | } |
| 715 | |
| 716 | return 1; |
| 717 | } |
| 718 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 719 | static int str_rw_cb(void *data, const char *mem) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 720 | { |
Jens Axboe | cb2c86f | 2006-10-26 13:48:34 +0200 | [diff] [blame] | 721 | struct thread_data *td = data; |
| 722 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 723 | if (!strncmp(mem, "read", 4) || !strncmp(mem, "0", 1)) { |
| 724 | td->ddir = DDIR_READ; |
| 725 | td->sequential = 1; |
| 726 | return 0; |
| 727 | } else if (!strncmp(mem, "randread", 8)) { |
| 728 | td->ddir = DDIR_READ; |
| 729 | td->sequential = 0; |
| 730 | return 0; |
| 731 | } else if (!strncmp(mem, "write", 5) || !strncmp(mem, "1", 1)) { |
| 732 | td->ddir = DDIR_WRITE; |
| 733 | td->sequential = 1; |
| 734 | return 0; |
| 735 | } else if (!strncmp(mem, "randwrite", 9)) { |
| 736 | td->ddir = DDIR_WRITE; |
| 737 | td->sequential = 0; |
| 738 | return 0; |
Jens Axboe | 3d60d1e | 2006-05-25 06:31:06 +0200 | [diff] [blame] | 739 | } else if (!strncmp(mem, "rw", 2)) { |
| 740 | td->ddir = 0; |
| 741 | td->iomix = 1; |
| 742 | td->sequential = 1; |
| 743 | return 0; |
| 744 | } else if (!strncmp(mem, "randrw", 6)) { |
| 745 | td->ddir = 0; |
| 746 | td->iomix = 1; |
| 747 | td->sequential = 0; |
| 748 | return 0; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 749 | } |
| 750 | |
Jens Axboe | 3b70d7e | 2006-06-08 21:48:46 +0200 | [diff] [blame] | 751 | log_err("fio: data direction: read, write, randread, randwrite, rw, randrw\n"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 752 | return 1; |
| 753 | } |
| 754 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 755 | static int str_verify_cb(void *data, const char *mem) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 756 | { |
Jens Axboe | cb2c86f | 2006-10-26 13:48:34 +0200 | [diff] [blame] | 757 | struct thread_data *td = data; |
| 758 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 759 | if (!strncmp(mem, "0", 1)) { |
| 760 | td->verify = VERIFY_NONE; |
| 761 | return 0; |
| 762 | } else if (!strncmp(mem, "md5", 3) || !strncmp(mem, "1", 1)) { |
| 763 | td->verify = VERIFY_MD5; |
| 764 | return 0; |
| 765 | } else if (!strncmp(mem, "crc32", 5)) { |
| 766 | td->verify = VERIFY_CRC32; |
| 767 | return 0; |
| 768 | } |
| 769 | |
Jens Axboe | 3b70d7e | 2006-06-08 21:48:46 +0200 | [diff] [blame] | 770 | log_err("fio: verify types: md5, crc32\n"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 771 | return 1; |
| 772 | } |
| 773 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 774 | static int str_mem_cb(void *data, const char *mem) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 775 | { |
Jens Axboe | cb2c86f | 2006-10-26 13:48:34 +0200 | [diff] [blame] | 776 | struct thread_data *td = data; |
| 777 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 778 | if (!strncmp(mem, "malloc", 6)) { |
| 779 | td->mem_type = MEM_MALLOC; |
| 780 | return 0; |
| 781 | } else if (!strncmp(mem, "shm", 3)) { |
| 782 | td->mem_type = MEM_SHM; |
| 783 | return 0; |
| 784 | } else if (!strncmp(mem, "mmap", 4)) { |
| 785 | td->mem_type = MEM_MMAP; |
| 786 | return 0; |
| 787 | } |
| 788 | |
Jens Axboe | 3b70d7e | 2006-06-08 21:48:46 +0200 | [diff] [blame] | 789 | log_err("fio: mem type: malloc, shm, mmap\n"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 790 | return 1; |
| 791 | } |
| 792 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 793 | static int str_ioengine_cb(void *data, const char *str) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 794 | { |
Jens Axboe | cb2c86f | 2006-10-26 13:48:34 +0200 | [diff] [blame] | 795 | struct thread_data *td = data; |
| 796 | |
Jens Axboe | 2866c82 | 2006-10-09 15:57:48 +0200 | [diff] [blame] | 797 | td->io_ops = load_ioengine(td, str); |
| 798 | if (td->io_ops) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 799 | return 0; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 800 | |
Jens Axboe | b990b5c | 2006-09-14 09:48:22 +0200 | [diff] [blame] | 801 | log_err("fio: ioengine: { linuxaio, aio, libaio }, posixaio, sync, mmap, sgio, splice, cpu\n"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 802 | return 1; |
| 803 | } |
| 804 | |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 805 | static int str_lockmem_cb(void fio_unused *data, unsigned long *val) |
| 806 | { |
| 807 | mlock_size = *val; |
| 808 | return 0; |
| 809 | } |
| 810 | |
| 811 | static int str_prioclass_cb(void *data, unsigned int *val) |
| 812 | { |
| 813 | struct thread_data *td = data; |
| 814 | |
| 815 | td->ioprio |= *val << IOPRIO_CLASS_SHIFT; |
| 816 | return 0; |
| 817 | } |
| 818 | |
| 819 | static int str_prio_cb(void *data, unsigned int *val) |
| 820 | { |
| 821 | struct thread_data *td = data; |
| 822 | |
| 823 | td->ioprio |= *val; |
| 824 | return 0; |
| 825 | } |
| 826 | |
| 827 | static int str_exitall_cb(void) |
| 828 | { |
| 829 | exitall_on_terminate = 1; |
| 830 | return 0; |
| 831 | } |
| 832 | |
| 833 | static int str_cpumask_cb(void *data, unsigned int *val) |
| 834 | { |
| 835 | struct thread_data *td = data; |
| 836 | |
| 837 | fill_cpu_mask(td->cpumask, *val); |
| 838 | return 0; |
| 839 | } |
| 840 | |
Jens Axboe | 0726198 | 2006-06-07 10:51:12 +0200 | [diff] [blame] | 841 | /* |
| 842 | * This is our [ini] type file parser. |
| 843 | */ |
Jens Axboe | 0c7e37a | 2006-06-13 14:53:38 +0200 | [diff] [blame] | 844 | int parse_jobs_ini(char *file, int stonewall_flag) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 845 | { |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 846 | unsigned int global; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 847 | struct thread_data *td; |
Jens Axboe | ef899b6 | 2006-06-06 09:31:00 +0200 | [diff] [blame] | 848 | char *string, *name, *tmpbuf; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 849 | fpos_t off; |
| 850 | FILE *f; |
| 851 | char *p; |
Jens Axboe | 0c7e37a | 2006-06-13 14:53:38 +0200 | [diff] [blame] | 852 | int ret = 0, stonewall; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 853 | |
| 854 | f = fopen(file, "r"); |
| 855 | if (!f) { |
Jens Axboe | aea47d4 | 2006-05-26 19:27:29 +0200 | [diff] [blame] | 856 | perror("fopen job file"); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 857 | return 1; |
| 858 | } |
| 859 | |
| 860 | string = malloc(4096); |
| 861 | name = malloc(256); |
Jens Axboe | ef899b6 | 2006-06-06 09:31:00 +0200 | [diff] [blame] | 862 | tmpbuf = malloc(4096); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 863 | |
Jens Axboe | 0c7e37a | 2006-06-13 14:53:38 +0200 | [diff] [blame] | 864 | stonewall = stonewall_flag; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 865 | while ((p = fgets(string, 4096, f)) != NULL) { |
Jens Axboe | 45410ac | 2006-06-07 11:10:39 +0200 | [diff] [blame] | 866 | if (ret) |
| 867 | break; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 868 | if (is_empty_or_comment(p)) |
| 869 | continue; |
| 870 | if (sscanf(p, "[%s]", name) != 1) |
| 871 | continue; |
| 872 | |
| 873 | global = !strncmp(name, "global", 6); |
| 874 | |
| 875 | name[strlen(name) - 1] = '\0'; |
| 876 | |
| 877 | td = get_new_job(global, &def_thread); |
Jens Axboe | 45410ac | 2006-06-07 11:10:39 +0200 | [diff] [blame] | 878 | if (!td) { |
| 879 | ret = 1; |
| 880 | break; |
| 881 | } |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 882 | |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 883 | /* |
| 884 | * Seperate multiple job files by a stonewall |
| 885 | */ |
Jens Axboe | f948191 | 2006-06-09 11:37:28 +0200 | [diff] [blame] | 886 | if (!global && stonewall) { |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 887 | td->stonewall = stonewall; |
| 888 | stonewall = 0; |
| 889 | } |
| 890 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 891 | fgetpos(f, &off); |
| 892 | while ((p = fgets(string, 4096, f)) != NULL) { |
| 893 | if (is_empty_or_comment(p)) |
| 894 | continue; |
| 895 | if (strstr(p, "[")) |
| 896 | break; |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 897 | |
Jens Axboe | b6754f9 | 2006-05-30 14:29:32 +0200 | [diff] [blame] | 898 | strip_blank_front(&p); |
Jens Axboe | 4ae3f76 | 2006-05-30 13:35:14 +0200 | [diff] [blame] | 899 | strip_blank_end(p); |
Jens Axboe | aea47d4 | 2006-05-26 19:27:29 +0200 | [diff] [blame] | 900 | |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 901 | fgetpos(f, &off); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 902 | |
Jens Axboe | 45410ac | 2006-06-07 11:10:39 +0200 | [diff] [blame] | 903 | /* |
| 904 | * Don't break here, continue parsing options so we |
| 905 | * dump all the bad ones. Makes trial/error fixups |
| 906 | * easier on the user. |
| 907 | */ |
Jens Axboe | e1f3650 | 2006-10-27 10:54:08 +0200 | [diff] [blame] | 908 | ret = parse_option(p, options, td); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 909 | } |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 910 | |
Jens Axboe | 45410ac | 2006-06-07 11:10:39 +0200 | [diff] [blame] | 911 | if (!ret) { |
| 912 | fsetpos(f, &off); |
| 913 | ret = add_job(td, name, 0); |
| 914 | } |
| 915 | if (ret) |
| 916 | break; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 917 | } |
| 918 | |
| 919 | free(string); |
| 920 | free(name); |
Jens Axboe | ef899b6 | 2006-06-06 09:31:00 +0200 | [diff] [blame] | 921 | free(tmpbuf); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 922 | fclose(f); |
Jens Axboe | 45410ac | 2006-06-07 11:10:39 +0200 | [diff] [blame] | 923 | return ret; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 924 | } |
| 925 | |
| 926 | static int fill_def_thread(void) |
| 927 | { |
| 928 | memset(&def_thread, 0, sizeof(def_thread)); |
| 929 | |
| 930 | if (fio_getaffinity(getpid(), &def_thread.cpumask) == -1) { |
| 931 | perror("sched_getaffinity"); |
| 932 | return 1; |
| 933 | } |
| 934 | |
| 935 | /* |
| 936 | * fill globals |
| 937 | */ |
| 938 | def_thread.ddir = DDIR_READ; |
Jens Axboe | 3d60d1e | 2006-05-25 06:31:06 +0200 | [diff] [blame] | 939 | def_thread.iomix = 0; |
Jens Axboe | 9ebc27e | 2006-06-12 10:21:50 +0200 | [diff] [blame] | 940 | def_thread.bs = DEF_BS; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 941 | def_thread.min_bs = -1; |
| 942 | def_thread.max_bs = -1; |
Jens Axboe | 9ebc27e | 2006-06-12 10:21:50 +0200 | [diff] [blame] | 943 | def_thread.odirect = DEF_ODIRECT; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 944 | def_thread.ratecycle = DEF_RATE_CYCLE; |
Jens Axboe | 9ebc27e | 2006-06-12 10:21:50 +0200 | [diff] [blame] | 945 | def_thread.sequential = DEF_SEQUENTIAL; |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 946 | def_thread.timeout = def_timeout; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 947 | def_thread.overwrite = DEF_OVERWRITE; |
| 948 | def_thread.invalidate_cache = DEF_INVALIDATE; |
| 949 | def_thread.sync_io = DEF_SYNCIO; |
| 950 | def_thread.mem_type = MEM_MALLOC; |
| 951 | def_thread.bw_avg_time = DEF_BWAVGTIME; |
| 952 | def_thread.create_serialize = DEF_CREATE_SER; |
| 953 | def_thread.create_fsync = DEF_CREATE_FSYNC; |
| 954 | def_thread.loops = DEF_LOOPS; |
| 955 | def_thread.verify = DEF_VERIFY; |
| 956 | def_thread.stonewall = DEF_STONEWALL; |
| 957 | def_thread.numjobs = DEF_NUMJOBS; |
| 958 | def_thread.use_thread = DEF_USE_THREAD; |
Jens Axboe | a6ccc7b | 2006-06-02 10:14:15 +0200 | [diff] [blame] | 959 | def_thread.rwmixcycle = DEF_RWMIX_CYCLE; |
| 960 | def_thread.rwmixread = DEF_RWMIX_READ; |
Jens Axboe | b6f4d88 | 2006-06-02 10:32:51 +0200 | [diff] [blame] | 961 | def_thread.nice = DEF_NICE; |
Jens Axboe | 9ebc27e | 2006-06-12 10:21:50 +0200 | [diff] [blame] | 962 | def_thread.rand_repeatable = DEF_RAND_REPEAT; |
Jens Axboe | 53cdc68 | 2006-10-18 11:50:58 +0200 | [diff] [blame] | 963 | def_thread.nr_files = DEF_NR_FILES; |
Jens Axboe | f6cbb26 | 2006-10-18 14:16:42 +0200 | [diff] [blame] | 964 | def_thread.unlink = DEF_UNLINK; |
Jens Axboe | ec94ec5 | 2006-10-20 10:59:19 +0200 | [diff] [blame] | 965 | def_thread.write_bw_log = write_bw_log; |
| 966 | def_thread.write_lat_log = write_lat_log; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 967 | #ifdef FIO_HAVE_DISK_UTIL |
| 968 | def_thread.do_disk_util = 1; |
| 969 | #endif |
| 970 | |
| 971 | return 0; |
| 972 | } |
| 973 | |
Jens Axboe | 0ab8db8 | 2006-10-18 17:16:23 +0200 | [diff] [blame] | 974 | static void usage(void) |
Jens Axboe | 4785f99 | 2006-05-26 03:59:10 +0200 | [diff] [blame] | 975 | { |
| 976 | printf("%s\n", fio_version_string); |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 977 | printf("\t--output\tWrite output to file\n"); |
| 978 | printf("\t--timeout\tRuntime in seconds\n"); |
| 979 | printf("\t--latency-log\tGenerate per-job latency logs\n"); |
| 980 | printf("\t--bandwidth-log\tGenerate per-job bandwidth logs\n"); |
| 981 | printf("\t--minimal\tMinimal (terse) output\n"); |
| 982 | printf("\t--version\tPrint version info and exit\n"); |
Jens Axboe | 4785f99 | 2006-05-26 03:59:10 +0200 | [diff] [blame] | 983 | } |
| 984 | |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 985 | static int parse_cmd_line(int argc, char *argv[]) |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 986 | { |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 987 | struct thread_data *td = NULL; |
Jens Axboe | c2b1e75 | 2006-10-30 09:03:13 +0100 | [diff] [blame^] | 988 | int c, ini_idx = 0, lidx, ret; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 989 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 990 | while ((c = getopt_long(argc, argv, "", long_options, &lidx)) != -1) { |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 991 | switch (c) { |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 992 | case 't': |
| 993 | def_timeout = atoi(optarg); |
| 994 | break; |
| 995 | case 'l': |
| 996 | write_lat_log = 1; |
| 997 | break; |
| 998 | case 'w': |
| 999 | write_bw_log = 1; |
| 1000 | break; |
| 1001 | case 'o': |
| 1002 | f_out = fopen(optarg, "w+"); |
| 1003 | if (!f_out) { |
| 1004 | perror("fopen output"); |
| 1005 | exit(1); |
| 1006 | } |
| 1007 | f_err = f_out; |
| 1008 | break; |
| 1009 | case 'm': |
| 1010 | terse_output = 1; |
| 1011 | break; |
| 1012 | case 'h': |
| 1013 | usage(); |
| 1014 | exit(0); |
| 1015 | case 'v': |
| 1016 | printf("%s\n", fio_version_string); |
| 1017 | exit(0); |
| 1018 | case FIO_GETOPT_JOB: { |
| 1019 | const char *opt = long_options[lidx].name; |
| 1020 | char *val = optarg; |
| 1021 | |
Jens Axboe | c2b1e75 | 2006-10-30 09:03:13 +0100 | [diff] [blame^] | 1022 | if (!strncmp(opt, "name", 4) && td) { |
| 1023 | ret = add_job(td, td->name ?: "fio", 0); |
| 1024 | if (ret) { |
| 1025 | put_job(td); |
| 1026 | return 0; |
| 1027 | } |
| 1028 | td = NULL; |
| 1029 | } |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1030 | if (!td) { |
Jens Axboe | c2b1e75 | 2006-10-30 09:03:13 +0100 | [diff] [blame^] | 1031 | int global = !strncmp(opt, "global", 6); |
| 1032 | |
| 1033 | td = get_new_job(global, &def_thread); |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1034 | if (!td) |
| 1035 | return 0; |
| 1036 | } |
| 1037 | if (parse_cmd_option(opt, val, options, td)) |
| 1038 | printf("foo\n"); |
| 1039 | break; |
| 1040 | } |
| 1041 | default: |
| 1042 | printf("optarg <<%s>>\n", argv[optind]); |
| 1043 | break; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1044 | } |
| 1045 | } |
Jens Axboe | c9fad89 | 2006-05-27 17:26:50 +0200 | [diff] [blame] | 1046 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1047 | if (td) { |
Jens Axboe | c2b1e75 | 2006-10-30 09:03:13 +0100 | [diff] [blame^] | 1048 | ret = add_job(td, td->name ?: "fio", 0); |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1049 | if (ret) |
| 1050 | put_job(td); |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1051 | } |
Jens Axboe | 774a617 | 2006-08-24 08:44:26 +0200 | [diff] [blame] | 1052 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1053 | while (optind < argc) { |
| 1054 | ini_idx++; |
| 1055 | ini_file = realloc(ini_file, ini_idx * sizeof(char *)); |
| 1056 | ini_file[ini_idx - 1] = strdup(argv[optind]); |
| 1057 | optind++; |
Jens Axboe | eb8bbf4 | 2006-06-08 21:40:11 +0200 | [diff] [blame] | 1058 | } |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1059 | |
| 1060 | return ini_idx; |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1061 | } |
| 1062 | |
| 1063 | static void free_shm(void) |
| 1064 | { |
| 1065 | struct shmid_ds sbuf; |
| 1066 | |
| 1067 | if (threads) { |
Jens Axboe | 2c0ecd2 | 2006-06-08 13:25:41 +0200 | [diff] [blame] | 1068 | shmdt((void *) threads); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1069 | threads = NULL; |
| 1070 | shmctl(shm_id, IPC_RMID, &sbuf); |
| 1071 | } |
| 1072 | } |
| 1073 | |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 1074 | /* |
| 1075 | * The thread area is shared between the main process and the job |
| 1076 | * threads/processes. So setup a shared memory segment that will hold |
| 1077 | * all the job info. |
| 1078 | */ |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1079 | static int setup_thread_area(void) |
| 1080 | { |
| 1081 | /* |
| 1082 | * 1024 is too much on some machines, scale max_jobs if |
| 1083 | * we get a failure that looks like too large a shm segment |
| 1084 | */ |
| 1085 | do { |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 1086 | size_t size = max_jobs * sizeof(struct thread_data); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1087 | |
Jens Axboe | 906c8d7 | 2006-06-13 09:37:56 +0200 | [diff] [blame] | 1088 | shm_id = shmget(0, size, IPC_CREAT | 0600); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1089 | if (shm_id != -1) |
| 1090 | break; |
| 1091 | if (errno != EINVAL) { |
| 1092 | perror("shmget"); |
| 1093 | break; |
| 1094 | } |
| 1095 | |
| 1096 | max_jobs >>= 1; |
| 1097 | } while (max_jobs); |
| 1098 | |
| 1099 | if (shm_id == -1) |
| 1100 | return 1; |
| 1101 | |
| 1102 | threads = shmat(shm_id, NULL, 0); |
| 1103 | if (threads == (void *) -1) { |
| 1104 | perror("shmat"); |
| 1105 | return 1; |
| 1106 | } |
| 1107 | |
| 1108 | atexit(free_shm); |
| 1109 | return 0; |
| 1110 | } |
| 1111 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1112 | /* |
| 1113 | * Copy the fio options into the long options map, so we mirror |
| 1114 | * job and cmd line options. |
| 1115 | */ |
| 1116 | static void dupe_job_options(void) |
| 1117 | { |
| 1118 | struct fio_option *o; |
| 1119 | unsigned int i; |
| 1120 | |
| 1121 | i = 0; |
| 1122 | while (long_options[i].name) |
| 1123 | i++; |
| 1124 | |
| 1125 | o = &options[0]; |
| 1126 | while (o->name) { |
| 1127 | long_options[i].name = o->name; |
| 1128 | long_options[i].val = FIO_GETOPT_JOB; |
| 1129 | if (o->type == FIO_OPT_STR_SET) |
| 1130 | long_options[i].has_arg = no_argument; |
| 1131 | else |
| 1132 | long_options[i].has_arg = required_argument; |
| 1133 | |
| 1134 | i++; |
| 1135 | o++; |
| 1136 | assert(i < FIO_JOB_OPTS + FIO_CMD_OPTS); |
| 1137 | } |
| 1138 | } |
| 1139 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1140 | int parse_options(int argc, char *argv[]) |
| 1141 | { |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1142 | int job_files, i; |
| 1143 | |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1144 | f_out = stdout; |
| 1145 | f_err = stderr; |
| 1146 | |
| 1147 | dupe_job_options(); |
| 1148 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1149 | if (setup_thread_area()) |
| 1150 | return 1; |
| 1151 | if (fill_def_thread()) |
| 1152 | return 1; |
| 1153 | |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1154 | job_files = parse_cmd_line(argc, argv); |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1155 | |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1156 | for (i = 0; i < job_files; i++) { |
| 1157 | if (fill_def_thread()) |
| 1158 | return 1; |
Jens Axboe | 0c7e37a | 2006-06-13 14:53:38 +0200 | [diff] [blame] | 1159 | if (parse_jobs_ini(ini_file[i], i)) |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1160 | return 1; |
Jens Axboe | 88c6ed8 | 2006-06-09 11:28:10 +0200 | [diff] [blame] | 1161 | free(ini_file[i]); |
Jens Axboe | 972cfd2 | 2006-06-09 11:08:56 +0200 | [diff] [blame] | 1162 | } |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1163 | |
Jens Axboe | 88c6ed8 | 2006-06-09 11:28:10 +0200 | [diff] [blame] | 1164 | free(ini_file); |
Jens Axboe | b469282 | 2006-10-27 13:43:22 +0200 | [diff] [blame] | 1165 | |
| 1166 | if (!thread_number) { |
| 1167 | log_err("No jobs defined(s)\n"); |
| 1168 | usage(); |
| 1169 | return 1; |
| 1170 | } |
| 1171 | |
Jens Axboe | ebac465 | 2005-12-08 15:25:21 +0100 | [diff] [blame] | 1172 | return 0; |
| 1173 | } |