Recent changes (master)
The following changes since commit af13d1e88158d3e37940648be139d7a46fe00431:
Merge branch 'bugfix' of https://github.com/YukiKita/fio (2017-05-22 10:23:25 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to c78e8496d438982157657711fbff8bedb621c1c9:
log: ensure we don't truncate the final '\0' in the log (2017-05-23 21:51:59 -0600)
----------------------------------------------------------------
Jens Axboe (4):
Revert "Fixed json_print_value so that ending double quote of JSON string value will not disappear"
log: make log_buf() return how much it wrote
log: make the logging functions handle > 1024 bytes correctly
log: ensure we don't truncate the final '\0' in the log
Tomohiro Kusumi (7):
configure: Use single square brackets (POSIX)
configure: Add print_config() for "<config>... <yes|no>" outputs Move {is,load}_blktrace() to a new header blktrace.h Drop struct thread_data dependency from os headers Drop circular dependency in log.c and lib/output_buffer.c Include sg headers in os/os-linux.h
Move Linux/ppc64 specific cpu_online() to os/os-linux.h
blktrace.c | 1 + blktrace.h | 23 ++++++++ configure | 159 +++++++++++++++++++++++++++------------------------- fio.h | 8 --- init.c | 10 +++- iolog.c | 1 + json.c | 10 +--- lib/output_buffer.c | 8 +-- lib/output_buffer.h | 2 +- log.c | 117 ++++++++++++++++++++++++++++---------- log.h | 16 +++--- os/os-linux.h | 10 ++++ os/os-windows.h | 4 +- os/os.h | 34 +---------- stat.c | 6 +- 15 files changed, 231 insertions(+), 178 deletions(-) create mode 100644 blktrace.h
---
Diff of recent changes:
blktrace.c +1 -0
@@ -10,6 +10,7 @@#include "flist.h" #include "fio.h" +#include "blktrace.h" #include "blktrace_api.h" #include "oslib/linux-dev-lookup.h"
blktrace.h new file +23 -0
@@ -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
configure +82 -77
585 lines not on this page · raw message
fio.h +0 -8
@@ -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);
init.c +7 -3
@@ -1080,8 +1080,12 @@ static int setup_random_seeds(struct thread_data *td)unsigned long seed;unsigned int i; -if (!td->o.rand_repeatable && !fio_option_is_set (&td->o, rand_seed)) -return init_random_state (td, td->rand_seeds,sizeof (td->rand_seeds)); +if (!td->o.rand_repeatable && !fio_option_is_set (&td->o, rand_seed)) { +int ret =init_random_seeds (td->rand_seeds,sizeof (td->rand_seeds)); +if (!ret) +td_fill_rand_seeds (td); +return ret; + } seed = td->o.rand_seed;for (i =0 ; i <4 ; i++)
@@ -1376,7 +1380,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, prev_group_jobs++;if (setup_random_seeds (td)) { -td_verror (td, errno,"init_random_state" ); +td_verror (td, errno,"setup_random_seeds" ); goto err; }
iolog.c +1 -0
@@ -19,6 +19,7 @@#include "trim.h" #include "filelock.h" #include "smalloc.h" +#include "blktrace.h" static int iolog_flush (struct io_log *log);
json.c +3 -7
@@ -340,13 +340,9 @@ static void json_print_array(struct json_array *array, struct buf_output *out)static void json_print_value (struct json_value *value,struct buf_output *out) {switch (value->type) { -case JSON_TYPE_STRING : { -const char delimiter ='"' ; -buf_output_add (out, &delimiter,sizeof (delimiter)); -buf_output_add (out, value->string,strlen (value->string)); -buf_output_add (out, &delimiter,sizeof (delimiter)); -break ; - } +case JSON_TYPE_STRING : +log_buf (out,"\"%s\"" , value->string); +break ;case JSON_TYPE_INTEGER :log_buf (out,"%lld" , value->integer_number);break ;
lib/output_buffer.c +1 -7
@@ -3,7 +3,6 @@#include <stdlib.h> #include "output_buffer.h" -#include "../log.h" #include "../minmax.h" #define BUF_INC 1024
@@ -41,15 +40,10 @@ size_t buf_output_add(struct buf_output *out, const char *buf, size_t len)return len; } -size_t buf_output_flush (struct buf_output *out) +void buf_output_clear (struct buf_output *out) { -size_t ret =0 ; -if (out->buflen) { - ret =log_info_buf (out->buf, out->buflen);memset (out->buf,0 , out->max_buflen); out->buflen =0 ; } - -return ret; }
lib/output_buffer.h +1 -1
@@ -12,6 +12,6 @@ struct buf_output {void buf_output_init (struct buf_output *out);void buf_output_free (struct buf_output *out);size_t buf_output_add (struct buf_output *out,const char *buf,size_t len); -size_t buf_output_flush (struct buf_output *out); +void buf_output_clear (struct buf_output *out);#endif
log.c +87 -30
166 lines not on this page · raw message
log.h +9 -7
@@ -16,13 +16,15 @@ extern size_t log_valist(const char *str, va_list);extern size_t log_info_buf (const char *buf,size_t len);extern int log_info_flush (void ); -#define log_buf(buf, format, args...) \ -do { \ - if ((buf) != NULL) \ - __log_buf(buf, format, ##args); \ - else \ - log_info(format, ##args); \ -} while (0) +#define log_buf(buf, format, args...) \ +({ \ + size_t __ret; \ + if ((buf) != NULL) \ + __ret = __log_buf(buf, format, ##args); \ + else \ + __ret = log_info(format, ##args); \ + __ret; \ +})enum {FIO_LOG_DEBUG =1 ,
os/os-linux.h +10 -0
@@ -16,6 +16,8 @@#include <linux/unistd.h> #include <linux/raw.h> #include <linux/major.h> +#include <linux/fs.h> +#include <scsi/sg.h> #include "./os-linux-syscall.h" #include "binject.h"
@@ -258,6 +260,14 @@ static inline int arch_cache_line_size(void)return atoi (size); } +#ifdef __powerpc64__ +#define FIO_HAVE_CPU_ONLINE_SYSCONF +static inline unsigned int cpus_online (void ) +{ +return sysconf (_SC_NPROCESSORS_CONF); +} +#endif +static inline unsigned long long get_fs_free_size (const char *path) {unsigned long long ret;
os/os-windows.h +1 -3
@@ -116,7 +116,6 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);ssize_t pread (int fildes,void *buf,size_t nbyte,off_t offset);ssize_t pwrite (int fildes,const void *buf,size_t nbyte,off_t offset); -extern void td_fill_rand_seeds (struct thread_data *);static inline int blockdev_size (struct fio_file *f,unsigned long long *bytes) {
@@ -239,7 +238,7 @@ static inline int fio_cpuset_exit(os_cpu_mask_t *mask)return 0 ; } -static inline int init_random_state (struct thread_data *td,unsigned long *rand_seeds,int size) +static inline int init_random_seeds (unsigned long *rand_seeds,int size) {HCRYPTPROV hCryptProv;
@@ -258,7 +257,6 @@ static inline int init_random_state(struct thread_data *td, unsigned long *rand_ }CryptReleaseContext (hCryptProv,0 ); -td_fill_rand_seeds (td);return 0 ; }
os/os.h +1 -33
@@ -60,11 +60,6 @@ typedef struct aiocb os_aiocb_t;#endif #endif -#ifdef FIO_HAVE_SGIO -#include <linux/fs.h> -#include <scsi/sg.h> -#endif -#ifndef CONFIG_STRSEP #include "../oslib/strsep.h" #endif
@@ -253,19 +248,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 128static inline int os_cache_line_size (void )
@@ -316,12 +298,7 @@ static inline long os_random_long(os_random_state_t *rs)#endif #ifdef FIO_USE_GENERIC_INIT_RANDOM_STATE -extern void td_fill_rand_seeds (struct thread_data *td); -/* -* Initialize the various random states we need (random io, block size ranges, -* read/write mix, etc). -*/ -static inline int init_random_state (struct thread_data *td,unsigned long *rand_seeds,int size) +static inline int init_random_seeds (unsigned long *rand_seeds,int size) {int fd;
@@ -336,7 +313,6 @@ static inline int init_random_state(struct thread_data *td, unsigned long *rand_ }close (fd); -td_fill_rand_seeds (td);return 0 ; }#endif
@@ -348,14 +324,6 @@ static inline unsigned long long get_fs_free_size(const char *path) }#endif -#ifdef __powerpc64__ -#define FIO_HAVE_CPU_ONLINE_SYSCONF -static inline unsigned int cpus_online (void ) -{ -return sysconf (_SC_NPROCESSORS_CONF); -} -#endif -#ifndef FIO_HAVE_CPU_ONLINE_SYSCONF static inline unsigned int cpus_online (void ) {
stat.c +4 -2
@@ -1825,8 +1825,10 @@ void __show_run_stats(void) }for (i =0 ; i <FIO_OUTPUT_NR ; i++) { -buf_output_flush (&output[i]); -buf_output_free (&output[i]); +struct buf_output *out = &output[i]; +log_info_buf (out->buf, out->buflen); +buf_output_clear (out); +buf_output_free (out); }log_info_flush ();