Merge branch 'expression-parser'
authorJens Axboe <axboe@fb.com>
Fri, 3 Oct 2014 19:20:16 +0000 (13:20 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 3 Oct 2014 19:20:16 +0000 (13:20 -0600)
Merge in the arithmetic parser.

27 files changed:
FIO-VERSION-GEN
HOWTO
engines/binject.c
engines/glusterfs_async.c
engines/guasi.c
engines/libaio.c
engines/null.c
engines/posixaio.c
engines/rbd.c
engines/rdma.c
engines/sg.c
engines/skeleton_external.c
engines/solarisaio.c
engines/sync.c
engines/windowsaio.c
filesetup.c
fio.h
fio_time.h
gettime.c
io_u.c
io_u_queue.h
ioengine.h
ioengines.c
iolog.c
iolog.h
json.c
os/windows/install.wxs

index d36c76db1e1464f7dbd3b5e5fa921421a2c7ee38..3057fed3ec541e72f52c62b0d39dbad83d46779c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=FIO-VERSION-FILE
-DEF_VER=fio-2.1.12
+DEF_VER=fio-2.1.13
 
 LF='
 '
diff --git a/HOWTO b/HOWTO
index 57911b431fb03fa1a069c4e7d413af052b6eb4d8..2cecbbba6ab00d1b8f5cf1e5ea8ef646a0dca0b7 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -392,7 +392,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
@@ -567,7 +567,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
index 43e316950be45a3f9c9a183c6e7619b60b980b98..c0baf9d262c87376e10cfc43c7732a742c6b50e6 100644 (file)
@@ -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;
index 7b0b30a747fc460c921b4ee0776abfaed5cce4d9..599bc5dfbfc0acc1e3efe72a74d606cdf249e3b8 100644 (file)
@@ -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;
index c9c742959902793f34e98f94acb9b61be7a7bb86..c586f09c809dc246a3172f7b27d60a24c7e30ca4 100644 (file)
@@ -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;
index 9cc910d73bc19fdbb690baa5295131fc0f7addbc..6c5d73ed27dd1751ac98c1177fcdbf2bdf2fe487 100644 (file)
@@ -18,7 +18,20 @@ struct libaio_data {
        struct io_event *aio_events;
        struct iocb **iocbs;
        struct io_u **io_us;
-       int iocbs_nr;
+
+       /*
+        * Basic ring buffer. 'head' is incremented in _queue(), and
+        * 'tail' is incremented in _commit(). We keep 'queued' so
+        * that we know if the ring is full or empty, when
+        * 'head' == 'tail'. 'entries' is the ring size, and
+        * 'is_pow2' is just an optimization to use AND instead of
+        * modulus to get the remainder on ring increment.
+        */
+       int is_pow2;
+       unsigned int entries;
+       unsigned int queued;
+       unsigned int head;
+       unsigned int tail;
 };
 
 struct libaio_options {
@@ -41,6 +54,15 @@ static struct fio_option options[] = {
        },
 };
 
+static inline void ring_inc(struct libaio_data *ld, unsigned int *val,
+                           unsigned int add)
+{
+       if (ld->is_pow2)
+               *val = (*val + add) & (ld->entries - 1);
+       else
+               *val = (*val + add) % ld->entries;
+}
+
 static int fio_libaio_prep(struct thread_data fio_unused *td, struct io_u *io_u)
 {
        struct fio_file *f = io_u->file;
@@ -117,13 +139,19 @@ static int user_io_getevents(io_context_t aio_ctx, unsigned int max,
 }
 
 static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
-                               unsigned int max, struct timespec *t)
+                               unsigned int max, const struct timespec *t)
 {
        struct libaio_data *ld = td->io_ops->data;
        struct libaio_options *o = td->eo;
        unsigned actual_min = td->o.iodepth_batch_complete == 0 ? 0 : min;
+       struct timespec __lt, *lt = NULL;
        int r, events = 0;
 
+       if (t) {
+               __lt = *t;
+               lt = &__lt;
+       }
+
        do {
                if (o->userspace_reap == 1
                    && actual_min == 0
@@ -133,12 +161,14 @@ static int fio_libaio_getevents(struct thread_data *td, unsigned int min,
                                ld->aio_events + events);
                } else {
                        r = io_getevents(ld->aio_ctx, actual_min,
-                               max, ld->aio_events + events, t);
+                               max, ld->aio_events + events, lt);
                }
                if (r >= 0)
                        events += r;
                else if (r == -EAGAIN)
                        usleep(100);
+               else
+                       break;
        } while (events < min);
 
        return r < 0 ? r : events;
