Merge branch 'histograms-PR' of https://github.com/cronburg/fio
authorJens Axboe <axboe@fb.com>
Sun, 7 Aug 2016 21:07:53 +0000 (15:07 -0600)
committerJens Axboe <axboe@fb.com>
Sun, 7 Aug 2016 21:07:53 +0000 (15:07 -0600)
.travis.yml
HOWTO
configure
engines/rbd.c
filesetup.c
stat.c

index 9bef750f8a61535b30d1064e221d633fe9ae42e8..bf0433de520d7383c3e0408095be1ebbe70ade73 100644 (file)
@@ -4,4 +4,4 @@ compiler:
   - gcc
 before_install:
   - sudo apt-get -qq update
-  - sudo apt-get install -y libaio-dev libnuma-dev
+  - sudo apt-get install -qq -y libaio-dev libnuma-dev libz-dev
diff --git a/HOWTO b/HOWTO
index d4b23c897fb188a99f4794e63769b50ef109b81a..0085b7471ff669119b669495b591a3053ff10c32 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -1175,7 +1175,7 @@ cpus_allowed_policy=str Set the policy of how fio distributes the CPUs
                one cpu per job. If not enough CPUs are given for the jobs
                listed, then fio will roundrobin the CPUs in the set.
 
-numa_cpu_nodes=str Set this job running on spcified NUMA nodes' CPUs. The
+numa_cpu_nodes=str Set this job running on specified NUMA nodes' CPUs. The
                arguments allow comma delimited list of cpu numbers,
                A-B ranges, or 'all'. Note, to enable numa options support,
                fio must be built on a system with libnuma-dev(el) installed.
@@ -1606,7 +1606,7 @@ write_lat_log=str Same as write_bw_log, except that this option stores io
                The actual log names will be foo_slat.x.log, foo_clat.x.log,
                and foo_lat.x.log, where x is the index of the job (1..N,
                where N is the number of jobs). This helps fio_generate_plot
-               fine the logs automatically. If 'per_job_logs' is false, then
+               find the logs automatically. If 'per_job_logs' is false, then
                the filename will not include the job index. See 'Log File
                Formats'.
 
index 5f6bca3b4f1e172af47af6de10e5d3e243a418cf..93c372006660b4ad26dfd8eb346e19ac51c161f2 100755 (executable)
--- a/configure
+++ b/configure
@@ -166,6 +166,8 @@ for opt do
   ;;
   --disable-rbd) disable_rbd="yes"
   ;;
+  --disable-rbd-blkin) disable_rbd_blkin="yes"
+  ;;
   --disable-gfapi) disable_gfapi="yes"
   ;;
   --enable-libhdfs) libhdfs="yes"
@@ -1333,6 +1335,34 @@ fi
 echo "rbd_invalidate_cache          $rbd_inval"
 fi
 
+##########################################
+# check for blkin
+rbd_blkin="no"
+cat > $TMPC << EOF
+#include <rbd/librbd.h>
+#include <zipkin_c.h>
+
+int main(int argc, char **argv)
+{
+  int r;
+  struct blkin_trace_info t_info;
+  blkin_init_trace_info(&t_info);
+  rbd_completion_t completion;
+  rbd_image_t image;
+  uint64_t off;
+  size_t len;
+  const char *buf;
+  r = rbd_aio_write_traced(image, off, len, buf, completion, &t_info);
+  return 0;
+}
+EOF
+if test "$disable_rbd" != "yes" && test "$disable_rbd_blkin" != "yes" \
+ && compile_prog "" "-lrbd -lrados -lblkin" "rbd_blkin"; then
+  LIBS="-lblkin $LIBS"
+  rbd_blkin="yes"
+fi
+echo "rbd blkin tracing             $rbd_blkin"
+
 ##########################################
 # Check whether we have setvbuf
 setvbuf="no"
