The following changes since commit 9bbf57cc80d915d8cc87240276334ddd5aaac547: Use 'o' consistently in fixup_options() (2010-03-18 20:45:43 +0100) are available in the git repository at: git://git.kernel.dk/fio.git master Jens Axboe (9): Don't call getpid() in dprint() unless we are going to use it Fix bad sign on td_verror() Optimize __get_io_u() for better code foot print Make the dprint() processing out-of-line Update other OS makefiles Add log_valist() __dprint() fixup Only define str_sfr_cb() if FIO_HAVE_SYNC_FILE_RANGE is set OSX should use off_t for off64_t Makefile | 2 +- Makefile.FreeBSD | 2 +- Makefile.mac | 2 +- Makefile.solaris | 3 ++- debug.c | 26 ++++++++++++++++++++++++++ debug.h | 25 +++++++++++-------------- io_u.c | 15 +++++++-------- ioengines.c | 2 +- log.h | 3 +++ options.c | 2 ++ os/os-mac.h | 1 + 11 files changed, 56 insertions(+), 27 deletions(-) create mode 100644 debug.c --- Diff of recent changes: diff --git a/Makefile b/Makefile index ce2374b..12042f4 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ SCRIPTS = fio_generate_plots OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \ eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \ rbtree.o diskutil.o fifo.o blktrace.o smalloc.o filehash.o helpers.o \ - cgroup.o profile.o + cgroup.o profile.o debug.o OBJS += crc/crc7.o OBJS += crc/crc16.o diff --git a/Makefile.FreeBSD b/Makefile.FreeBSD index b499893..deae03d 100644 --- a/Makefile.FreeBSD +++ b/Makefile.FreeBSD @@ -6,7 +6,7 @@ PROGS = fio SCRIPTS = fio_generate_plots OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \ eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \ - rbtree.o smalloc.o filehash.o helpers.o + rbtree.o smalloc.o filehash.o helpers.o profile.o debug.o OBJS += crc/crc7.o OBJS += crc/crc16.o diff --git a/Makefile.mac b/Makefile.mac index eab6333..a726546 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -6,7 +6,7 @@ PROGS = fio SCRIPTS = fio_generate_plots OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \ eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \ - rbtree.o smalloc.o filehash.o helpers.o + rbtree.o smalloc.o filehash.o helpers.o profile.o debug.o OBJS += crc/crc7.o OBJS += crc/crc16.o diff --git a/Makefile.solaris b/Makefile.solaris index bf9c90a..0ec6d73 100644 --- a/Makefile.solaris +++ b/Makefile.solaris @@ -4,7 +4,8 @@ PROGS = fio SCRIPTS = fio_generate_plots OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \ eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \ - rbtree.o fifo.o smalloc.o filehash.o lib/strsep.o helpers.o solaris.o + rbtree.o fifo.o smalloc.o filehash.o lib/strsep.o helpers.o solaris.o \ + profile.o debug.o OBJS += crc/crc7.o OBJS += crc/crc16.o diff --git a/debug.c b/debug.c new file mode 100644 index 0000000..013cd53 --- /dev/null +++ b/debug.c @@ -0,0 +1,26 @@ +#include <stdarg.h> +#include <sys/types.h> +#include <unistd.h> +#include "debug.h" + +#ifdef FIO_INC_DEBUG +void __dprint(int type, const char *str, ...) +{ + va_list args; + pid_t pid; + + assert(type < FD_DEBUG_MAX); + + pid = getpid(); + if (fio_debug_jobp && *fio_debug_jobp != -1U + && pid != *fio_debug_jobp) + return; + + log_info("%-8s ", debug_levels[type].name); + log_info("%-5u ", (int) pid); + + va_start(args, str); + log_valist(str, args); + va_end(args); +} +#endif diff --git a/debug.h b/debug.h index 71b346d..e51d8b2 100644 --- a/debug.h +++ b/debug.h @@ -32,23 +32,20 @@ extern struct debug_level debug_levels[]; extern unsigned long fio_debug; -#define dprint(type, str, args...) \ - do { \ - pid_t pid = getpid(); \ - assert(type < FD_DEBUG_MAX); \ - if ((((1 << type)) & fio_debug) == 0) \ - break; \ - if (fio_debug_jobp && *fio_debug_jobp != -1U \ - && pid != *fio_debug_jobp) \ - break; \ - log_info("%-8s ", debug_levels[(type)].name); \ - log_info("%-5u ", (int) pid); \ - log_info(str, ##args); \ - } while (0) +void __dprint(int type, const char *str, ...); + +#define dprint(type, str, args...) \ + do { \ + if ((((1 << type)) & fio_debug) == 0) \ + break; \ + __dprint((type), (str), ##args); \ + } while (0) \ #else -#define dprint(type, str, args...) +static inline void dprint(int type, const char *str, ...) +{ +} #endif #endif diff --git a/io_u.c b/io_u.c index a4bf0c0..afc90de 100644 --- a/io_u.c +++ b/io_u.c @@ -888,14 +888,6 @@ again: io_u->end_io = NULL; } - /* - * We ran out, wait for async verify threads to finish and return one - */ - if (!io_u && td->o.verify_async) { - pthread_cond_wait(&td->free_cond, &td->io_u_lock); - goto again; - } - if (io_u) { assert(io_u->flags & IO_U_F_FREE); io_u->flags &= ~(IO_U_F_FREE | IO_U_F_FREE_DEF); @@ -905,6 +897,13 @@ again: flist_add(&io_u->list, &td->io_u_busylist); td->cur_depth++; io_u->flags |= IO_U_F_IN_CUR_DEPTH; + } else if (td->o.verify_async) { + /* + * We ran out, wait for async verify threads to finish and + * return one + */ + pthread_cond_wait(&td->free_cond, &td->io_u_lock); + goto again; } td_io_u_unlock(td); diff --git a/ioengines.c b/ioengines.c index 7ab356a..f8c52e5 100644 --- a/ioengines.c +++ b/ioengines.c @@ -208,7 +208,7 @@ out: if (r >= 0) io_u_mark_complete(td, r); else - td_verror(td, -r, "get_events"); + td_verror(td, r, "get_events"); dprint(FD_IO, "getevents: %d\n", r); return r; diff --git a/log.h b/log.h index 12c9a55..71f89c1 100644 --- a/log.h +++ b/log.h @@ -1,6 +1,8 @@ #ifndef FIO_LOG_H #define FIO_LOG_H +#include <stdio.h> + extern FILE *f_out; extern FILE *f_err; @@ -14,6 +16,7 @@ extern FILE *f_err; } while (0) #define log_info(args...) fprintf(f_out, ##args) +#define log_valist(str, args) vfprintf(f_out, (str), (args)) FILE *get_f_out(void); FILE *get_f_err(void); diff --git a/options.c b/options.c index dda7cba..40f60ff 100644 --- a/options.c +++ b/options.c @@ -429,6 +429,7 @@ static int str_fst_cb(void *data, const char *str) return 0; } +#ifdef FIO_HAVE_SYNC_FILE_RANGE static int str_sfr_cb(void *data, const char *str) { struct thread_data *td = data; @@ -442,6 +443,7 @@ static int str_sfr_cb(void *data, const char *str) return 0; } +#endif static int check_dir(struct thread_data *td, char *fname) { diff --git a/os/os-mac.h b/os/os-mac.h index 1c3798b..be25458 100644 --- a/os/os-mac.h +++ b/os/os-mac.h @@ -20,6 +20,7 @@ typedef unsigned long os_cpu_mask_t; typedef unsigned int clockid_t; +typedef off_t off64_t; static inline int blockdev_invalidate_cache(int fd) { -- 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