@@ -150,7 +180,7 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
 
        fio_ro_check(td, io_u);
 
-       if (ld->iocbs_nr == (int) td->o.iodepth)
+       if (ld->queued == td->o.iodepth)
                return FIO_Q_BUSY;
 
        /*
@@ -160,7 +190,7 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
         * have pending io, to let fio complete those first.
         */
        if (ddir_sync(io_u->ddir)) {
-               if (ld->iocbs_nr)
+               if (ld->queued)
                        return FIO_Q_BUSY;
 
                do_io_u_sync(td, io_u);
@@ -168,16 +198,17 @@ static int fio_libaio_queue(struct thread_data *td, struct io_u *io_u)
        }
 
        if (io_u->ddir == DDIR_TRIM) {
-               if (ld->iocbs_nr)
+               if (ld->queued)
                        return FIO_Q_BUSY;
 
                do_io_u_trim(td, io_u);
                return FIO_Q_COMPLETED;
        }
 
-       ld->iocbs[ld->iocbs_nr] = &io_u->iocb;
-       ld->io_us[ld->iocbs_nr] = io_u;
-       ld->iocbs_nr++;
+       ld->iocbs[ld->head] = &io_u->iocb;
+       ld->io_us[ld->head] = io_u;
+       ring_inc(ld, &ld->head, 1);
+       ld->queued++;
        return FIO_Q_QUEUED;
 }
 
@@ -205,29 +236,67 @@ static int fio_libaio_commit(struct thread_data *td)
        struct libaio_data *ld = td->io_ops->data;
        struct iocb **iocbs;
        struct io_u **io_us;
-       int ret;
+       struct timeval tv;
+       int ret, wait_start = 0;
 
-       if (!ld->iocbs_nr)
+       if (!ld->queued)
                return 0;
 
-       io_us = ld->io_us;
-       iocbs = ld->iocbs;
        do {
-               ret = io_submit(ld->aio_ctx, ld->iocbs_nr, iocbs);
+               long nr = ld->queued;
+
+               nr = min((unsigned int) nr, ld->entries - ld->tail);
+               io_us = ld->io_us + ld->tail;
+               iocbs = ld->iocbs + ld->tail;
+
+               ret = io_submit(ld->aio_ctx, nr, iocbs);
                if (ret > 0) {
                        fio_libaio_queued(td, io_us, ret);
                        io_u_mark_submit(td, ret);
-                       ld->iocbs_nr -= ret;
-                       io_us += ret;
-                       iocbs += ret;
+
+                       ld->queued -= ret;
+                       ring_inc(ld, &ld->tail, ret);
                        ret = 0;
-               } else if (!ret || ret == -EAGAIN || ret == -EINTR) {
+                       wait_start = 0;
+               } else if (ret == -EINTR || !ret) {
                        if (!ret)
                                io_u_mark_submit(td, ret);
+                       wait_start = 0;
+                       continue;
+               } else if (ret == -EAGAIN) {
+                       /*
+                        * If we get EAGAIN, we should break out without
+                        * error and let the upper layer reap some
+                        * events for us. If we have no queued IO, we
+                        * must loop here. If we loop for more than 30s,
+                        * just error out, something must be buggy in the
+                        * IO path.
+                        */
+                       if (ld->queued) {
+                               ret = 0;
+                               break;
+                       }
+                       if (!wait_start) {
+                               fio_gettime(&tv, NULL);
+                               wait_start = 0;
+                       } else if (mtime_since_now(&tv) > 30000) {
+                               log_err("fio: aio appears to be stalled, giving up\n");
+                               break;
+                       }
+                       usleep(1);
                        continue;
+               } else if (ret == -ENOMEM) {
+                       /*
+                        * If we get -ENOMEM, reap events if we can. If
+                        * we cannot, treat it as a fatal event since there's
+                        * nothing we can do about it.
+                        */
+                       if (ld->queued)
+                               ret = 0;
+                       break;
                } else
                        break;
-       } while (ld->iocbs_nr);
+       } while (ld->queued);
 
        return ret;
 }
