fio.git
5 years agoserver: be locally vocal about communication issues
Jens Axboe [Thu, 27 Sep 2018 18:26:47 +0000 (12:26 -0600)]
server: be locally vocal about communication issues

If we fail the CRC check or if we have a mismatched client/server,
then we can't reliably transmit anything across the wire. For that
case, in addition to attempting to relay this information across
the wire, also print a local warning.

This fixes a case where we silently exit when the client/server
versions aren't properly matched.

Fixes: https://github.com/axboe/fio/issues/620
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Thu, 27 Sep 2018 15:42:21 +0000 (09:42 -0600)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  zbd: Fix zbd_zone_nr()

5 years agozbd: Fix zbd_zone_nr()
Bart Van Assche [Thu, 27 Sep 2018 15:12:19 +0000 (08:12 -0700)]
zbd: Fix zbd_zone_nr()

Instead of returning sizeof(struct fio_zone_info) * (zone number),
return the zone number.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agozbd: Remove unused function and variable
Damien Le Moal [Wed, 26 Sep 2018 06:42:26 +0000 (15:42 +0900)]
zbd: Remove unused function and variable

check_swd() was defined to nothing. Remove it.
additionally, the variable ret in zbd_reset_zonei() is unused and not
necessary. Remove it too.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoeta: Avoid adjustements to a negative value
Damien Le Moal [Wed, 26 Sep 2018 06:42:10 +0000 (15:42 +0900)]
eta: Avoid adjustements to a negative value

In the case of zonemode=strided job with both zone_size and zone_skip
specified, thread_eta() calculates the upper bound of the number of
zones that will be processed, including skipped bytes between zones
(zone_skip). Adjusting bytes_total (i.e. total_io_size) by substracting
this number of zones times the amount of skipped bytes can result in
a negative value for bytes_total (a large number of bytes) when for
example the job operates on an entire disk with a capacity that is not
divisible exactly by zone_size+zone_skip or if the options --size is
used to limit the I/O range. In such case, use the lower bound of the
number of zones to obtain a better approximation of the job eta.

Additionnally, if --io_size was specified, bytes_total will indicate
this exact value, so adjusting that value for zonemode != none is not
necessary.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoparse: fix negative FIO_OPT_INT too-large check
Jens Axboe [Wed, 26 Sep 2018 02:15:05 +0000 (20:15 -0600)]
parse: fix negative FIO_OPT_INT too-large check

If we have an option, like nice, that has a minval that is negative,
then we need to ensure we cast properly for the check.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoparse: fix minval checking
Jens Axboe [Wed, 26 Sep 2018 01:44:35 +0000 (19:44 -0600)]
parse: fix minval checking

For values that allow negative min values, don't cast to an uint.

Fixes: 5d2788d5b798 ("parse: fix min/max val checking for FIO_OPT_INT")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd regression test for flow/negative option parser breakage
Jens Axboe [Wed, 26 Sep 2018 01:40:59 +0000 (19:40 -0600)]
Add regression test for flow/negative option parser breakage

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoparse: fix min/max val checking for FIO_OPT_INT
Jens Axboe [Wed, 26 Sep 2018 01:24:36 +0000 (19:24 -0600)]
parse: fix min/max val checking for FIO_OPT_INT

We compare an unsigned long long to an int max/min value, this
is going to break for negative numbers, for instance.

Fixes a case where flow=-1 doesn't work properly because of that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoparse: print option name for out-of-range settings
Jens Axboe [Wed, 26 Sep 2018 01:14:22 +0000 (19:14 -0600)]
parse: print option name for out-of-range settings

Right now we just say we're out of range:

max value out of range: 18446744073709551612 (4294967295 max)

but we don't actually say which option this is. Add that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agostat: print the right percentile variant for json output
Jens Axboe [Sat, 22 Sep 2018 21:02:04 +0000 (15:02 -0600)]
stat: print the right percentile variant for json output

We always show the clat percentiles for the json output, regardless
of whether lat_percentiles or clat_percentiles was defined in the
job. Correct that so we show the right output depending on the
job setting.

Fixes: https://github.com/axboe/fio/issues/691
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'steadystate-doc' of https://github.com/vincentkfu/fio
Jens Axboe [Fri, 21 Sep 2018 15:50:07 +0000 (09:50 -0600)]
Merge branch 'steadystate-doc' of https://github.com/vincentkfu/fio

* 'steadystate-doc' of https://github.com/vincentkfu/fio:
  docs: clarify usage of steadystate detection feature

5 years agodocs: clarify usage of steadystate detection feature
Vincent Fu [Fri, 21 Sep 2018 15:37:17 +0000 (11:37 -0400)]
docs: clarify usage of steadystate detection feature

Note that most intended uses of the steadystate detection feature
likely also need the --time_based and --runtime options or the
--loops option so that fio does not stop running after accessing
the full size of the device(s) or file(s).

5 years agoengines/http: work-around crash in certain libssl versions
Jens Axboe [Fri, 21 Sep 2018 15:17:38 +0000 (09:17 -0600)]
engines/http: work-around crash in certain libssl versions

