From: Jens Axboe Date: Sun, 7 Aug 2016 21:07:53 +0000 (-0600) Subject: Merge branch 'histograms-PR' of https://github.com/cronburg/fio X-Git-Tag: fio-2.14~57 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3c746856fd63f3f7624a34ea70e226a290d9cc01;hp=1e613c9c23932006263dd8334007865f32891a0c Merge branch 'histograms-PR' of https://github.com/cronburg/fio --- diff --git a/.travis.yml b/.travis.yml index 9bef750f..bf0433de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 d4b23c89..0085b747 100644 --- 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'. diff --git a/configure b/configure index 5f6bca3b..93c37200 100755 --- 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 +#include + +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 diff --git a/engines/rbd.c b/engines/rbd.c index c85645ae..5e17fbe7 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -9,12 +9,18 @@ #include "../fio.h" #include "../optgroup.h" +#ifdef CONFIG_RBD_BLKIN +#include +#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"); diff --git a/filesetup.c b/filesetup.c index a48faf58..1ecdda61 100644 --- a/filesetup.c +++ b/filesetup.c @@ -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 965ff9fc..96af94ba 100644 --- 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)