From: Tomohiro Kusumi Date: Tue, 23 May 2017 18:44:45 +0000 (+0300) Subject: Move {is,load}_blktrace() to a new header blktrace.h X-Git-Tag: fio-2.21~40 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=a3e594123de4a010776b6fc2aaac75de35c5251a Move {is,load}_blktrace() to a new header blktrace.h This commit does exactly the same as what cgroup.h does for cgroup support. Since blktrace is Linux specific feature and api compiled only on Linux and Android, these two could be defined in blktrace.h rather than in os/os.h which is basically intended to be something generic whose implementation vary depending on supported platforms. The reason for adding a new header blktrace.h instead of using blktrace_api.h is because blktrace_api.h seems to have been added for blktrace.c to include which gets compiled only on Linux where blktrace apis are basically guaranteed to exist (unless really old kernels), whereas these prototypes or inline functions are needed by all platforms. Signed-off-by: Tomohiro Kusumi Signed-off-by: Jens Axboe --- diff --git a/blktrace.c b/blktrace.c index a3474cb5..65b600f5 100644 --- a/blktrace.c +++ b/blktrace.c @@ -10,6 +10,7 @@ #include "flist.h" #include "fio.h" +#include "blktrace.h" #include "blktrace_api.h" #include "oslib/linux-dev-lookup.h" diff --git a/blktrace.h b/blktrace.h new file mode 100644 index 00000000..8656a957 --- /dev/null +++ b/blktrace.h @@ -0,0 +1,23 @@ +#ifndef FIO_BLKTRACE_H +#define FIO_BLKTRACE_H + +#ifdef FIO_HAVE_BLKTRACE + +int is_blktrace(const char *, int *); +int load_blktrace(struct thread_data *, const char *, int); + +#else + +static inline int is_blktrace(const char *fname, int *need_swap) +{ + return 0; +} + +static inline int load_blktrace(struct thread_data *td, const char *fname, + int need_swap) +{ + return 1; +} + +#endif +#endif diff --git a/fio.h b/fio.h index ed631bc7..963cf034 100644 --- a/fio.h +++ b/fio.h @@ -640,14 +640,6 @@ extern void free_threads_shm(void); */ extern void reset_all_stats(struct thread_data *); -/* - * blktrace support - */ -#ifdef FIO_HAVE_BLKTRACE -extern int is_blktrace(const char *, int *); -extern int load_blktrace(struct thread_data *, const char *, int); -#endif - extern int io_queue_event(struct thread_data *td, struct io_u *io_u, int *ret, enum fio_ddir ddir, uint64_t *bytes_issued, int from_verify, struct timeval *comp_time); diff --git a/iolog.c b/iolog.c index 31d674c2..01b82e8d 100644 --- a/iolog.c +++ b/iolog.c @@ -19,6 +19,7 @@ #include "trim.h" #include "filelock.h" #include "smalloc.h" +#include "blktrace.h" static int iolog_flush(struct io_log *log); diff --git a/os/os.h b/os/os.h index 5e3c813d..c25cc36c 100644 --- a/os/os.h +++ b/os/os.h @@ -253,19 +253,6 @@ static inline uint64_t fio_swap64(uint64_t val) __cpu_to_le64(val); \ }) -#ifndef FIO_HAVE_BLKTRACE -static inline int is_blktrace(const char *fname, int *need_swap) -{ - return 0; -} -struct thread_data; -static inline int load_blktrace(struct thread_data *td, const char *fname, - int need_swap) -{ - return 1; -} -#endif - #define FIO_DEF_CL_SIZE 128 static inline int os_cache_line_size(void)