Fixes: https://github.com/axboe/fio/issues/684
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoblktrace: fix leak of 'merge_buf'
Jens Axboe [Thu, 20 Sep 2018 20:25:56 +0000 (14:25 -0600)]
blktrace: fix leak of 'merge_buf'

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoblktrace: provide empty merge_blktrace_iologs()
Jens Axboe [Thu, 20 Sep 2018 19:14:11 +0000 (13:14 -0600)]
blktrace: provide empty merge_blktrace_iologs()

For platforms that don't suppor blktrace, we need an empty
helper that just fails it.

Fixes: b9921d1a56d9 ("blktrace: add support to interleave blktrace files")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoblktrace: add option to iterate over a trace multiple times
Dennis Zhou [Thu, 20 Sep 2018 18:08:10 +0000 (14:08 -0400)]
blktrace: add option to iterate over a trace multiple times

Scaling a particular trace may result in different runtimes among the
merging traces. By knowing the approximate length of each trace as a
user, the overall runtime of each can be tuned to line up by letting
certain traces loop multiple times.

First, the last timestamp of a trace is recorded at the end of the first
iteration to denote the length of a trace. This value is then used to
offset subsequent iterations of a trace.

Next, the "--merge_blktrace_iters" option is introduced to let the user
specify the number of times to loop over each specific trace. This is
done by passing a comma separated list that index-wise pairs with the
passed files in "--read_iolog". Iteration counts are introduced as well
as keeping track of the length of each trace.

In an example, given two traces, A and B, each 60s long. If we want to
see the impact of trace A issuing IOs twice as fast, the
--merge_blktrace_scalars="50:100" can be set and then
--merge_blktrace_iters="2:1". This runs trace A at 2x the speed twice for
approximately the same runtime as a single run of trace B.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoblktrace: add option to scale a trace
Dennis Zhou [Thu, 20 Sep 2018 18:08:09 +0000 (14:08 -0400)]
blktrace: add option to scale a trace

As we explore stacking traces, it is nice to be able to scale a trace to
understand how the traces end up interacting.

This patch adds scaling by letting the user pass in percentages to scale
a trace by. When passed '--merge_blktrace_scalars="100"', the trace is
ran at 100% speed. If passed 50%, this will halve the trace timestamps.
The new option takes in a comma separated list that index-wise pairs
with the passed files in "--read_iolog".

This option differs from "--replay_time_scale" which scales the trace
during runtime and will not change the output unlike this option.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoblktrace: add support to interleave blktrace files
Dennis Zhou [Thu, 20 Sep 2018 18:08:08 +0000 (14:08 -0400)]
blktrace: add support to interleave blktrace files

Running concurrent workloads via multiple jobs can lead to
nondeterministic results as we are at the scheduler's mercy. While the
actual performance of the workload may vary regardless, this makes the
order of events consistent.

This patch introduces two flags: --merge_blktrace_file=<file> and
--merge-blktrace-only. When the first is specified, files that are ':'
separated in --read_iolog are passed to a merge function wich then
produces a single sorted trace file. This file is then passed on in
place of the sorted list or fio exists if --merge-blktrace-only is
specified.

During merging, events are filtered based on what fio cares about and
the pdu is discarded as well.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agooptions: rename name string operations for more general use
Dennis Zhou [Thu, 20 Sep 2018 18:08:07 +0000 (14:08 -0400)]
options: rename name string operations for more general use

get_next_name() and get_max_str_idx() are helpers that iterate and split
a string separated by ':'. s/name/str/g to make this more generic which
will be used to parse file paths for blktraces to merge.

Signed-off-by: Dennis Zhou <dennis@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'epoch-time-hist-logs' of https://github.com/parallel-fs-utils/fio
Jens Axboe [Wed, 19 Sep 2018 15:42:47 +0000 (09:42 -0600)]
Merge branch 'epoch-time-hist-logs' of https://github.com/parallel-fs-utils/fio

* 'epoch-time-hist-logs' of https://github.com/parallel-fs-utils/fio:
  raise exception if test start time can't be estimated
  handle log_unix_epoch=1

5 years agofilesetup: use 64-bit type for file size generation
Jens Axboe [Mon, 17 Sep 2018 19:46:51 +0000 (13:46 -0600)]
filesetup: use 64-bit type for file size generation

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoRandom distribution 32-bit fixes
Jens Axboe [Mon, 17 Sep 2018 17:00:50 +0000 (11:00 -0600)]
Random distribution 32-bit fixes

We calculate and use nranges as an unsigned long, but that can
be 32-bit on some platforms and hence overflow.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agozbd: fix various 32-bit compilation warnings
Jens Axboe [Mon, 17 Sep 2018 14:39:22 +0000 (08:39 -0600)]
zbd: fix various 32-bit compilation warnings

