Recent changes (master)
The following changes since commit 0bc27b0b7019e4c386f83258430fb6b3ac34cc06:
filesetup: fix a bug where we overwrite the set size (2014-09-29 21:23:51 -0600)
are available in the git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to a120ca7f793b41532b04e3915fcd6646fa37bb4f:
engines/libaio: don't reap on EAGAIN and no pending events (2014-09-30 20:28:45 -0600)
----------------------------------------------------------------
Jens Axboe (5):
Use calloc() instead of malloc + memset
Constify 'td' in a few functions
engines/libaio: fix issue with EAGAIN
Constify a few more hot paths
engines/libaio: don't reap on EAGAIN and no pending events
ordahan (1):
HOWTO: fix typo
HOWTO | 4 +- engines/binject.c | 3 +- engines/glusterfs_async.c | 2 +- engines/guasi.c | 2 +- engines/libaio.c | 110 ++++++++++++++++++++++++++++++++----------- engines/null.c | 2 +- engines/posixaio.c | 2 +- engines/rbd.c | 2 +- engines/rdma.c | 2 +- engines/sg.c | 3 +- engines/skeleton_external.c | 2 +- engines/solarisaio.c | 2 +- engines/sync.c | 2 +- engines/windowsaio.c | 5 +- fio.h | 2 +- fio_time.h | 10 ++-- gettime.c | 10 ++-- io_u.c | 2 +- io_u_queue.h | 2 +- ioengine.h | 10 ++-- ioengines.c | 9 ++-- iolog.c | 8 ++-- iolog.h | 4 +- json.c | 10 +--- 24 files changed, 131 insertions(+), 79 deletions(-)
---
Diff of recent changes:
HOWTO +2 -2
@@ -379,7 +379,7 @@ rw=str Type of io pattern. Accepted values are: For certain types of io the result may still be skewed a bit, since the speed may be different. It is possible to specify a number of IO's to do before getting a new offset, this is - one by appending a ':<nr>' to the end of the string given. + done by appending a ':<nr>' to the end of the string given. For a random read, it would look like 'rw=randread:8' for passing in an offset modifier with a value of 8. If the suffix is used with a sequential IO pattern, then the value
@@ -554,7 +554,7 @@ bssplit=str Sometimes you want even finer grained control of the while having 90% 4k writes and 10% 8k writes, you would specify: - bssplit=2k/50:4k/50,4k/90,8k/10 + bssplit=2k/50:4k/50,4k/90:8k/10 blocksize_unaligned bs_unaligned If this option is given, any byte size value within bsrange
engines/binject.c +2 -1
@@ -91,7 +91,8 @@ one_more: }static int fio_binject_getevents (struct thread_data *td,unsigned int min, - unsigned int max, struct timespec fio_unused *t) +unsigned int max, + const struct timespec fio_unused *t) {struct binject_data *bd = td->io_ops->data;int left = max, ret, r =0 , ev_index =0 ;
engines/glusterfs_async.c +1 -1
@@ -20,7 +20,7 @@ static struct io_u *fio_gf_event(struct thread_data *td, int event) }static int fio_gf_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {struct gf_data *g = td->io_ops->data;unsigned int events =0 ;
engines/guasi.c +1 -1
@@ -80,7 +80,7 @@ static struct io_u *fio_guasi_event(struct thread_data *td, int event) }static int fio_guasi_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {struct guasi_data *ld = td->io_ops->data;int n, r;
engines/libaio.c +82 -28
198 lines not on this page · raw message
engines/null.c +1 -1
@@ -32,7 +32,7 @@ static struct io_u *fio_null_event(struct thread_data *td, int event)static int fio_null_getevents (struct thread_data *td,unsigned int min_events, unsigned int fio_unused max, - struct timespec fio_unused *t) + const struct timespec fio_unused *t) {struct null_data *nd = (struct null_data *) td->io_ops->data;int ret =0 ;
engines/posixaio.c +1 -1
@@ -91,7 +91,7 @@ static int fio_posixaio_prep(struct thread_data fio_unused *td,#define SUSPEND_ENTRIES 8static int fio_posixaio_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {struct posixaio_data *pd = td->io_ops->data;os_aiocb_t *suspend_list[SUSPEND_ENTRIES ];
engines/rbd.c +1 -1
@@ -222,7 +222,7 @@ static struct io_u *fio_rbd_event(struct thread_data *td, int event) }static int fio_rbd_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {struct rbd_data *rbd_data = td->io_ops->data;unsigned int events =0 ;
engines/rdma.c +1 -1
@@ -524,7 +524,7 @@ static struct io_u *fio_rdmaio_event(struct thread_data *td, int event) }static int fio_rdmaio_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {struct rdmaio_data *rd = td->io_ops->data;enum ibv_wc_opcode comp_opcode;
engines/sg.c +2 -1
@@ -62,7 +62,8 @@ static int pollin_events(struct pollfd *pfds, int fds) }static int fio_sgio_getevents (struct thread_data *td,unsigned int min, - unsigned int max, struct timespec fio_unused *t) +unsigned int max, + const struct timespec fio_unused *t) {struct sgio_data *sd = td->io_ops->data;int left = max, ret, r =0 ;
engines/skeleton_external.c +1 -1
@@ -38,7 +38,7 @@ static struct io_u *fio_skeleton_event(struct thread_data *td, int event)* numbers. Required. */ static int fio_skeleton_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {return 0 ; }
engines/solarisaio.c +1 -1
@@ -73,7 +73,7 @@ static void wait_for_event(struct timeval *tv) }static int fio_solarisaio_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max,const struct timespec *t) {struct solarisaio_data *sd = td->io_ops->data;struct timeval tv;
engines/sync.c +1 -1
@@ -138,7 +138,7 @@ static int fio_syncio_queue(struct thread_data *td, struct io_u *io_u)static int fio_vsyncio_getevents (struct thread_data *td,unsigned int min,unsigned int max, - struct timespec fio_unused *t) + const struct timespec fio_unused *t) {struct syncio_data *sd = td->io_ops->data;int ret;
engines/windowsaio.c +3 -2
@@ -37,7 +37,7 @@ struct thread_ctx {static BOOL timeout_expired (DWORD start_count,DWORD end_count);static int fio_windowsaio_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t); +unsigned int max,const struct timespec *t);static struct io_u *fio_windowsaio_event (struct thread_data *td,int event);static int fio_windowsaio_queue (struct thread_data *td,struct io_u *io_u);
@@ -256,7 +256,8 @@ static struct io_u* fio_windowsaio_event(struct thread_data *td, int event) }static int fio_windowsaio_getevents (struct thread_data *td,unsigned int min, -unsigned int max,struct timespec *t) +unsigned int max, +const struct timespec *t) {struct windowsaio_data *wd = td->io_ops->data;unsigned int dequeued =0 ;
fio.h +1 -1
@@ -406,7 +406,7 @@ extern const char fio_version_string[];extern struct thread_data *threads; -static inline void fio_ro_check (struct thread_data *td,struct io_u *io_u) +static inline void fio_ro_check (const struct thread_data *td,struct io_u *io_u) {assert (!(io_u->ddir ==DDIR_WRITE && !td_write (td))); }
fio_time.h +5 -5
@@ -2,11 +2,11 @@#define FIO_TIME_H struct thread_data ; -extern uint64_t utime_since (struct timeval *,struct timeval *); -extern uint64_t utime_since_now (struct timeval *); -extern uint64_t mtime_since (struct timeval *,struct timeval *); -extern uint64_t mtime_since_now (struct timeval *); -extern uint64_t time_since_now (struct timeval *); +extern uint64_t utime_since (const struct timeval *,const struct timeval *); +extern uint64_t utime_since_now (const struct timeval *); +extern uint64_t mtime_since (const struct timeval *,const struct timeval *); +extern uint64_t mtime_since_now (const struct timeval *); +extern uint64_t time_since_now (const struct timeval *);extern uint64_t mtime_since_genesis (void );extern uint64_t utime_since_genesis (void );extern void usec_spin (unsigned int );
gettime.c +5 -5
@@ -377,7 +377,7 @@ void fio_clock_init(void)log_info ("fio: clocksource=cpu may not be reliable\n" ); } -uint64_t utime_since (struct timeval *s,struct timeval *e) +uint64_t utime_since (const struct timeval *s,const struct timeval *e) {long sec, usec;uint64_t ret;
@@ -400,7 +400,7 @@ uint64_t utime_since(struct timeval *s, struct timeval *e)return ret; } -uint64_t utime_since_now (struct timeval *s) +uint64_t utime_since_now (const struct timeval *s) {struct timeval t;
@@ -408,7 +408,7 @@ uint64_t utime_since_now(struct timeval *s)return utime_since (s, &t); } -uint64_t mtime_since (struct timeval *s,struct timeval *e) +uint64_t mtime_since (const struct timeval *s,const struct timeval *e) {long sec, usec, ret;
@@ -429,7 +429,7 @@ uint64_t mtime_since(struct timeval *s, struct timeval *e)return ret; } -uint64_t mtime_since_now (struct timeval *s) +uint64_t mtime_since_now (const struct timeval *s) {struct timeval t;void *p =__builtin_return_address (0 );
@@ -438,7 +438,7 @@ uint64_t mtime_since_now(struct timeval *s)return mtime_since (s, &t); } -uint64_t time_since_now (struct timeval *s) +uint64_t time_since_now (const struct timeval *s) {return mtime_since_now (s) /1000 ; }
io_u.c +1 -1
@@ -1301,7 +1301,7 @@ void lat_target_check(struct thread_data *td)* If latency target is enabled, we might be ramping up or down and not * using the full queue depth available. */ -int queue_full (struct thread_data *td) +int queue_full (const struct thread_data *td) {const int qempty =io_u_qempty (&td->io_u_freelist);
io_u_queue.h +1 -1
@@ -28,7 +28,7 @@ static inline void io_u_qpush(struct io_u_queue *q, struct io_u *io_u) q->io_us[q->nr++] = io_u; } -static inline int io_u_qempty (struct io_u_queue *q) +static inline int io_u_qempty (const struct io_u_queue *q) {return !q->nr; }
ioengine.h +5 -5
@@ -137,7 +137,7 @@ struct ioengine_ops {int (*prep)(struct thread_data *,struct io_u *);int (*queue)(struct thread_data *,struct io_u *);int (*commit)(struct thread_data *); -int (*getevents)(struct thread_data *,unsigned int ,unsigned int ,struct timespec *); +int (*getevents)(struct thread_data *,unsigned int ,unsigned int ,const struct timespec *);struct io_u *(*event)(struct thread_data *,int );int (*cancel)(struct thread_data *,struct io_u *);void (*cleanup)(struct thread_data *);
@@ -182,7 +182,7 @@ extern int __must_check td_io_init(struct thread_data *);extern int __must_check td_io_prep (struct thread_data *,struct io_u *);extern int __must_check td_io_queue (struct thread_data *,struct io_u *);extern int __must_check td_io_sync (struct thread_data *,struct fio_file *); -extern int __must_check td_io_getevents (struct thread_data *,unsigned int ,unsigned int ,struct timespec *); +extern int __must_check td_io_getevents (struct thread_data *,unsigned int ,unsigned int ,const struct timespec *);extern int __must_check td_io_commit (struct thread_data *);extern int __must_check td_io_open_file (struct thread_data *,struct fio_file *);extern int td_io_close_file (struct thread_data *,struct fio_file *);
@@ -215,10 +215,10 @@ extern void fill_io_buffer(struct thread_data *, void *, unsigned int, unsignedextern void io_u_fill_buffer (struct thread_data *td,struct io_u *,unsigned int ,unsigned int );void io_u_mark_complete (struct thread_data *,unsigned int );void io_u_mark_submit (struct thread_data *,unsigned int ); -int queue_full (struct thread_data *); +int queue_full (const struct thread_data *); -int do_io_u_sync (struct thread_data *,struct io_u *); -int do_io_u_trim (struct thread_data *,struct io_u *); +int do_io_u_sync (const struct thread_data *,struct io_u *); +int do_io_u_trim (const struct thread_data *,struct io_u *);#ifdef FIO_INC_DEBUG static inline void dprint_io_u (struct io_u *io_u,const char *p)
ioengines.c +5 -4
@@ -220,7 +220,7 @@ int td_io_prep(struct thread_data *td, struct io_u *io_u) }int td_io_getevents (struct thread_data *td,unsigned int min,unsigned int max, -struct timespec *t) +const struct timespec *t) {int r =0 ;
@@ -522,7 +522,8 @@ int td_io_get_file_size(struct thread_data *td, struct fio_file *f)return td->io_ops->get_file_size (td, f); } -static int do_sync_file_range (struct thread_data *td,struct fio_file *f) +static int do_sync_file_range (const struct thread_data *td, +struct fio_file *f) {off64_t offset, nbytes;
@@ -535,7 +536,7 @@ static int do_sync_file_range(struct thread_data *td, struct fio_file *f)return sync_file_range (f->fd, offset, nbytes, td->o.sync_file_range); } -int do_io_u_sync (struct thread_data *td,struct io_u *io_u) +int do_io_u_sync (const struct thread_data *td,struct io_u *io_u) {int ret;
@@ -561,7 +562,7 @@ int do_io_u_sync(struct thread_data *td, struct io_u *io_u)return ret; } -int do_io_u_trim (struct thread_data *td,struct io_u *io_u) +int do_io_u_trim (const struct thread_data *td,struct io_u *io_u) {#ifndef FIO_HAVE_TRIM io_u->error =EINVAL ;
iolog.c +4 -4
@@ -28,7 +28,7 @@ void queue_io_piece(struct thread_data *td, struct io_piece *ipo) td->total_io_size += ipo->len; } -void log_io_u (struct thread_data *td,struct io_u *io_u) +void log_io_u (const struct thread_data *td,const struct io_u *io_u) {if (!td->o.write_iolog_file)return ;
@@ -282,7 +282,7 @@ void unlog_io_piece(struct thread_data *td, struct io_u *io_u) td->io_hist_len--; } -void trim_io_piece (struct thread_data *td,struct io_u *io_u) +void trim_io_piece (struct thread_data *td,const struct io_u *io_u) {struct io_piece *ipo = io_u->ipo;
@@ -539,9 +539,9 @@ int init_iolog(struct thread_data *td)void setup_log (struct io_log **log,struct log_params *p,const char *filename) { -struct io_log *l =malloc (sizeof (*l)); +struct io_log *l; -memset (l,0 ,sizeof (*l)); + l =calloc (1 ,sizeof (*l)); l->nr_samples =0 ; l->max_samples =1024 ; l->log_type = p->log_type;
iolog.h +2 -2
@@ -174,12 +174,12 @@ enum file_log_act {struct io_u ;extern int __must_check read_iolog_get (struct thread_data *,struct io_u *); -extern void log_io_u (struct thread_data *,struct io_u *); +extern void log_io_u (const struct thread_data *,const struct io_u *);extern void log_file (struct thread_data *,struct fio_file *,enum file_log_act );extern int __must_check init_iolog (struct thread_data *td);extern void log_io_piece (struct thread_data *,struct io_u *);extern void unlog_io_piece (struct thread_data *,struct io_u *); -extern void trim_io_piece (struct thread_data *,struct io_u *); +extern void trim_io_piece (struct thread_data *,const struct io_u *);extern void queue_io_piece (struct thread_data *,struct io_piece *);extern void prune_io_piece_log (struct thread_data *);extern void write_iolog_close (struct thread_data *);
json.c +2 -8
@@ -8,18 +8,12 @@struct json_object *json_create_object (void ) { -struct json_object *obj =malloc (sizeof (struct json_object )); -if (obj) -memset (obj,0 ,sizeof (struct json_object )); -return obj; +return calloc (1 ,sizeof (struct json_object )); }struct json_array *json_create_array (void ) { -struct json_array *array =malloc (sizeof (struct json_array )); -if (array) -memset (array,0 ,sizeof (struct json_array )); -return array; +return calloc (1 ,sizeof (struct json_array )); }static struct json_pair *json_create_pair (const char *name,struct json_value *value)