Recent changes (master)
The following changes since commit bcd27f7ae1ccebd2ac1778752bf8f13fa99600e9:
Fixup ->open_files if not given (2014-02-25 14:01:26 -0800)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 225ba9e3433cf27d8ff7b213d9f78b7ef2776c70:
Branch and cache miss speedups (2014-02-26 14:31:15 -0800)
----------------------------------------------------------------
Jens Axboe (2):
blktrace: load improvements
Branch and cache miss speedups
blktrace.c | 9 ++++++++- compiler/compiler.h | 2 ++ engines/net.c | 2 +- engines/rbd.c | 2 +- file.h | 2 +- filesetup.c | 12 +++++++----- gettime.c | 2 +- init.c | 4 ++-- io_u.c | 2 +- ioengine.h | 38 +++++++++++++++++++------------------- iolog.c | 3 +-- lib/lfsr.c | 9 ++++----- options.c | 3 +-- 13 files changed, 49 insertions(+), 41 deletions(-)
---
Diff of recent changes:
blktrace.c +8 -1
@@ -217,6 +217,8 @@ static int trace_add_file(struct thread_data *td, __u32 device)dprint (FD_BLKTRACE ,"add devices %s\n" , dev); fileno =add_file_exclusive (td, dev); + td->files[fileno]->major = maj; + td->files[fileno]->minor = min;trace_add_open_close_event (td, fileno,FIO_LOG_OPEN_FILE ); last_fileno = fileno; }
@@ -369,7 +371,7 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap)unsigned int cpu;unsigned int rw_bs[2 ];struct fifo *fifo; -int fd, i; +int fd, i, old_state;struct fio_file *f; fd =open (filename,O_RDONLY );
@@ -380,6 +382,9 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap) fifo =fifo_alloc (TRACE_FIFO_SIZE ); + old_state = td->runstate; +td_set_runstate (td,TD_SETTING_UP ); + td->o.size =0 ; cpu =0 ;
@@ -458,6 +463,8 @@ int load_blktrace(struct thread_data *td, const char *filename, int need_swap)fifo_free (fifo);close (fd); +td_set_runstate (td, old_state); +if (!td->files_index) {log_err ("fio: did not find replay device(s)\n" );return 1 ;
compiler/compiler.h +2 -0
@@ -20,4 +20,6 @@#define fio_init __attribute__((constructor))#define fio_exit __attribute__((destructor)) +#define fio_unlikely (x) __builtin_expect(!!(x), 0) +#endif
engines/net.c +1 -1
@@ -1194,7 +1194,7 @@ static int fio_netio_setup(struct thread_data *td)struct netio_data *nd;if (!td->files_index) { -add_file (td, td->o.filename ?:"net" ,0 ); +add_file (td, td->o.filename ?:"net" ,0 ,0 ); td->o.nr_files = td->o.nr_files ?:1 ; }
engines/rbd.c +1 -1
@@ -377,7 +377,7 @@ static int fio_rbd_setup(struct thread_data *td)* The size of the RBD is set instead of a artificial file. */ if (!td->files_index) { -add_file (td, td->o.filename ? :"rbd" ,0 ); +add_file (td, td->o.filename ? :"rbd" ,0 ,0 ); td->o.nr_files = td->o.nr_files ? :1 ; } f = td->files[0 ];
file.h +1 -1
@@ -167,7 +167,7 @@ extern int __must_check generic_close_file(struct thread_data *, struct fio_fileextern int __must_check generic_get_file_size (struct thread_data *,struct fio_file *);extern int __must_check file_lookup_open (struct fio_file *f,int flags);extern int __must_check pre_read_files (struct thread_data *); -extern int add_file (struct thread_data *,const char *,int ); +extern int add_file (struct thread_data *,const char *,int ,int );extern int add_file_exclusive (struct thread_data *,const char *);extern void get_file (struct fio_file *);extern int __must_check put_file (struct thread_data *,struct fio_file *);
filesetup.c +7 -5
@@ -1010,7 +1010,7 @@ int init_random_map(struct thread_data *td) seed = td->rand_seeds[FIO_RAND_BLOCK_OFF ]; -if (!lfsr_init (&f->lfsr, blocks, seed, seed &0xF )) +if (!lfsr_init (&f->lfsr, blocks, seed,0 ))continue ; }else if (!td->o.norandommap) { f->io_axmap =axmap_new (blocks);
@@ -1145,7 +1145,7 @@ static void free_already_allocated() { } } -int add_file (struct thread_data *td,const char *fname,int numjob) +int add_file (struct thread_data *td,const char *fname,int numjob,int inc) {int cur_files = td->files_index;char file_name[PATH_MAX ];
@@ -1237,6 +1237,9 @@ int add_file(struct thread_data *td, const char *fname, int numjob)if (!td->o.open_files) td->o.open_files =1 ; +if (inc) + td->o.nr_files++; +dprint (FD_FILE ,"file %p \"%s\" added at %d\n" , f, f->file_name, cur_files);
@@ -1253,7 +1256,7 @@ int add_file_exclusive(struct thread_data *td, const char *fname)return i; } -return add_file (td, fname,0 ); +return add_file (td, fname,0 ,1 ); }void get_file (struct fio_file *f)
@@ -1362,8 +1365,7 @@ static int recurse_dir(struct thread_data *td, const char *dirname) }if (S_ISREG (sb.st_mode)) { -add_file (td, full_path,0 ); - td->o.nr_files++; +add_file (td, full_path,0 ,1 );continue ; }if (!S_ISDIR (sb.st_mode))
gettime.c +1 -1
@@ -205,7 +205,7 @@ void fio_gettime(struct timeval *tp, void fio_unused *caller)gtod_log_caller (caller);#endif -if (fio_tv) { +if (fio_unlikely (fio_tv)) {memcpy (tp, fio_tv,sizeof (*tp));return ; }
init.c +2 -2
@@ -1026,10 +1026,10 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, file_alloced =1 ;if (o->nr_files ==1 &&exists_and_not_file (jobname)) -add_file (td, jobname, job_add_num); +add_file (td, jobname, job_add_num,0 );else {for (i =0 ; i < o->nr_files; i++) -add_file (td,make_filename (fname, o, jobname, job_add_num, i), job_add_num); +add_file (td,make_filename (fname, o, jobname, job_add_num, i), job_add_num,0 ); } }
io_u.c +1 -1
@@ -1307,9 +1307,9 @@ again:else if (!queue_full (td)) { io_u =io_u_qpop (&td->io_u_freelist); + io_u->file =NULL ; io_u->buflen =0 ; io_u->resid =0 ; - io_u->file =NULL ; io_u->end_io =NULL ; }
ioengine.h +19 -19
@@ -73,6 +73,25 @@ struct io_u {struct io_piece *ipo; +unsigned int resid; +unsigned int error; + +/* +* io engine private data +*/ +union { +unsigned int index; +unsigned int seen; +void *engine_data; + }; + +struct flist_head verify_list; + +/* +* Callback for io completion +*/ +int (*end_io)(struct thread_data *,struct io_u *); +union {#ifdef CONFIG_LIBAIO struct iocb iocb;
@@ -97,25 +116,6 @@ struct io_u {#endif void *mmap_data; }; - -unsigned int resid; -unsigned int error; - -/* -* io engine private data -*/ -union { -unsigned int index; -unsigned int seen; -void *engine_data; - }; - -struct flist_head verify_list; - -/* -* Callback for io completion -*/ -int (*end_io)(struct thread_data *,struct io_u *); };/*
iolog.c +1 -2
@@ -323,8 +323,7 @@ static int read_iolog2(struct thread_data *td, FILE *f) }else if (r ==2 ) { rw =DDIR_INVAL ;if (!strcmp (act,"add" )) { - td->o.nr_files++; - fileno =add_file (td, fname,0 ); + fileno =add_file (td, fname,0 ,1 ); file_action =FIO_LOG_ADD_FILE ;continue ; }else if (!strcmp (act,"open" )) {
lib/lfsr.c +4 -5
@@ -2,6 +2,7 @@#include <math.h> #include "lfsr.h" +#include "../compiler/compiler.h" /* * LFSR taps retrieved from:
@@ -132,11 +133,9 @@ int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t last)if (fl->cycle_length && !--fl->cycle_length) {__lfsr_next (fl, fl->spin +1 ); fl->cycle_length = fl->cached_cycle_length; - goto check; - } -__lfsr_next (fl, fl->spin); -check: ; - }while (fl->last_val > fl->max_val); + }else +__lfsr_next (fl, fl->spin); + }while (fio_unlikely (fl->last_val > fl->max_val)); *off = fl->last_val;return 0 ;
options.c +1 -2
@@ -827,8 +827,7 @@ static int str_filename_cb(void *data, const char *input)while ((fname =get_next_name (&str)) !=NULL ) {if (!strlen (fname))break ; -add_file (td, fname,0 ); - td->o.nr_files++; +add_file (td, fname,0 ,1 ); }free (p);