Just dprint() string types.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoaxmap: isset_fn() should use 1ULL, not 1UL
Jens Axboe [Mon, 17 Sep 2018 03:58:26 +0000 (21:58 -0600)]
axmap: isset_fn() should use 1ULL, not 1UL

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/axmap: use a 64-bit type (not size_t) for axmap tests
Jens Axboe [Mon, 17 Sep 2018 03:55:45 +0000 (21:55 -0600)]
t/axmap: use a 64-bit type (not size_t) for axmap tests

Now we actually pass on 32-bit...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agolfsr: use unsigned long long for 64-bit values
Jens Axboe [Mon, 17 Sep 2018 03:52:22 +0000 (21:52 -0600)]
lfsr: use unsigned long long for 64-bit values

1UL is bit 64-bit on Windows builds.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoaxmap: use 64-bit index for the handlers
Jens Axboe [Mon, 17 Sep 2018 03:43:56 +0000 (21:43 -0600)]
axmap: use 64-bit index for the handlers

Most important one here is axmap_handler_topdown(), in which the
first iteration could end up truncating the index calculation.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoaxmap: use 64-bit type for number of bits
Jens Axboe [Mon, 17 Sep 2018 03:30:39 +0000 (21:30 -0600)]
axmap: use 64-bit type for number of bits

For huge devices, we can overflow on a 32-bit build of fio.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'windows_static' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 16 Sep 2018 16:13:23 +0000 (10:13 -0600)]
Merge branch 'windows_static' of https://github.com/sitsofe/fio

* 'windows_static' of https://github.com/sitsofe/fio:
  build: change where we set -static for Windows

5 years agobuild: change where we set -static for Windows
Sitsofe Wheeler [Sat, 15 Sep 2018 05:58:33 +0000 (06:58 +0100)]
build: change where we set -static for Windows