@@ -254,11 +323,11 @@ static void fio_libaio_cleanup(struct thread_data *td)
 
 static int fio_libaio_init(struct thread_data *td)
 {
-       struct libaio_data *ld = malloc(sizeof(*ld));
        struct libaio_options *o = td->eo;
+       struct libaio_data *ld;
        int err = 0;
 
-       memset(ld, 0, sizeof(*ld));
+       ld = calloc(1, sizeof(*ld));
 
        /*
         * First try passing in 0 for queue depth, since we don't
@@ -276,13 +345,11 @@ static int fio_libaio_init(struct thread_data *td)
                return 1;
        }
 
-       ld->aio_events = malloc(td->o.iodepth * sizeof(struct io_event));
-       memset(ld->aio_events, 0, td->o.iodepth * sizeof(struct io_event));
-       ld->iocbs = malloc(td->o.iodepth * sizeof(struct iocb *));
-       memset(ld->iocbs, 0, sizeof(struct iocb *));
-       ld->io_us = malloc(td->o.iodepth * sizeof(struct io_u *));
-       memset(ld->io_us, 0, td->o.iodepth * sizeof(struct io_u *));
-       ld->iocbs_nr = 0;
+       ld->entries = td->o.iodepth;
+       ld->is_pow2 = is_power_of_2(ld->entries);
+       ld->aio_events = calloc(ld->entries, sizeof(struct io_event));
+       ld->iocbs = calloc(ld->entries, sizeof(struct iocb *));
+       ld->io_us = calloc(ld->entries, sizeof(struct io_u *));
 
        td->io_ops->data = ld;
        return 0;
index e7df6a134d479c5ab370f496044619b18f6b15d2..600093052d683bc1d3e5a44d2ecd5e590e5d4786 100644 (file)
@@ -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;
index 2df26af3848eb6b4c14aea90ef16d0e946e8c43e..8ab88fbb1faf2821c442015f85f78e24cb1d244d 100644 (file)
@@ -91,7 +91,7 @@ static int fio_posixaio_prep(struct thread_data fio_unused *td,
 #define SUSPEND_ENTRIES        8
 
 static 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];
index 85a705fc8bd4d8ae6347f2378a0058e8566c0d2f..6fe87b8d010cc6bd1161655fb1e7684528406ebc 100644 (file)
@@ -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;
index af50187a62bf5f2607cffe25eeb456b12987598c..50812020f64673d400ecb59658a6cfbe8f94d038 100644 (file)
@@ -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;
index 1a027daeb353fca972da13cf8796983024364463..6272b79b568242239ae93cd028e919029b83c7b7 100644 (file)
@@ -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;
index f9a0e1cdddf73011880664cb39e3d133596c7240..63a6f8d177edbd31b0fc913a3c96b63e59a35e33 100644 (file)
@@ -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;
 }
index 137dc225d151393959266e0e6e1df51377c67bfc..55a0cb95d133f8b6b85730023bf72172db5ec2f4 100644 (file)
@@ -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;
index 1329946459ae27edc8c45e603faa4b97448eac7c..41612dfa8c31ba0f8fc81436d162fee1ece500da 100644 (file)
@@ -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;
index 16df74035f189e15c3811755b68285795f694aaa..ec8222c90c9f89cba4d16e2f7f5e9f336a639c14 100644 (file)
@@ -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;
index 29a76c0c3f5a52d60d18cb9775ec8b99bc603a1a..43146ba7671f61216fa938380c4bab908cd44b20 100644 (file)
@@ -898,7 +898,7 @@ int setup_files(struct thread_data *td)
                }
        }
 
-       if (!o->size || o->size > total_size)
+       if (!o->size || (total_size && o->size > total_size))
                o->size = total_size;
 
        if (o->size < td_min_bs(td)) {
diff --git a/fio.h b/fio.h
index 136b43089285e1887a417c60d8f63a3d635e1176..f981739e8fc261285056da4bdc65a50bc8757fdb 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -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)));
 }
index 9f7d209a303f7987612923f456162fe5ce5d1d96..5fd3847d37338f3a30c960a762edf65f2eea7077 100644 (file)
@@ -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);
index 8a1392392ab2ff3c92b8698c59fe79ea7cdd9adc..9f8362090095c2d679c2b568274649d931aa8942 100644 (file)
--- a/gettime.c
+++ b/gettime.c
@@ -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;
 }
diff --git a/io_u.c b/io_u.c
index 9adc31bf04d1ce3cbaaaa2ddaa94e6b7f4dcb569..612057d15762dfa13e7e48bc48e99658f9e8880a 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -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);
 
index b702b1f3987578079ad67d42908feaf8f1093a79..bda40d5ea263920055f6d75c62bdca8e4559034c 100644 (file)
@@ -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;
 }
index 108c97cd0b93a629607d264ca711748967b3b536..85923fcee3fdc1ff2f75be2bdec79048fac00c26 100644 (file)
@@ -15,7 +15,7 @@
 #include <guasi.h>
 #endif
 
-#define FIO_IOOPS_VERSION      20
+#define FIO_IOOPS_VERSION      21
 
 enum {
        IO_U_F_FREE             = 1 << 0,
@@ -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, unsigned
 extern 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)
index 3010f6c146c4dbbcf0f9d191d0f44f22dfaa46d2..07d1d5678986cbe86fd3c87eae1c3a413526ba2a 100644 (file)
@@ -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;
diff --git a/iolog.c b/iolog.c
index ef8b84145db0e14f808bdb53539184011b44975b..4a7d939af251c77ae2de82d2ad57b15a9f04d4b4 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -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;
diff --git a/iolog.h b/iolog.h
index fcd6794278edd6a39e1c6fd73997370e314b120b..a1e32ae7335b0b439518f3e1940235c041158ab1 100644 (file)
--- a/iolog.h
+++ b/iolog.h
@@ -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 *);
diff --git a/json.c b/json.c
index 7480a61fa98939519f3306fa583977fd8d331f40..6145ee489dbd2c6077dfa3a8913fa3935cc49c0c 100644 (file)
--- a/json.c
+++ b/json.c
@@ -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)
index 18918ccfa8adb1a3ec9e84a07f9b26e10b7c44be..7338d635c64dfb95956531471438964dd7840f9d 100755 (executable)
@@ -10,7 +10,7 @@
        <Product Id="*"
          Codepage="1252" Language="1033"
          Manufacturer="fio" Name="fio"
-         UpgradeCode="2338A332-5511-43CF-B9BD-5C60496CCFCC" Version="2.1.12">
+         UpgradeCode="2338A332-5511-43CF-B9BD-5C60496CCFCC" Version="2.1.13">
                <Package
                  Description="Flexible IO Tester"
                  InstallerVersion="301" Keywords="Installer,MSI,Database"