The following changes since commit 996936f995c47f4744a49e05419e7d4c0364c64e: Multiple jobs and verify will not fail if do_verify=0 (2011-01-18 05:41:39 -0700) are available in the git repository at: git://git.kernel.dk/fio.git master Bruce Cran (3): Add instructions for building and running the Windows version of fio to README Re-tab some parts of README Remove version number from Windows MSI file Jens Axboe (5): Remember to initialize return value in fixup_options() Fix merge error hiding mmap ioengine under Windows build Define OS preferred IO engine Get rid of shadow declarations Expand on fill_device option since it apparently causes confusion HOWTO | 6 +++- README | 50 ++++++++++++++++++++-------- crc/sha256.c | 12 +++--- crc/sha512.c | 12 +++--- engines/sg.c | 8 ++-- engines/sync.c | 8 ++-- eta.c | 4 +- fio.1 | 4 ++- fio.c | 6 ++-- init.c | 4 +-- io_u.c | 84 ++++++++++++++++++++++++------------------------ options.c | 6 ++-- os/os-windows.h | 2 + os/os.h | 4 ++ os/windows/dobuild.cmd | 2 +- stat.c | 4 +- verify.c | 14 ++++---- 17 files changed, 130 insertions(+), 100 deletions(-) --- Diff of recent changes: diff --git a/HOWTO b/HOWTO index 68e17e9..e8fbd97 100644 --- a/HOWTO +++ b/HOWTO @@ -378,7 +378,11 @@ filesize=int Individual file sizes. May be a range, in which case fio fill_device=bool Sets size to something really large and waits for ENOSPC (no space left on device) as the terminating condition. Only makes sense with sequential write. For a read workload, the mount - point will be filled first then IO started on the result. + point will be filled first then IO started on the result. This + option doesn't make sense if operating on a raw device node, + since the size of that is already known by the file system. + Additionally, writing beyond end-of-device will not return + ENOSPC there. blocksize=int bs=int The block size used for the io units. Defaults to 4k. Values diff --git a/README b/README index 2eec1a2..adcced6 100644 --- a/README +++ b/README @@ -110,23 +110,43 @@ Check that you have the libaio development package installed. On RPM based distros, it's typically called libaio-devel. +Windows +------- + +On Windows Cygwin (http://www.cygwin.com) is required with at least +devel/gcc4 and devel/make installed in order to build fio, and +admin/cygrunsrv to run it. You can also install devel/git to fetch/update +the source files. To create an MSI installer package, install WiX 3.6 from +http://wix.sourceforge.net/releases/ and run dobuild.cmd from the +os/windows directory. + +Before running fio you'll need to have a copy of cygserver running. Run +"/usr/bin/cygserver-config" from an elevated Cygwin shell (i.e. launch the +Cygwin shell under the Administrator account) to configure it. Once +configured, run "net start cygserver" to start it, or type +"/usr/sbin/cygserver &" in the Cygwin shell to start a local copy. + +If fio exits with the message "Bad system call" it normally means that +Cygserver isn't running. + + Command line ------------ $ fio - --debug Enable some debugging options (see below) - --output Write output to file - --timeout Runtime in seconds - --latency-log Generate per-job latency logs - --bandwidth-log Generate per-job bandwidth logs - --minimal Minimal (terse) output - --version Print version info and exit - --help Print this page + --debug Enable some debugging options (see below) + --output Write output to file + --timeout Runtime in seconds + --latency-log Generate per-job latency logs + --bandwidth-log Generate per-job bandwidth logs + --minimal Minimal (terse) output + --version Print version info and exit + --help Print this page --cmdhelp=cmd Print command help, "all" for all of them - --showcmd Turn a job file into command line options - --readonly Turn on safety read-only checks, preventing writes - --eta=when When ETA estimate should be printed - May be "always", "never" or "auto" + --showcmd Turn a job file into command line options + --readonly Turn on safety read-only checks, preventing writes + --eta=when When ETA estimate should be printed + May be "always", "never" or "auto" --section=name Only run specified section in job file --alloc-size=kb Set smalloc pool to this size in kb (def 1024) --warnings-fatal Fio parser warnings are fatal @@ -148,11 +168,11 @@ options in fio. Currently the options are: process Dump info related to processes file Dump info related to file actions - io Dump info related to IO queuing - mem Dump info related to memory allocations + io Dump info related to IO queuing + mem Dump info related to memory allocations blktrace Dump info related to blktrace setup verify Dump info related to IO verification - all Enable all debug options + all Enable all debug options random Dump info related to random offset generation parse Dump info related to option matching and parsing diskutil Dump info related to disk utilization updates diff --git a/crc/sha256.c b/crc/sha256.c index 0091d44..dcb1677 100644 --- a/crc/sha256.c +++ b/crc/sha256.c @@ -243,10 +243,10 @@ void sha256_init(struct sha256_ctx *sctx) void sha256_update(struct sha256_ctx *sctx, const uint8_t *data, unsigned int len) { - unsigned int i, index, part_len; + unsigned int i, idx, part_len; /* Compute number of bytes mod 128 */ - index = (unsigned int)((sctx->count[0] >> 3) & 0x3f); + idx = (unsigned int)((sctx->count[0] >> 3) & 0x3f); /* Update number of bits */ if ((sctx->count[0] += (len << 3)) < (len << 3)) { @@ -254,20 +254,20 @@ void sha256_update(struct sha256_ctx *sctx, const uint8_t *data, sctx->count[1] += (len >> 29); } - part_len = 64 - index; + part_len = 64 - idx; /* Transform as many times as possible. */ if (len >= part_len) { - memcpy(&sctx->buf[index], data, part_len); + memcpy(&sctx->buf[idx], data, part_len); sha256_transform(sctx->state, sctx->buf); for (i = part_len; i + 63 < len; i += 64) sha256_transform(sctx->state, &data[i]); - index = 0; + idx = 0; } else { i = 0; } /* Buffer remaining input */ - memcpy(&sctx->buf[index], &data[i], len-i); + memcpy(&sctx->buf[idx], &data[i], len-i); } diff --git a/crc/sha512.c b/crc/sha512.c index 0d44ace..9268a49 100644 --- a/crc/sha512.c +++ b/crc/sha512.c @@ -162,10 +162,10 @@ void sha512_init(struct sha512_ctx *sctx) void sha512_update(struct sha512_ctx *sctx, const uint8_t *data, unsigned int len) { - unsigned int i, index, part_len; + unsigned int i, idx, part_len; /* Compute number of bytes mod 128 */ - index = (unsigned int)((sctx->count[0] >> 3) & 0x7F); + idx = (unsigned int)((sctx->count[0] >> 3) & 0x7F); /* Update number of bits */ if ((sctx->count[0] += (len << 3)) < (len << 3)) { @@ -175,23 +175,23 @@ void sha512_update(struct sha512_ctx *sctx, const uint8_t *data, sctx->count[1] += (len >> 29); } - part_len = 128 - index; + part_len = 128 - idx; /* Transform as many times as possible. */ if (len >= part_len) { - memcpy(&sctx->buf[index], data, part_len); + memcpy(&sctx->buf[idx], data, part_len); sha512_transform(sctx->state, sctx->W, sctx->buf); for (i = part_len; i + 127 < len; i+=128) sha512_transform(sctx->state, sctx->W, &data[i]); - index = 0; + idx = 0; } else { i = 0; } /* Buffer remaining input */ - memcpy(&sctx->buf[index], &data[i], len - i); + memcpy(&sctx->buf[idx], &data[i], len - i); /* erase our data */ memset(sctx->W, 0, sizeof(sctx->W)); diff --git a/engines/sg.c b/engines/sg.c index ac1d999..88d9125 100644 --- a/engines/sg.c +++ b/engines/sg.c @@ -166,7 +166,7 @@ static int fio_sgio_ioctl_doio(struct thread_data *td, return FIO_Q_COMPLETED; } -static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync) +static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int do_sync) { struct sg_io_hdr *hdr = &io_u->hdr; int ret; @@ -175,7 +175,7 @@ static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync) if (ret < 0) return ret; - if (sync) { + if (do_sync) { ret = read(f->fd, hdr, sizeof(*hdr)); if (ret < 0) return ret; @@ -185,14 +185,14 @@ static int fio_sgio_rw_doio(struct fio_file *f, struct io_u *io_u, int sync) return FIO_Q_QUEUED; } -static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int sync) +static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int do_sync) { struct fio_file *f = io_u->file; if (f->filetype == FIO_TYPE_BD) return fio_sgio_ioctl_doio(td, f, io_u); - return fio_sgio_rw_doio(f, io_u, sync); + return fio_sgio_rw_doio(f, io_u, do_sync); } static int fio_sgio_prep(struct thread_data *td, struct io_u *io_u) diff --git a/engines/sync.c b/engines/sync.c index 4eea2f9..3377f81 100644 --- a/engines/sync.c +++ b/engines/sync.c @@ -141,11 +141,11 @@ static int fio_vsyncio_append(struct thread_data *td, struct io_u *io_u) } static void fio_vsyncio_set_iov(struct syncio_data *sd, struct io_u *io_u, - int index) + int idx) { - sd->io_us[index] = io_u; - sd->iovecs[index].iov_base = io_u->xfer_buf; - sd->iovecs[index].iov_len = io_u->xfer_buflen; + sd->io_us[idx] = io_u; + sd->iovecs[idx].iov_base = io_u->xfer_buf; + sd->iovecs[idx].iov_len = io_u->xfer_buflen; sd->last_offset = io_u->offset + io_u->xfer_buflen; sd->last_file = io_u->file; sd->last_ddir = io_u->ddir; diff --git a/eta.c b/eta.c index ba6a398..b367ce9 100644 --- a/eta.c +++ b/eta.c @@ -391,7 +391,7 @@ void print_thread_status(void) fflush(stdout); } -void print_status_init(int thread_number) +void print_status_init(int thr_number) { - run_str[thread_number] = 'P'; + run_str[thr_number] = 'P'; } diff --git a/fio.1 b/fio.1 index d372727..a6547ee 100644 --- a/fio.1 +++ b/fio.1 @@ -235,7 +235,9 @@ must be given. Sets size to something really large and waits for ENOSPC (no space left on device) as the terminating condition. Only makes sense with sequential write. For a read workload, the mount point will be filled first then IO started on -the result. +the result. This option doesn't make sense if operating on a raw device node, +since the size of that is already known by the file system. Additionally, +writing beyond end-of-device will not return ENOSPC there. .TP .BI filesize \fR=\fPirange Individual file sizes. May be a range, in which case \fBfio\fR will select sizes diff --git a/fio.c b/fio.c index 067aa24..e205b3a 100644 --- a/fio.c +++ b/fio.c @@ -497,7 +497,6 @@ static void do_verify(struct thread_data *td) clear_io_u(td, io_u); } else if (io_u->resid) { int bytes = io_u->xfer_buflen - io_u->resid; - struct fio_file *f = io_u->file; /* * zero read, fail @@ -515,6 +514,7 @@ static void do_verify(struct thread_data *td) if (ddir_rw(io_u->ddir)) td->ts.short_io_u[io_u->ddir]++; + f = io_u->file; if (io_u->offset == f->real_file_size) goto sync_done; @@ -1497,14 +1497,14 @@ static void run_threads(void) todo--; } else { struct fio_file *f; - unsigned int i; + unsigned int j; /* * for sharing to work, each job must always open * its own files. so close them, if we opened them * for creation */ - for_each_file(td, f, i) { + for_each_file(td, f, j) { if (fio_file_open(f)) td_io_close_file(td, f); } diff --git a/init.c b/init.c index 15adf38..c3f23f9 100644 --- a/init.c +++ b/init.c @@ -248,7 +248,7 @@ static int fixed_block_size(struct thread_options *o) static int fixup_options(struct thread_data *td) { struct thread_options *o = &td->o; - int ret; + int ret = 0; #ifndef FIO_HAVE_PSHARED_MUTEX if (!o->use_thread) { @@ -1039,8 +1039,6 @@ static int set_debug(const char *string) int i; if (!strcmp(string, "?") || !strcmp(string, "help")) { - int i; - log_info("fio: dumping debug options:"); for (i = 0; debug_levels[i].name; i++) { dl = &debug_levels[i]; diff --git a/io_u.c b/io_u.c index 185bba0..1a45706 100644 --- a/io_u.c +++ b/io_u.c @@ -635,31 +635,31 @@ out: static void __io_u_mark_map(unsigned int *map, unsigned int nr) { - int index = 0; + int idx = 0; switch (nr) { default: - index = 6; + idx = 6; break; case 33 ... 64: - index = 5; + idx = 5; break; case 17 ... 32: - index = 4; + idx = 4; break; case 9 ... 16: - index = 3; + idx = 3; break; case 5 ... 8: - index = 2; + idx = 2; break; case 1 ... 4: - index = 1; + idx = 1; case 0: break; } - map[index]++; + map[idx]++; } void io_u_mark_submit(struct thread_data *td, unsigned int nr) @@ -676,117 +676,117 @@ void io_u_mark_complete(struct thread_data *td, unsigned int nr) void io_u_mark_depth(struct thread_data *td, unsigned int nr) { - int index = 0; + int idx = 0; switch (td->cur_depth) { default: - index = 6; + idx = 6; break; case 32 ... 63: - index = 5; + idx = 5; break; case 16 ... 31: - index = 4; + idx = 4; break; case 8 ... 15: - index = 3; + idx = 3; break; case 4 ... 7: - index = 2; + idx = 2; break; case 2 ... 3: - index = 1; + idx = 1; case 1: break; } - td->ts.io_u_map[index] += nr; + td->ts.io_u_map[idx] += nr; } static void io_u_mark_lat_usec(struct thread_data *td, unsigned long usec) { - int index = 0; + int idx = 0; assert(usec < 1000); switch (usec) { case 750 ... 999: - index = 9; + idx = 9; break; case 500 ... 749: - index = 8; + idx = 8; break; case 250 ... 499: - index = 7; + idx = 7; break; case 100 ... 249: - index = 6; + idx = 6; break; case 50 ... 99: - index = 5; + idx = 5; break; case 20 ... 49: - index = 4; + idx = 4; break; case 10 ... 19: - index = 3; + idx = 3; break; case 4 ... 9: - index = 2; + idx = 2; break; case 2 ... 3: - index = 1; + idx = 1; case 0 ... 1: break; } - assert(index < FIO_IO_U_LAT_U_NR); - td->ts.io_u_lat_u[index]++; + assert(idx < FIO_IO_U_LAT_U_NR); + td->ts.io_u_lat_u[idx]++; } static void io_u_mark_lat_msec(struct thread_data *td, unsigned long msec) { - int index = 0; + int idx = 0; switch (msec) { default: - index = 11; + idx = 11; break; case 1000 ... 1999: - index = 10; + idx = 10; break; case 750 ... 999: - index = 9; + idx = 9; break; case 500 ... 749: - index = 8; + idx = 8; break; case 250 ... 499: - index = 7; + idx = 7; break; case 100 ... 249: - index = 6; + idx = 6; break; case 50 ... 99: - index = 5; + idx = 5; break; case 20 ... 49: - index = 4; + idx = 4; break; case 10 ... 19: - index = 3; + idx = 3; break; case 4 ... 9: - index = 2; + idx = 2; break; case 2 ... 3: - index = 1; + idx = 1; case 0 ... 1: break; } - assert(index < FIO_IO_U_LAT_M_NR); - td->ts.io_u_lat_m[index]++; + assert(idx < FIO_IO_U_LAT_M_NR); + td->ts.io_u_lat_m[idx]++; } static void io_u_mark_latency(struct thread_data *td, unsigned long usec) diff --git a/options.c b/options.c index 163e508..de2d037 100644 --- a/options.c +++ b/options.c @@ -918,7 +918,7 @@ static struct fio_option options[FIO_MAX_OPTS] = { .type = FIO_OPT_STR_STORE, .off1 = td_var_offset(ioengine), .help = "IO engine to use", - .def = "sync", + .def = FIO_PREFERRED_ENGINE, .posval = { { .ival = "sync", .help = "Use read/write", @@ -946,12 +946,12 @@ static struct fio_option options[FIO_MAX_OPTS] = { #endif #ifdef FIO_HAVE_WINDOWSAIO { .ival = "windowsaio", - .help = "Windows native asynchronous IO" + .help = "Windows native asynchronous IO" }, +#endif { .ival = "mmap", .help = "Memory mapped IO" }, -#endif #ifdef FIO_HAVE_SPLICE { .ival = "splice", .help = "splice/vmsplice based IO", diff --git a/os/os-windows.h b/os/os-windows.h index 9edacf3..e790a51 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -22,6 +22,8 @@ #define OS_CLOCK CLOCK_REALTIME +#define FIO_PREFERRED_ENGINE "windowsaio" + typedef off_t off64_t; typedef struct { diff --git a/os/os.h b/os/os.h index 92b6950..1569e40 100644 --- a/os/os.h +++ b/os/os.h @@ -102,6 +102,10 @@ typedef unsigned long os_cpu_mask_t; #define fio_lookup_raw(dev, majdev, mindev) 1 #endif +#ifndef FIO_PREFERRED_ENGINE +#define FIO_PREFERRED_ENGINE "sync" +#endif + #ifndef FIO_HAVE_BLKTRACE static inline int is_blktrace(const char *fname) { diff --git a/os/windows/dobuild.cmd b/os/windows/dobuild.cmd index 05f85af..fa855a2 100755 --- a/os/windows/dobuild.cmd +++ b/os/windows/dobuild.cmd @@ -1,4 +1,4 @@ "%WIX%\bin\candle" cygwin.wxs "%WIX%\bin\candle" install.wxs "%WIX%\bin\candle" examples.wxs -"%WIX%\bin\light" install.wixobj cygwin.wixobj examples.wixobj -ext WixUIExtension -out fio-1.44.msi \ No newline at end of file +"%WIX%\bin\light" install.wixobj cygwin.wixobj examples.wixobj -ext WixUIExtension -out fio.msi \ No newline at end of file diff --git a/stat.c b/stat.c index a596388..d95be75 100644 --- a/stat.c +++ b/stat.c @@ -728,7 +728,7 @@ static inline void add_stat_sample(struct io_stat *is, unsigned long data) static void __add_log_sample(struct io_log *iolog, unsigned long val, enum fio_ddir ddir, unsigned int bs, - unsigned long time) + unsigned long t) { const int nr_samples = iolog->nr_samples; @@ -740,7 +740,7 @@ static void __add_log_sample(struct io_log *iolog, unsigned long val, } iolog->log[nr_samples].val = val; - iolog->log[nr_samples].time = time; + iolog->log[nr_samples].time = t; iolog->log[nr_samples].ddir = ddir; iolog->log[nr_samples].bs = bs; iolog->nr_samples++; diff --git a/verify.c b/verify.c index 3eac9ca..fc207cf 100644 --- a/verify.c +++ b/verify.c @@ -333,13 +333,13 @@ static int verify_io_u_pattern(struct verify_header *hdr, struct vcont *vc) struct thread_data *td = vc->td; struct io_u *io_u = vc->io_u; char *buf, *pattern; - unsigned int hdr_size = __hdr_size(td->o.verify); + unsigned int header_size = __hdr_size(td->o.verify); unsigned int len, mod, i; pattern = td->o.verify_pattern; - buf = (void *) hdr + hdr_size; - len = get_hdr_inc(td, io_u) - hdr_size; - mod = hdr_size % td->o.verify_pattern_bytes; + buf = (void *) hdr + header_size; + len = get_hdr_inc(td, io_u) - header_size; + mod = header_size % td->o.verify_pattern_bytes; for (i = 0; i < len; i++) { if (buf[i] != pattern[mod]) { @@ -653,7 +653,7 @@ static int verify_trimmed_io_u(struct thread_data *td, struct io_u *io_u) int verify_io_u(struct thread_data *td, struct io_u *io_u) { struct verify_header *hdr; - unsigned int hdr_size, hdr_inc, hdr_num = 0; + unsigned int header_size, hdr_inc, hdr_num = 0; void *p; int ret; @@ -678,9 +678,9 @@ int verify_io_u(struct thread_data *td, struct io_u *io_u) if (ret && td->o.verify_fatal) break; - hdr_size = __hdr_size(td->o.verify); + header_size = __hdr_size(td->o.verify); if (td->o.verify_offset) - memswp(p, p + td->o.verify_offset, hdr_size); + memswp(p, p + td->o.verify_offset, header_size); hdr = p; if (hdr->fio_magic != FIO_HDR_MAGIC) { -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html