The Makefile forced static Windows builds by adding -static to the
CFLAGS but this is long after the configure tests had run. This could
lead to problems (such as https://github.com/axboe/fio/issues/683 "Fio
fails to link libcurl on windows (undefined references to
__imp_curl_easy_cleanup)") where the availability of a dynamic version
of library causes a feature to be enabled but when it comes to final
linking time we find that there's no static version of the library
available and fall over.

Fix the above by asking for a static build via the "Forcing some known
good options on Windows" section of the configure file which occurs
prior to configure tests. This also means configure will correctly
display that we are doing a static build.

Fixes https://github.com/axboe/fio/issues/683

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
5 years agoMerge branch 'histo-log-dup-timestamp' of https://github.com/parallel-fs-utils/fio
Jens Axboe [Wed, 12 Sep 2018 20:33:04 +0000 (14:33 -0600)]
Merge branch 'histo-log-dup-timestamp' of https://github.com/parallel-fs-utils/fio

* 'histo-log-dup-timestamp' of https://github.com/parallel-fs-utils/fio:
  filter out records with duplicate timestamps

5 years agofilter out records with duplicate timestamps
Ben England [Wed, 12 Sep 2018 17:14:50 +0000 (13:14 -0400)]
filter out records with duplicate timestamps

fio should not be outputting records with duplicate timestamps
into the histogram log, but because it does do this,
this script was getting divide-by-zero errors.
This workaround will filter out the duplicates,
which allows the script to operate on existing fio logs

5 years agowindows: make win_to_posix_error() more resilient
Jens Axboe [Wed, 12 Sep 2018 14:50:16 +0000 (08:50 -0600)]
windows: make win_to_posix_error() more resilient

If we pass in ERROR_SUCCESS, we should get a zero back.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agowindows: fix the most egregious posix.c style errors
Jens Axboe [Tue, 11 Sep 2018 22:54:39 +0000 (16:54 -0600)]
windows: fix the most egregious posix.c style errors

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agowindows: handle ERROR_NOT_READY
Jens Axboe [Tue, 11 Sep 2018 22:29:25 +0000 (16:29 -0600)]
windows: handle ERROR_NOT_READY

The windows-to-posix error translation doesn't include
ERROR_NOT_READY, add that.

Also add a default case that catches if we don't know what
an error is, and return EIO. That seems much safer than just
returning the Windows error directly, since the caller expects
an errno.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoFio 3.10 fio-3.10
Jens Axboe [Tue, 11 Sep 2018 15:08:07 +0000 (09:08 -0600)]
Fio 3.10

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd regression test for recent offload locking bug
Jens Axboe [Tue, 11 Sep 2018 14:27:41 +0000 (08:27 -0600)]
Add regression test for recent offload locking bug

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'offload-flags-fix' of https://github.com/vincentkfu/fio
Jens Axboe [Tue, 11 Sep 2018 14:25:57 +0000 (08:25 -0600)]
Merge branch 'offload-flags-fix' of https://github.com/vincentkfu/fio

* 'offload-flags-fix' of https://github.com/vincentkfu/fio:
  rate_submit: synchronize accesses to io_u_queue->nr

5 years agorate_submit: synchronize accesses to io_u_queue->nr
Vincent Fu [Tue, 11 Sep 2018 13:01:56 +0000 (09:01 -0400)]
rate_submit: synchronize accesses to io_u_queue->nr

Accesses to io_u_queue->nr are not properly synchronized in offload
submission mode. put_io_u locks td but the parent td flags reflecting
the need to lock are not propogated to child threads when the child
threads are intialized.

The main thread accesses io_u_queue->nr via io_u_qpop() as it prepares
io_u's for handing off to the worker threads. The worker threads access
io_u_queue->nr via io_u_qpush() as they complete io_u's. When these
accesses are not protected by locks, io_u_qpop() will return NULL when
it means to provide a valid io_u pointer. This occurs in offload
submission mode with iodepth > 1.

Fixes: 26b3a18 ("Make td_io_u_lock/unlock() explicit")

5 years agoMerge branch 'no-unittest-dep' of https://github.com/parallel-fs-utils/fio
Jens Axboe [Mon, 10 Sep 2018 15:56:11 +0000 (09:56 -0600)]
Merge branch 'no-unittest-dep' of https://github.com/parallel-fs-utils/fio

* 'no-unittest-dep' of https://github.com/parallel-fs-utils/fio:
  remove dependency on unittest2 module

5 years agoraise exception if test start time can't be estimated
Ben England [Mon, 10 Sep 2018 12:48:05 +0000 (08:48 -0400)]
raise exception if test start time can't be estimated

do not allow log_unix_epoch=1 with single-record histogram log
and no log_hist_msec parameter, because then we have no way of
estimating when the test started in absolute time.

5 years agohandle log_unix_epoch=1
Ben England [Mon, 10 Sep 2018 12:13:35 +0000 (08:13 -0400)]
handle log_unix_epoch=1

previously this program only handled log_unix_epoch=0
(time since start of test in histogram log column 1)
supports distributed workload generation
assumes hosts' clocks are tightly synced

5 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Sun, 9 Sep 2018 23:42:10 +0000 (17:42 -0600)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  num2str(): Avoid an out-of-bounds array access
  Micro-optimize num2str()
  iolog: Ensure that sockaddr_un.sun_path is '\0'-terminated

5 years agoKill fusion atomic write engine
Jens Axboe [Sat, 8 Sep 2018 14:06:57 +0000 (08:06 -0600)]
Kill fusion atomic write engine

Never really went anywhere, kill it with fire.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoRename example job files (*.job -> *.fio)
Jens Axboe [Sat, 8 Sep 2018 14:09:35 +0000 (08:09 -0600)]
Rename example job files (*.job -> *.fio)

Make it consistent.

Sugested-by: Rebecca Cran <rebecca@bluestop.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: cleanup output types
Jens Axboe [Fri, 7 Sep 2018 21:59:51 +0000 (15:59 -0600)]
client: cleanup output types

- Only print hostname= etc info for the NORMAL output, not for
  minimal/terse.

- Only print disk util header for NORMAL output.

- Cleanup json finish check

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: switch to per-client buffer
Jens Axboe [Fri, 7 Sep 2018 20:25:30 +0000 (14:25 -0600)]
client: switch to per-client buffer

Even with the local storage, for some operations we still end up
having to do split dumps. Include the buffer in the actual client,
and flush when the client is done.

Hopefully this fixes the remaining buffer output split for
client/server.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: use temp buffer for single output flush for json/disk util
Jens Axboe [Fri, 7 Sep 2018 19:52:18 +0000 (13:52 -0600)]
client: use temp buffer for single output flush for json/disk util

Similar to previous fixes, ensure that we log everything locally
before flushing it out.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoRevert "client: respect terse output on client <--> backend relationship"
Jens Axboe [Fri, 7 Sep 2018 19:06:32 +0000 (13:06 -0600)]
Revert "client: respect terse output on client <--> backend relationship"

This breaks a standard use case, which is a server without arguments
and a client with the --minimal option.

This reverts commit 1d1b65dc17c39f43dbe9d66062ca61fc3e90ddfc.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agolog: remember to free output buffer when done
Jens Axboe [Fri, 7 Sep 2018 18:57:52 +0000 (12:57 -0600)]
log: remember to free output buffer when done

We need to ensure we call buf_output_free() after using the
temp storage, otherwise we leaked the memory that we allocated
while filling the buffer.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoinit: use __log_buf() if we know buf != NULL
Jens Axboe [Fri, 7 Sep 2018 18:19:43 +0000 (12:19 -0600)]
init: use __log_buf() if we know buf != NULL

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agolog: use __log_buf() if we know buf != NULL
Jens Axboe [Fri, 7 Sep 2018 18:09:24 +0000 (12:09 -0600)]
log: use __log_buf() if we know buf != NULL

This apparently causes complaints on cygwin:

    CC stat.o
In file included from os/os-windows.h:18:0,
                 from os/os.h:54,
                 from thread_options.h:5,
                 from fio.h:18,
                 from init.c:19:
init.c: In function â€˜add_job’:
os/../log.h:24:12: error: the comparison will always evaluate as â€˜true’ for the address of â€˜out’ will never be NULL [-Werror=address]
  if ((buf) != NULL)    \
            ^
os/../log.h:24:12: note: in definition of macro â€˜log_buf’
  if ((buf) != NULL)    \

which is utterly stupid, but hey...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: use temp buffer for client text output
Jens Axboe [Fri, 7 Sep 2018 18:04:14 +0000 (12:04 -0600)]
client: use temp buffer for client text output

Don't split it into pieces, log it into a local buffer and then
flush it all at once.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoCollect startup output before logging it
Jens Axboe [Fri, 7 Sep 2018 18:02:39 +0000 (12:02 -0600)]
Collect startup output before logging it

We currently do the startup logging in separate chunks. This is
inefficient in terms of network trafic for client/server, and
it also causes output to be potentially mingled together:

<x1> Starting <x1> Starting 1 process1 process

Fix this by logging to a buffer, then transmitting that buffer
in one piece.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoremove dependency on unittest2 module
Ben England [Fri, 7 Sep 2018 16:43:21 +0000 (12:43 -0400)]
remove dependency on unittest2 module

The dependency of fio-histo-log-pctiles.py on unittest2 module was causing heartburn
for pbench community so I removed the dependency.
If unittest2 python package is installed and unittest2 module can be imported,
that's fine, we'll use it if requested,
but if it's not, that's fine too, you can still use the program.

5 years agonum2str(): Avoid an out-of-bounds array access
Bart Van Assche [Fri, 7 Sep 2018 14:19:34 +0000 (07:19 -0700)]
num2str(): Avoid an out-of-bounds array access

This patch fixes Coverity ID 169307.

Fixes: 1ec3d69b0ed8 ("Implement a better num2str()")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoMicro-optimize num2str()
Bart Van Assche [Sun, 26 Aug 2018 15:54:19 +0000 (08:54 -0700)]
Micro-optimize num2str()

Instead of selecting an element from the thousand[] array several times,
perform the choice between 1000 and 1024 once. This patch does not change
any functionality.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoiolog: Ensure that sockaddr_un.sun_path is '\0'-terminated
Bart Van Assche [Sun, 26 Aug 2018 15:38:28 +0000 (08:38 -0700)]
iolog: Ensure that sockaddr_un.sun_path is '\0'-terminated

This patch fixes Coverity ID 183494.

Fixes: 2f8f4821ef61 ("iolog: allow to read_iolog from unix socket")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoFio 3.9 fio-3.9
Jens Axboe [Thu, 6 Sep 2018 15:07:55 +0000 (09:07 -0600)]
Fio 3.9

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'master' of https://github.com/damien-lemoal/fio
Jens Axboe [Thu, 6 Sep 2018 01:25:39 +0000 (19:25 -0600)]
Merge branch 'master' of https://github.com/damien-lemoal/fio

* 'master' of https://github.com/damien-lemoal/fio:
  zbd: Use bytes unit
  zbd: Fix zbd_zone_idx()
  zbd: Remove inexistent functions declaration
  zbd: Improve read randomness

5 years agozbd: Use bytes unit
Damien Le Moal [Wed, 29 Aug 2018 01:45:22 +0000 (10:45 +0900)]
zbd: Use bytes unit

Simplify zbd.c code by using byte unit for the zone information values
instead of 512B sector count. Doing so, many 9 bits shift operations
are removed and code readability improved.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
5 years agozbd: Fix zbd_zone_idx()
Damien Le Moal [Wed, 29 Aug 2018 01:29:02 +0000 (10:29 +0900)]
zbd: Fix zbd_zone_idx()

For a zone size that is not a power of 2 number of sectors,
f->zbd_info->zone_size_log2 is set to -1. So use bit shift in
zbd_zone_idx() only if zone_size_log2 is not negative.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
5 years agozbd: Remove inexistent functions declaration
Damien Le Moal [Tue, 28 Aug 2018 05:09:13 +0000 (14:09 +0900)]
zbd: Remove inexistent functions declaration

The functions zbd_do_trim() and zbd_update_wp() are not implemented.
Remove there declarations from zbd.h.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
5 years agozbd: Improve read randomness
Damien Le Moal [Tue, 28 Aug 2018 04:47:23 +0000 (13:47 +0900)]
zbd: Improve read randomness

With zonemode=zbd, for random read operations with read_beyond_wp=0,
the zbd code will always adjust an I/O offset so that the I/O hits a
non empty zone. However, the adjustment always sets the I/O offset to
the start of the zone, resulting in a high device read cache hit rate
if the device has few zones written.

Improve randomness of read I/Os by adjusting the I/O offset to a random
value within the range of written data of the chosen zone. Also ensure
that the modified I/O does not cross over the zone wp position by
adjusting its size. Doing so, the search for a new zone is now done only
if the target zone cannot accomodate an I/O of at least min_bs bytes.

The comments have also been changed to better explain the code.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
5 years agoWindows: update download URL and add missing examples
Rebecca Cran [Wed, 5 Sep 2018 00:14:23 +0000 (18:14 -0600)]
Windows: update download URL and add missing examples

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoinit: move log name generation into helper
Jens Axboe [Wed, 5 Sep 2018 19:33:43 +0000 (13:33 -0600)]
init: move log name generation into helper

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'sz/log-names-need-help' of https://github.com/szaydel/fio
Jens Axboe [Wed, 5 Sep 2018 19:29:58 +0000 (13:29 -0600)]
Merge branch 'sz/log-names-need-help' of https://github.com/szaydel/fio

* 'sz/log-names-need-help' of https://github.com/szaydel/fio:
  Log files names start with _ when write_XX_log= keys in config file have empty value(s)

5 years agoDocument oddity with --status-interval and --output-format=json
Jens Axboe [Wed, 5 Sep 2018 15:29:00 +0000 (09:29 -0600)]
Document oddity with --status-interval and --output-format=json

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agozbd: Fix test scripts
Damien Le Moal [Wed, 5 Sep 2018 08:02:37 +0000 (17:02 +0900)]
zbd: Fix test scripts

Fix handling of the path to the test-zbd-support script to avoid an
error when the tests are run directly when in fio/t/zbd using the
command "./run-against...".

Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoLog files names start with _ when write_XX_log= keys in config file have empty value(s)
Sam Zaydel [Tue, 4 Sep 2018 21:28:29 +0000 (14:28 -0700)]
Log files names start with _ when write_XX_log= keys in config file have empty value(s)

5 years agoengines/sg: improve error handling
Vincent Fu [Mon, 27 Aug 2018 20:40:11 +0000 (16:40 -0400)]
engines/sg: improve error handling

The Linux sg driver accepts only 16 SCSI commands in flight
at a time per file descriptor. fio does not exit gracefully
when it attempts to queue up 17 or more trim commands via
the sg ioengine. This patch improves error handling in the
sg ioengine commit function to achieve a graceful exit if
fio attempts to queue up too many trim commands. The key to
this is calling clear_io_u on each io_u in the 17th trim
command. With this patch fio no longer loops forever
waiting for the IOs in the (not succesffully submitted)
17th trim command to complete.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: fix nr_samples
Jeff Furlong [Fri, 31 Aug 2018 18:26:05 +0000 (18:26 +0000)]
client: fix nr_samples

In convert_iolog_gz() a 32 bit variable is created to store struct cmd_iolog_pdu's 64 bit member.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'configure-help' of https://github.com/hahnjo/fio
Jens Axboe [Thu, 30 Aug 2018 14:22:21 +0000 (08:22 -0600)]
Merge branch 'configure-help' of https://github.com/hahnjo/fio

* 'configure-help' of https://github.com/hahnjo/fio:
  configure: Document more switches to disable features

5 years agoconfigure: Document more switches to disable features
Jonas Hahnfeld [Thu, 30 Aug 2018 12:25:45 +0000 (14:25 +0200)]
configure: Document more switches to disable features

This helps a lot when building on one machine and running on another
that doesn't have all libraries installed. The switches are all there,
list them in ./configure --help so that future users don't have to
search the shell script.

5 years agoMake td_io_u_lock/unlock() explicit
Jens Axboe [Sat, 25 Aug 2018 16:22:31 +0000 (10:22 -0600)]
Make td_io_u_lock/unlock() explicit

Hopefully this will make coverity a little happier, it currently
thinks they are unbalanced.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoclient: suppress non JSON default outputs on --output-format=json/json+
Tomohiro Kusumi [Fri, 24 Aug 2018 16:42:10 +0000 (09:42 -0700)]
client: suppress non JSON default outputs on --output-format=json/json+

Suppress "hostname=...", "Disk stats (read/write)" and thread status
if json/json+ is specified, as these are regular messages.

JSON parsers can't parse the output with these messages, and JSON
spec doesn't support comment either.

--
 # ./fio ./fio.cfg --output-format=json > out
 # python3 -c "import json; json.load(open('out'))"
 # ./fio ./fio.cfg --client=localhost --output-format=json > out
 # python3 -c "import json; json.load(open('out'))"
 Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "/usr/local/lib/python3.7/json/__init__.py", line 296, in load
     parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
   File "/usr/local/lib/python3.7/json/__init__.py", line 348, in loads
     return _default_decoder.decode(s)
   File "/usr/local/lib/python3.7/json/decoder.py", line 337, in decode
     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
   File "/usr/local/lib/python3.7/json/decoder.py", line 355, in raw_decode
     raise JSONDecodeError("Expecting value", s, err.value) from None
 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Sat, 25 Aug 2018 00:22:13 +0000 (18:22 -0600)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  Fix the typehelp[] array

5 years agoFix the typehelp[] array
Bart Van Assche [Fri, 24 Aug 2018 23:48:11 +0000 (16:48 -0700)]
Fix the typehelp[] array

This patch fixes Coverity ID 183335 (Out-of-bounds access of typehelp[] array).

Fixes: 5fff95436922 ("Add support for >= 4G block sizes")
Fixes: c47537ee91cd ("parse: add support for soft deprecated options")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
5 years agoMerge branch 'zbd'
Jens Axboe [Fri, 24 Aug 2018 18:59:45 +0000 (12:59 -0600)]
Merge branch 'zbd'

* zbd:
  Add scripts for testing the fio zoned block device support code
  Add support for resetting zones periodically
  Make it possible to limit the number of open zones
  Collect and show zone reset statistics
  Add support for zoned block devices
  Add two assert statements in mark_random_map()
  Pass offset and buffer length explicitly to mark_random_map()
  Introduce the io_u.post_submit callback function pointer
  Add the zonemode job option
  Add the 'zbd' debug level
  configure: Add <linux/blkzoned.h> test

5 years agoAdd scripts for testing the fio zoned block device support code
Bart Van Assche [Fri, 24 Aug 2018 18:31:31 +0000 (11:31 -0700)]
Add scripts for testing the fio zoned block device support code

These scripts can be run e.g. as follows:

t/zbd/run-tests-against-zoned-nullb &&
    t/zbd/run-tests-against-regular-nullb &&
    t/zbd/test-zbd-support /dev/disk/by-id/scsi-SHGST_HSH721414AL52M0_VEG007HG &&
    echo All tests passed

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd support for resetting zones periodically
Bart Van Assche [Fri, 24 Aug 2018 18:31:30 +0000 (11:31 -0700)]
Add support for resetting zones periodically

Filesystems that support zoned block devices typically perform garbage
collection if device usage exceeds a certain threshold. Add two command
line options that allow to simulate this behavior.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMake it possible to limit the number of open zones
Bart Van Assche [Fri, 24 Aug 2018 18:31:29 +0000 (11:31 -0700)]
Make it possible to limit the number of open zones

When running a random I/O test across an entire drive many more zones
will be open than in a typical application workload. Hence add a command
line option that allows to limit the number of open zones.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoCollect and show zone reset statistics
Bart Van Assche [Fri, 24 Aug 2018 18:31:28 +0000 (11:31 -0700)]
Collect and show zone reset statistics

Show how many zone resets have been performed in the I/O statistics.
An example:
[ ... ]
  write: IOPS=17.0k, BW=66.5MiB/s (69.8MB/s)(1024MiB/15387msec); 4 zone resets
[ ... ]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd support for zoned block devices
Bart Van Assche [Fri, 24 Aug 2018 18:31:27 +0000 (11:31 -0700)]
Add support for zoned block devices

This patch adds support for zoned block devices as follows:
- After the file size has been determined, check whether the file name
  refers to a block device. If so, check whether that block device is a
  host-managed block device. If that is the case, read the zone
  information using the BLKREPORTZONE ioctl. That ioctl is supported by
  the Linux kernel since kernel version v4.10.
- After all command-line options have been processed and all job files
  have been read, verify whether these refer to a zoned block device
  and also whether the specified options are compatible with a zoned
  block device. Complain if that is not the case.
- After each get_next_block() call, verify whether the block is
  appropriate for a zoned block device. When writing data to a
  sequential zone, adjust the write offset to the zone write pointer.
  When reading from a sequential zone, avoid reading past the write
  pointer.
- After I/O submission, update the variable that represents the write
  pointer.
- When writing data and with data verification enabled, reset a zone
  before writing any data into a zone. Otherwise reset a zone before
  issuing a write if that zone is full.
- Translate trim into zone resets. Zoned block devices namely do not
  have to support any of the SCSI commands that are used by the kernel
  to implement the discard ioctl (UNMAP / WRITE SAME).

This work started from a patch from Masato Suzuki <masato.suzuki@wdc.com>.
Some of the ideas in this patch come from Phillip Chen
<phillip.a.chen@seagate.com>.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd two assert statements in mark_random_map()
Bart Van Assche [Fri, 24 Aug 2018 18:31:26 +0000 (11:31 -0700)]
Add two assert statements in mark_random_map()

Add two assert statements that verify whether mark_random_map() is
used correctly.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoPass offset and buffer length explicitly to mark_random_map()
Bart Van Assche [Fri, 24 Aug 2018 18:31:25 +0000 (11:31 -0700)]
Pass offset and buffer length explicitly to mark_random_map()

This patch does not change any functionality. The changes introduced by
this patch will be used by the zoned block device code.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoIntroduce the io_u.post_submit callback function pointer
Bart Van Assche [Fri, 24 Aug 2018 18:31:24 +0000 (11:31 -0700)]
Introduce the io_u.post_submit callback function pointer

This patch does not change any functionality. The code introduced by
this patch will be used by the zoned block device code.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd the zonemode job option
Bart Van Assche [Fri, 24 Aug 2018 18:31:23 +0000 (11:31 -0700)]
Add the zonemode job option

Fio's zone support makes fio perform I/O inside a zone before it skips
to the next zone. That behavior is the opposite of the behavior needed
for zoned block devices, namely to consider all zones when performing
random I/O. Hence introduce a new job option that allows users to
choose between fio's traditional zone mode and the behavior needed for
zoned block devices. This patch makes fio behave identically with
--zonemode=none and --zonemode=zbd. A later patch will implement new
behavior for --zonemode=zbd.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoAdd the 'zbd' debug level
Bart Van Assche [Fri, 24 Aug 2018 18:31:22 +0000 (11:31 -0700)]
Add the 'zbd' debug level

This debug level will be used in the next patch.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoconfigure: Add <linux/blkzoned.h> test
Bart Van Assche [Fri, 24 Aug 2018 18:31:21 +0000 (11:31 -0700)]
configure: Add <linux/blkzoned.h> test

Add a test for <linux/blkzoned.h> because that header file will be used
by the zoned block device code.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/axmap: print explicit overlap ranges tested
Jens Axboe [Thu, 23 Aug 2018 19:58:21 +0000 (13:58 -0600)]
t/axmap: print explicit overlap ranges tested

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agot/axmap: add regression test for overlap case resulting in 0 settable bits
Jens Axboe [Thu, 23 Aug 2018 18:22:58 +0000 (12:22 -0600)]
t/axmap: add regression test for overlap case resulting in 0 settable bits

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoaxmap: return early of an overlap results in 0 settable bits
Jens Axboe [Thu, 23 Aug 2018 18:22:10 +0000 (12:22 -0600)]
axmap: return early of an overlap results in 0 settable bits

Reported-by: Bart Van Assche <bart.vanassche@wdc.com>
Fixes: 15a4f49 ("lib/axmap: Simplify axmap_set_fn()")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch '20180823-terse-remote-fix' of https://github.com/mcgrof/fio
Jens Axboe [Thu, 23 Aug 2018 17:05:34 +0000 (11:05 -0600)]
Merge branch '20180823-terse-remote-fix' of https://github.com/mcgrof/fio

* '20180823-terse-remote-fix' of https://github.com/mcgrof/fio:
  init: add semantics for all types of backends running
  client: respect terse output on client <--> backend relationship

5 years agoinit: add semantics for all types of backends running
Luis Chamberlain [Tue, 21 Aug 2018 18:15:39 +0000 (12:15 -0600)]
init: add semantics for all types of backends running

Commit 67a176fc7 ("Fix segfault with client/server and minimal output")
addressed a segfault but it wasn't very clear *why* the fix was needed.
The reason it was needed is that the disk util and its respective
semaphore are only initialized when setup_disk_util() is called, this
happens upon fio_backend() calls. That is, either we have a dedicated
backend or have initiated a backend for the localhost due to some local
work. And show_thread_status() is currently called from a complete
client setup -- handle_ts() calls show_thread_status(), and a client
does not collect any local disk data, it receives this from the backend.
As such, the semaphore won't be setup in a client setup and this is why
we segfault here.

We can enable show_thread_status() then only if any type of backend is
running, however there is are no semantics currently which enable us to
query for this. Add such semantics and replace the previous check with
a check for if fio_backend() was ever called. This will make it clearer.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
5 years agoclient: respect terse output on client <--> backend relationship
Luis Chamberlain [Tue, 21 Aug 2018 13:24:36 +0000 (07:24 -0600)]
client: respect terse output on client <--> backend relationship

You end up with different results if you run this terse output
on a local system which also runs its own backend Vs running a
client to connect to a remote server which is running fio as a
backend only. The reason is the client ops handle printing of
threads / disk utils separately. The terse output created *by*
the backend is the right and expected output, so just use that,
and we can piggy back off of the fact that the server will send
its own output via FIO_NET_CMD_TEXT.

Another solution is to address getting the disk util data sent
to be cached locally, and then upon handle_ts() print that, but that
would require significant re-architecturing.

Terse output is supposed to be just that, terse. This implies
that it will not be clear from what backend data came from, but
for this the best strategy is to *extend* the terse version with
yet another field, the remote hostname/ip address.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
5 years agoparse: fix bssplit option
Jens Axboe [Thu, 23 Aug 2018 16:29:12 +0000 (10:29 -0600)]
parse: fix bssplit option

Ensure that we copy option sets for FIO_OPT_STR_ULL like we do
for FIO_OPT_STR, in case only one data direction has been defined.

Fixes: 5fff95436922 ("Add support for >= 4G block sizes")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 years agoMerge branch 'axmap' of https://github.com/bvanassche/fio
Jens Axboe [Thu, 23 Aug 2018 02:13:45 +0000 (20:13 -0600)]
Merge branch 'axmap' of https://github.com/bvanassche/fio

* 'axmap' of https://github.com/bvanassche/fio:
  lib/axmap: Optimize __axmap_set()
  lib/axmap: Simplify axmap_set_fn()
  lib/axmap: Make axmap_new() more robust
  lib/axmap: Inline ulog64()
  lib/axmap: Add more documentation

5 years agolib/axmap: Optimize __axmap_set()
Bart Van Assche [Wed, 22 Aug 2018 20:22:12 +0000 (13:22 -0700)]
lib/axmap: Optimize __axmap_set()

Since it is guaranteed that nr_bits <= BLOCKS_PER_UNIT and since
axmap_set_fn() needs to be called only once to set that number of
bits, remove the loop from __axmap_set().

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>