The following changes since commit 8b156d8ea1cc3d5df4de7f2e9fe435a2dfb41590: configure: allow --cpu to be specified (2013-02-10 15:48:34 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (4): Handle end_fsync if a file is closed configure: ensure that fatal errors kill config-host.h and mak files Turn f->engine_data into a 64-bit value Initialize global and non-static variables backend.c | 21 +++++++++++++++++++-- configure | 17 +++++++++++------ engines/binject.c | 12 ++++++------ file.h | 2 +- fio.c | 4 ++-- gettime-thread.c | 2 +- init.c | 2 +- lib/getopt_long.c | 5 +++-- 8 files changed, 44 insertions(+), 21 deletions(-) --- Diff of recent changes: diff --git a/backend.c b/backend.c index 6461fff..d1fe964 100644 --- a/backend.c +++ b/backend.c @@ -322,6 +322,21 @@ requeue: return 0; } +static int fio_file_fsync(struct thread_data *td, struct fio_file *f) +{ + int ret; + + if (fio_file_open(f)) + return fio_io_sync(td, f); + + if (td_io_open_file(td, f)) + return 1; + + ret = fio_io_sync(td, f); + td_io_close_file(td, f); + return ret; +} + static inline void __update_tv_cache(struct thread_data *td) { fio_gettime(&td->tv_cache, NULL); @@ -822,9 +837,11 @@ sync_done: td_set_runstate(td, TD_FSYNCING); for_each_file(td, f, i) { - if (!fio_file_open(f)) + if (!fio_file_fsync(td, f)) continue; - fio_io_sync(td, f); + + log_err("fio: end_fsync failed for file %s\n", + f->file_name); } } } else diff --git a/configure b/configure index 10a9a4c..87cc1cf 100755 --- a/configure +++ b/configure @@ -29,6 +29,14 @@ config_host_h="config-host.h" rm -rf $config_host_mak rm -rf $config_host_h +fatal() { + echo $@ + echo "Configure failed, check config.log and/or the above output" + rm -rf $config_host_mak + rm -rf $config_host_h + exit 1 +} + # Default CFLAGS CFLAGS="-D_GNU_SOURCE" EXTFLAGS="-include config-host.h" @@ -70,8 +78,7 @@ do_cc() { echo "ERROR: configure test passed without -Werror but failed with -Werror." echo "This is probably a bug in the configure script. The failing command" echo "will be at the bottom of config.log." - echo "You can run configure with --disable-werror to bypass this check." - exit 1 + fatal "You can run configure with --disable-werror to bypass this check." } compile_object() { @@ -91,8 +98,7 @@ feature_not_found() { echo "ERROR" echo "ERROR: User requested feature $feature" echo "ERROR: configure was not able to find it" - echo "ERROR" - exit 1; + fatal "ERROR" } has() { @@ -902,8 +908,7 @@ if test "$wordsize" = "64" ; then elif test "$wordsize" = "32" ; then output_sym "CONFIG_32BIT" else - echo "Unknown wordsize!" - exit 1 + fatal "Unknown wordsize!" fi if test "$bigendian" = "yes" ; then output_sym "CONFIG_BIG_ENDIAN" diff --git a/engines/binject.c b/engines/binject.c index 7b8522a..fb19062 100644 --- a/engines/binject.c +++ b/engines/binject.c @@ -69,7 +69,7 @@ static unsigned int binject_read_commands(struct thread_data *td, void *p, one_more: events = 0; for_each_file(td, f, i) { - bf = (struct binject_file *) f->engine_data; + bf = (struct binject_file *) (uintptr_t) f->engine_data; ret = read(bf->fd, p, left * sizeof(struct b_user_cmd)); if (ret < 0) { if (errno == EAGAIN) @@ -104,7 +104,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, * Fill in the file descriptors */ for_each_file(td, f, i) { - bf = (struct binject_file *) f->engine_data; + bf = (struct binject_file *) (uintptr_t) f->engine_data; /* * don't block for min events == 0 @@ -153,7 +153,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, if (!min) { for_each_file(td, f, i) { - bf = (struct binject_file *) f->engine_data; + bf = (struct binject_file *) (uintptr_t) f->engine_data; fcntl(bf->fd, F_SETFL, bd->fd_flags[i]); } } @@ -167,7 +167,7 @@ static int fio_binject_getevents(struct thread_data *td, unsigned int min, static int fio_binject_doio(struct thread_data *td, struct io_u *io_u) { struct b_user_cmd *buc = &io_u->buc; - struct binject_file *bf = (struct binject_file *) io_u->file->engine_data; + struct binject_file *bf = (struct binject_file *) (uintptr_t) io_u->file->engine_data; int ret; ret = write(bf->fd, buc, sizeof(*buc)); @@ -181,7 +181,7 @@ static int fio_binject_prep(struct thread_data *td, struct io_u *io_u) { struct binject_data *bd = td->io_ops->data; struct b_user_cmd *buc = &io_u->buc; - struct binject_file *bf = (struct binject_file *) io_u->file->engine_data; + struct binject_file *bf = (struct binject_file *) (uintptr_t) io_u->file->engine_data; if (io_u->xfer_buflen & (bf->bs - 1)) { log_err("read/write not sector aligned\n"); @@ -323,7 +323,7 @@ err_unmap: static int fio_binject_close_file(struct thread_data *td, struct fio_file *f) { - struct binject_file *bf = (struct binject_file *) f->engine_data; + struct binject_file *bf = (struct binject_file *) (uintptr_t) f->engine_data; if (bf) { binject_unmap_dev(td, bf); diff --git a/file.h b/file.h index 95ecefe..eb0688c 100644 --- a/file.h +++ b/file.h @@ -97,7 +97,7 @@ struct fio_file { /* * For use by the io engine */ - uintptr_t engine_data; + uint64_t engine_data; /* * if io is protected by a semaphore, this is set diff --git a/fio.c b/fio.c index af4c12c..60261ff 100644 --- a/fio.c +++ b/fio.c @@ -28,8 +28,8 @@ #include "fio.h" #include "smalloc.h" -uintptr_t page_mask; -uintptr_t page_size; +uintptr_t page_mask = 0; +uintptr_t page_size = 0; static int endian_check(void) { diff --git a/gettime-thread.c b/gettime-thread.c index c1b4b09..3d49034 100644 --- a/gettime-thread.c +++ b/gettime-thread.c @@ -6,7 +6,7 @@ #include "fio.h" #include "smalloc.h" -struct timeval *fio_tv; +struct timeval *fio_tv = NULL; int fio_gtod_offload = 0; int fio_gtod_cpu = -1; static pthread_t gtod_thread; diff --git a/init.c b/init.c index e8f3a9b..4709ff2 100644 --- a/init.c +++ b/init.c @@ -40,7 +40,7 @@ struct thread_data *threads = NULL; int exitall_on_terminate = 0; int output_format = FIO_OUTPUT_NORMAL; -int eta_print; +int eta_print = FIO_ETA_AUTO; unsigned long long mlock_size = 0; FILE *f_out = NULL; FILE *f_err = NULL; diff --git a/lib/getopt_long.c b/lib/getopt_long.c index 70894e3..bdd524b 100644 --- a/lib/getopt_long.c +++ b/lib/getopt_long.c @@ -16,8 +16,9 @@ #include "getopt.h" -char *optarg; -int optind, opterr, optopt; +char *optarg = NULL; +int optind = 0, opterr = 0, optopt = 0; + static struct getopt_private_state { const char *optptr; const char *last_optstring; -- 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