@@ -1778,6 +1808,9 @@ fi
 if test "$rbd_inval" = "yes" ; then
   output_sym "CONFIG_RBD_INVAL"
 fi
+if test "$rbd_blkin" = "yes" ; then
+  output_sym "CONFIG_RBD_BLKIN"
+fi
 if test "$setvbuf" = "yes" ; then
   output_sym "CONFIG_SETVBUF"
 fi
index c85645aeac3ec921e6b599071e951d45b10ceb7c..5e17fbe73a7fab5cc1b04431c3df7965d76acd01 100644 (file)
@@ -9,12 +9,18 @@
 
 #include "../fio.h"
 #include "../optgroup.h"
+#ifdef CONFIG_RBD_BLKIN
+#include <zipkin_c.h>
+#endif
 
 struct fio_rbd_iou {
        struct io_u *io_u;
        rbd_completion_t completion;
        int io_seen;
        int io_complete;
+#ifdef CONFIG_RBD_BLKIN
+       struct blkin_trace_info info;
+#endif
 };
 
 struct rbd_data {
@@ -391,16 +397,28 @@ static int fio_rbd_queue(struct thread_data *td, struct io_u *io_u)
        }
 
        if (io_u->ddir == DDIR_WRITE) {
+#ifdef CONFIG_RBD_BLKIN
+               blkin_init_trace_info(&fri->info);
+               r = rbd_aio_write_traced(rbd->image, io_u->offset, io_u->xfer_buflen,
+                                        io_u->xfer_buf, fri->completion, &fri->info);
+#else
                r = rbd_aio_write(rbd->image, io_u->offset, io_u->xfer_buflen,
                                         io_u->xfer_buf, fri->completion);
+#endif
                if (r < 0) {
                        log_err("rbd_aio_write failed.\n");
                        goto failed_comp;
                }
 
        } else if (io_u->ddir == DDIR_READ) {
+#ifdef CONFIG_RBD_BLKIN
+               blkin_init_trace_info(&fri->info);
+               r = rbd_aio_read_traced(rbd->image, io_u->offset, io_u->xfer_buflen,
+                                       io_u->xfer_buf, fri->completion, &fri->info);
+#else
                r = rbd_aio_read(rbd->image, io_u->offset, io_u->xfer_buflen,
                                        io_u->xfer_buf, fri->completion);
+#endif
 
                if (r < 0) {
                        log_err("rbd_aio_read failed.\n");
index a48faf588140ca79f7f00a8a95f63266a63f7a39..1ecdda61c3f460f8ae03dda4a6a5cce9c7fd5278 100644 (file)
@@ -761,16 +761,12 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
 uint64_t get_start_offset(struct thread_data *td, struct fio_file *f)
 {
        struct thread_options *o = &td->o;
-       uint64_t offset;
 
        if (o->file_append && f->filetype == FIO_TYPE_FILE)
                return f->real_file_size;
 
-       offset = td->o.start_offset + td->subjob_number * td->o.offset_increment;
-       if (offset % td_max_bs(td))
-               offset -= (offset % td_max_bs(td));
-
-       return offset;
+       return td->o.start_offset +
+               td->subjob_number * td->o.offset_increment;
 }
 
 /*
diff --git a/stat.c b/stat.c
index 965ff9fc129dcdf791a3d67f6f3a1e516fdafa79..96af94ba683deb5b4de2420e7fd04cf10e7b7d88 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -2140,7 +2140,9 @@ static long add_log_sample(struct thread_data *td, struct io_log *iolog,
         * need to do.
         */
        this_window = elapsed - iolog->avg_last;
-       if (this_window < iolog->avg_msec) {
+       if (elapsed < iolog->avg_last)
+               return iolog->avg_last - elapsed;
+       else if (this_window < iolog->avg_msec) {
                int diff = iolog->avg_msec - this_window;
 
                if (inline_log(iolog) || diff > LOG_MSEC_SLACK)