fio.git
6 years agofio: kill unused TD_F_ flag
Jens Axboe [Wed, 11 Oct 2017 18:23:28 +0000 (12:23 -0600)]
fio: kill unused TD_F_ flag

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'fgp_fixes' of https://github.com/sitsofe/fio
Jens Axboe [Wed, 11 Oct 2017 14:26:28 +0000 (08:26 -0600)]
Merge branch 'fgp_fixes' of https://github.com/sitsofe/fio

6 years agoengines/windowsaio: style
Jens Axboe [Wed, 11 Oct 2017 14:25:10 +0000 (08:25 -0600)]
engines/windowsaio: style

Don't use braces for a single line block.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'windowaio_invalidate' of https://github.com/sitsofe/fio
Jens Axboe [Wed, 11 Oct 2017 14:24:54 +0000 (08:24 -0600)]
Merge branch 'windowaio_invalidate' of https://github.com/sitsofe/fio

6 years agoMerge branch 'ci_and_configure' of https://github.com/sitsofe/fio
Jens Axboe [Wed, 11 Oct 2017 14:23:41 +0000 (08:23 -0600)]
Merge branch 'ci_and_configure' of https://github.com/sitsofe/fio

6 years agobackend: don't dereference ->io_ops in reap_threads()
Justin Eno [Tue, 10 Oct 2017 17:54:54 +0000 (11:54 -0600)]
backend: don't dereference ->io_ops in reap_threads()

Without some type of mutex, td->io_ps cannot be dereferenced safely in
reap_threads().

Signed-off-by: Justin Eno <jeno@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoblktrace: use for_each_file()
Jens Axboe [Tue, 10 Oct 2017 16:46:07 +0000 (10:46 -0600)]
blktrace: use for_each_file()

Instead of open-coding its own version.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoengines/filecreate: set data direction for stats
Jens Axboe [Tue, 10 Oct 2017 14:27:38 +0000 (08:27 -0600)]
engines/filecreate: set data direction for stats

When we init the engine, use whatever data direction the job has
for the latency we log. This means that we're no longer dependent
on the job file setting rw=read/randread or not setting it at all.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoHOWTO: include note about increasing shared memory limits
Jens Axboe [Tue, 10 Oct 2017 14:12:59 +0000 (08:12 -0600)]
HOWTO: include note about increasing shared memory limits

Similarly to commit 7f4811bb36d3, but for the HOWTO.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'pr/note-for-shmmax' of https://github.com/taghos/fio
Jens Axboe [Tue, 10 Oct 2017 14:12:05 +0000 (08:12 -0600)]
Merge branch 'pr/note-for-shmmax' of https://github.com/taghos/fio

6 years agoAdd note for increasing shmmax if necessary
Ricardo Nabinger Sanchez [Mon, 9 Oct 2017 23:57:27 +0000 (20:57 -0300)]
Add note for increasing shmmax if necessary

When launching a large job, fio can attempt to grab more shared memory
than allowed by the kernel.  Hint the user about increasing such limit
on Linux systems.

Signed-off-by: Ricardo Nabinger Sanchez <rnsanchez@taghos.com.br>
6 years agoUpdate file creation example
Jens Axboe [Mon, 9 Oct 2017 20:42:45 +0000 (14:42 -0600)]
Update file creation example

Don't use a write data direction, use read or just don't set it
as fio defaults to read.

This ensures that all stats are printed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd an filecreate example file to examples/
Josef Bacik [Mon, 9 Oct 2017 20:35:51 +0000 (16:35 -0400)]
add an filecreate example file to examples/

This adds an example with some documentation on how to use
ioengine=filecreate.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd FIO_FILENOHASH ioengine flag
Josef Bacik [Mon, 9 Oct 2017 20:31:02 +0000 (16:31 -0400)]
add FIO_FILENOHASH ioengine flag

filecreate doesn't use the file hash table, so don't bother doing shared
memory allocations for the file objects, ye olde malloc will work just
fine.  This way we can create millions of files without jacking up
--alloc-size.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoengine/filecreate: use clat and reads for stats
Jens Axboe [Mon, 9 Oct 2017 19:13:13 +0000 (13:13 -0600)]
engine/filecreate: use clat and reads for stats

Fio defaults to reads, we should use the same direction as the job
though. Additionally, we must use clat latencies for tracking,
as this is a sync engine and whole latencies are logged as
completions.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agotime: add ntime_since_now()
Jens Axboe [Mon, 9 Oct 2017 18:58:26 +0000 (12:58 -0600)]
time: add ntime_since_now()

Convert filecreate engine to using it as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agofilesetup: don't track file allocation for jobs == 1
Jens Axboe [Mon, 9 Oct 2017 18:37:14 +0000 (12:37 -0600)]
filesetup: don't track file allocation for jobs == 1

We only really need this for multiple jobs, and we only check it
if we are in job > 1. But we always mark the file as allocated.
For jobs with lots of files (millions), this takes a long time
to do at setup time.

Running this sample job:

./fio --alloc-size=131072 --name=filecreate --ioengine=filecreate --size=1g --nr_files=1m --openfiles=256

takes ~16s before, and about ~7s afterwards.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoengines/filecreate: set FIO_NOSTATS flag
Jens Axboe [Mon, 9 Oct 2017 16:11:19 +0000 (10:11 -0600)]
engines/filecreate: set FIO_NOSTATS flag

Before this change, we bundle the fake IO latencies with the file
open latencies. That's not intended. Add a flag for IO engines to
tell the core to ignore any IO latencies.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoengines/filecreate: don't use file hash
Jens Axboe [Mon, 9 Oct 2017 16:10:39 +0000 (10:10 -0600)]
engines/filecreate: don't use file hash

We just care about the file open latencies, so pointless to
utilize the hash as regular engines do.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoengines/filecreate: a few fixes
Jens Axboe [Mon, 9 Oct 2017 15:13:52 +0000 (09:13 -0600)]
engines/filecreate: a few fixes

- Ensure that it shows up in the engine list
- Ensure that we actually do anything, if the user configures
  the size too small.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd a filecreate engine
Josef Bacik [Fri, 6 Oct 2017 19:43:14 +0000 (15:43 -0400)]
add a filecreate engine

This is for doing empty file creation jobs much like what we do with
fs_mark.  You still need to specify a filesize so that fio will pretend
to do something, but the IO won't actually be done on the file.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agostat: update json+ output format for --lat_percentiles option
Vincent Fu [Mon, 9 Oct 2017 14:47:12 +0000 (10:47 -0400)]
stat: update json+ output format for --lat_percentiles option

If --lat_percentiles is set to 1, change the json+ output format
so that the bins are inside the 'lat_ns' object.

Also update fio_jsonplus_clat2csv to look in the two possible
locations.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agostat: update description of clat accounting in stat.h
Vincent Fu [Mon, 9 Oct 2017 14:47:11 +0000 (10:47 -0400)]
stat: update description of clat accounting in stat.h

The description in stat.h of the data structure used for
storing completion latency percentiles had not been updated
to reflect the transition to nanosecond timing. This patch
updates the description to be consistent with the nanosecond
changes. There have been a few instances on github and the
mailing list where this had caused confusion.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agowindowsaio: add best effort cache invalidation
Sitsofe Wheeler [Tue, 26 Sep 2017 22:06:12 +0000 (23:06 +0100)]
windowsaio: add best effort cache invalidation

https://stackoverflow.com/questions/478340/clear-file-cache-to-repeat-performance-testing/7113153#7113153
mentions that opening a file without buffering on Windows has the side
effect of flushing cached parts of the file out of RAM. Use this side
effect to do cache invalidation on non-direct jobs that are using the
windowsaio engine.

This change may make default bandwidth speeds on Windows look lower
compared to older versions of fio but this matches the behaviour of fio
on other platforms with invalidation (such as Linux) because we are
trying to avoid measuring cache reuse (unless invalidate=0 is set).

Note that cache invalidation will fail to happen if the file is also
open elsewhere. Unfortunately, we can't check whether we have exclusive
access without introducing a race where other jobs/programs fail during
open because we temporarily have exclusive access to the file.

Invalidation is done as a call from within fio_windowsaio_open_file
because invalidation fails with multiple file handles (see above) and
it's simpler than trying to use ReOpenFile (which is only available from
Windows 2003/Windows Vista onwards).

The impact of invalidation is demonstrated by the bandwidths achieved by
the following jobs running on a hard disk of an otherwise idle system
with 4GBytes of RAM:
./fio --stonewall --thread --size=128M --filename=fio.tmp --iodepth=64 \
  --bs=128k --invalidate=0 --direct=0 \
  --name=create --rw=write \
  --name=cached --rw=read --loops=2 \
  --name=invalidated --rw=read --loops=2 --invalidate=1

[...]
cached: (groupid=1, jobs=1): err= 0: pid=3888: Sat Oct 7 08:05:39 2017
   read: IOPS=11.7k, BW=1463MiB/s (1534MB/s)(256MiB/175msec)
[...]
invalidated: (groupid=2, jobs=1): err= 0: pid=828: Sat Oct 7 08:05:39 2017
   read: IOPS=2089, BW=261MiB/s (274MB/s)(256MiB/980msec)

v2:
- Move invalidation into a helper function.
- Add more detail and rationale to the commit message.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agofio_generate_plots: cope with per_job_logs filenames
Sitsofe Wheeler [Sun, 1 Oct 2017 08:07:15 +0000 (09:07 +0100)]
fio_generate_plots: cope with per_job_logs filenames

- Teach fio_generate_plots how to find log files that are generated when
  per_job_logs=1 (which has been the fio default for a while).
- Make fio_generate_plots spit out an error message when no log files
  are found.

Fixes: https://github.com/axboe/fio/issues/43
Fixes: https://github.com/axboe/fio/issues/323

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agobackend: don't complain about no IO done for create_only=1
Jens Axboe [Fri, 6 Oct 2017 17:41:47 +0000 (11:41 -0600)]
backend: don't complain about no IO done for create_only=1

It's expected that we didn't actually run any IO, if the user
asked for just file creation.

Fixes: 48366f3a92cb ("Don't silently terminate td when no I/O performed due to error")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'master' of https://github.com/dyniusz/fio
Jens Axboe [Tue, 3 Oct 2017 17:19:26 +0000 (11:19 -0600)]
Merge branch 'master' of https://github.com/dyniusz/fio

6 years agoclient: fix pointer vs uint8_t comparison
Jens Axboe [Tue, 3 Oct 2017 15:30:37 +0000 (09:30 -0600)]
client: fix pointer vs uint8_t comparison

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'evelu/cleanup' of https://github.com/ErwanAliasr1/fio
Jens Axboe [Tue, 3 Oct 2017 15:29:35 +0000 (09:29 -0600)]
Merge branch 'evelu/cleanup' of https://github.com/ErwanAliasr1/fio

6 years agoclient: Fixing invalid use after free()
Erwan Velu [Tue, 3 Oct 2017 08:56:09 +0000 (10:56 +0200)]
client: Fixing invalid use after free()

As per commit be6fa258, reply->opcode is now called after freeing the structure.

This patch move the check of reply->opcode before freeing reply.

Signed-off-by: Erwan Velu <erwan@redhat.com>
6 years agoclient: Avoid memory leak in fio_client_handle_iolog()
Erwan Velu [Tue, 3 Oct 2017 08:43:11 +0000 (10:43 +0200)]
client:  Avoid memory leak in fio_client_handle_iolog()

The actual code was returning in different places without freeing some pointers in some cases.

We have two places where memory was allocated :
 - pdu = convert_iolog
 - log_pathname = malloc ()

This patch creates a label to manage the return code while checking if
those two pointers needs to be freed.

Signed-off-by: Erwan Velu <erwan@redhat.com>
6 years agot/gen-rand: Avoid memleak of buckets()
Erwan Velu [Tue, 3 Oct 2017 09:33:55 +0000 (11:33 +0200)]
t/gen-rand: Avoid memleak of buckets()

When exiting, buckets structure should be freed to avoid the memleak.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agooslib/libmtd: Removing useless err assigment
Erwan Velu [Tue, 3 Oct 2017 09:26:44 +0000 (11:26 +0200)]
oslib/libmtd: Removing useless err assigment

At this point, setting up err to 0 is useless since it is never read again.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agobackend: Removing memory leak in run_threads()
Erwan Velu [Tue, 3 Oct 2017 09:19:57 +0000 (11:19 +0200)]
backend: Removing memory leak in run_threads()

The fd structure must be freed before breaking the foreach() unless it
leaks its memory

This patch add a free() call in the last break statement.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agobackend: Removing double definition of the same variable
Erwan Velu [Tue, 3 Oct 2017 09:06:37 +0000 (11:06 +0200)]
backend: Removing double definition of the same variable

While f is defined as "struct fio_file *f = io_u->file;", it's pretty
useless to define it just before its usage.

This patch simply remove the 2nd definition of f.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoio_u: Converting usec from long to uint64_t
Erwan Velu [Tue, 3 Oct 2017 07:49:24 +0000 (09:49 +0200)]
io_u: Converting usec from long to uint64_t

'rate_next_io_time' structure and usec_sleep() are manipulating uint64_t.
It's more consistent having usec being expressed in the same stdint unit.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agobackend: fix a case where we complain about no IO being done
Jens Axboe [Thu, 28 Sep 2017 12:58:23 +0000 (06:58 -0600)]
backend: fix a case where we complain about no IO being done

If we're just doing a read phase verify, then we clear
bytes_done before we can check it at the end. Ensure that we
always notice if we did IO, so we don't spew this warning:

job_0: No I/O performed by libaio, perhaps try --debug=io option for details?

when we actually did do exactly what we had to.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoFio 3.1 fio-3.1
Jens Axboe [Thu, 28 Sep 2017 10:23:20 +0000 (04:23 -0600)]
Fio 3.1

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoRemove old exp/README.md file
Jens Axboe [Tue, 26 Sep 2017 19:38:38 +0000 (13:38 -0600)]
Remove old exp/README.md file

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoconfigure: update compiler probing
Sitsofe Wheeler [Sat, 23 Sep 2017 21:48:12 +0000 (22:48 +0100)]
configure: update compiler probing

- Allow clang to be always guessable as a fallback compiler after gcc.
  This increases the likelihood we have a compiler when one wasn't
  explicitly set before we search through #define definitions to guess
  what platform we're targeting. The fallback can be overridden later
  (e.g. to prefer clang above other fallbacks on specific platforms).
- Add comments to explain the preferred compiler search (inspired by
  comments in QEMU's ./configure).
- Change from only checking $CC to also checking $cross_prefix before
  overriding.
- Switch from setting CC to setting cc when overriding. This fixes the
  case where cc is "gcc" but CC is "i686-w64-mingw32-gcc" on Cygwin64
  when building a 32 bit fio.
- Because it is now possible for no compiler to be set, bail out with an
  explicit error message if we find this is the case.
- Add macOS/Darwin to the platforms that prefer clang as the fallback
  compiler.
- Minor refactoring.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoappveyor: install zlib and minor clean ups
Sitsofe Wheeler [Sat, 23 Sep 2017 12:38:11 +0000 (13:38 +0100)]
appveyor: install zlib and minor clean ups

- Install the appropriate mingw64 version of zlib so fio compile finds
  and uses it.
- Always use Cygwin64. Appveyor always provides a 64 bit environment and
  Cygwin64 comes with a 32 bit cross-compiler and 32 bit versions of
  libraries.
- Reduce the clone depth to 1 since we aren't making use of the git
  history and it can be a touch faster.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoinit: typo in help output
Jens Axboe [Thu, 21 Sep 2017 04:21:35 +0000 (22:21 -0600)]
init: typo in help output

Reported-by: Rebecca Cran <rebecca@bluestop.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd fio_set_directio() error message for platforms without direct I/O
Tomohiro Kusumi [Mon, 18 Sep 2017 18:42:50 +0000 (21:42 +0300)]
add fio_set_directio() error message for platforms without direct I/O

This lets platforms without dio (e.g. OpenBSD) fail with an explicit
message, otherwise they fail without a clue about dio even with
--debug=all enabled.

The message modified based on comments from Jens.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd "invalid block size" to "first direct IO errored." message
Tomohiro Kusumi [Mon, 18 Sep 2017 18:23:54 +0000 (21:23 +0300)]
add "invalid block size" to "first direct IO errored." message

It could fail due to bs not multiple of sector size.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agofix strncpy(3) copy length
Tomohiro Kusumi [Mon, 18 Sep 2017 17:53:50 +0000 (20:53 +0300)]
fix strncpy(3) copy length

0 terminate the last byte, and copy at most size-1.
(or 0 terminate the last byte after copying upto size bytes)

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agolib/memalign: don't malloc size twice
Tomohiro Kusumi [Mon, 18 Sep 2017 17:53:49 +0000 (20:53 +0300)]
lib/memalign: don't malloc size twice

The footer offset (diff between malloc'd address and aligned address)
is (alignment-1) at most, and footer appears `size' bytes after the
aligned address, thus required size is (alignment-1 + size + sizeof(*f)).

The existing code seems to allocate extra unused `size' bytes.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'doc-patches' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 14 Sep 2017 17:37:34 +0000 (11:37 -0600)]
Merge branch 'doc-patches' of https://github.com/vincentkfu/fio

6 years agostat: some bool conversions
Jens Axboe [Thu, 14 Sep 2017 14:54:34 +0000 (08:54 -0600)]
stat: some bool conversions

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoAdd support for doing total latency percentiles
Jens Axboe [Thu, 14 Sep 2017 04:07:31 +0000 (22:07 -0600)]
Add support for doing total latency percentiles

By default, fio does completion latency percentiles. Sometimes
what you want is total IO latency percentiles, including the
submission part as well. If that's your thing, then set

lat_percentiles=1

and get that instead of the default completion latency percentiles.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoinit: fixup_options() cleanup
Jens Axboe [Thu, 14 Sep 2017 03:53:47 +0000 (21:53 -0600)]
init: fixup_options() cleanup

We have o = &td->o, use it everywhere.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agodoc: provide some documentation for the json output format
Vincent Fu [Wed, 30 Aug 2017 19:44:27 +0000 (15:44 -0400)]
doc: provide some documentation for the json output format

Provide basic documentation for the json output format, including unit information for 'runtime' and 'bw' values.

6 years agodoc: provide more detail regarding the --status-interval option
Vincent Fu [Wed, 30 Aug 2017 19:42:52 +0000 (15:42 -0400)]
doc: provide more detail regarding the --status-interval option

There has been some confusion regarding what the --status-interval option provides. Modify the HOWTO and man page to emphasize that --status-interval provides cumulative instead of per-period values.

6 years agotime: use bool for ramp time
Jens Axboe [Wed, 13 Sep 2017 15:07:25 +0000 (09:07 -0600)]
time: use bool for ramp time

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agotime: ensure that offload mode switches parent out of ramp
Jens Axboe [Wed, 13 Sep 2017 15:03:20 +0000 (09:03 -0600)]
time: ensure that offload mode switches parent out of ramp

If we have worker threads submitting IO for the jobs AND using
ramp time, then we need to ensure that the parent job is switched out of
ramp mode. This normally happens as part of IO submission, but since
we have worker threads doing that for us, it never happens for the
parent.

Fixes: https://github.com/axboe/fio/issues/459
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoio_u: fix trimming of mixed block size randommap
Jens Axboe [Tue, 12 Sep 2017 20:02:34 +0000 (14:02 -0600)]
io_u: fix trimming of mixed block size randommap

If you run something ala:

fio --name=test --filename=/dev/sda --rw=randread --size=1M --bs=128k,64k --ioengine=libaio --io_submit_mode=offload

where the you have different block sizes for reads and writes, we can
get into a situation where we have to trim IO size for a read
(128k bs), but we use the general minimum block size, which is 64k
That results in a case where we incorrectly reset the IO size to
0, resulting in an invalid IO.

Fixes: https://github.com/axboe/fio/issues/458
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'solaris-clock-setaffinity' of https://github.com/szaydel/fio
Jens Axboe [Mon, 11 Sep 2017 20:26:01 +0000 (14:26 -0600)]
Merge branch 'solaris-clock-setaffinity' of https://github.com/szaydel/fio

6 years agoFix clock setaffinity failed error which occurs on Solaris and Solaris derivatives...
Sam Zaydel [Mon, 11 Sep 2017 19:48:00 +0000 (12:48 -0700)]
Fix clock setaffinity failed error which occurs on Solaris and Solaris derivatives such as Illumos.

6 years agoMerge branch 'verify_trigger' of https://github.com/sitsofe/fio
Jens Axboe [Mon, 11 Sep 2017 14:29:41 +0000 (08:29 -0600)]
Merge branch 'verify_trigger' of https://github.com/sitsofe/fio

6 years agoMerge branch 'windows_io_hint' of https://github.com/sitsofe/fio
Jens Axboe [Tue, 5 Sep 2017 21:37:36 +0000 (15:37 -0600)]
Merge branch 'windows_io_hint' of https://github.com/sitsofe/fio

6 years agoMerge branch 'travis_32bit' of https://github.com/sitsofe/fio
Jens Axboe [Tue, 5 Sep 2017 14:49:42 +0000 (08:49 -0600)]
Merge branch 'travis_32bit' of https://github.com/sitsofe/fio

6 years agoMerge branch 'gluster_printf' of https://github.com/sitsofe/fio
Jens Axboe [Tue, 5 Sep 2017 14:49:10 +0000 (08:49 -0600)]
Merge branch 'gluster_printf' of https://github.com/sitsofe/fio

6 years agofilesetup: revert O_DIRECT for layout mess
Jens Axboe [Tue, 5 Sep 2017 14:43:28 +0000 (08:43 -0600)]
filesetup: revert O_DIRECT for layout mess

This commit essentially reverts the following fives commits:

d33db728d ("fix regression by 8c43ba62('filesetup: align layout buffer')")
47534cda0 ("filesetup: add non O_DIRECT direct I/O support for initial layout setup")
6c3169f9c ("filesetup: add direct=1 failure warning to layout")
8c43ba625 ("filesetup: align layout buffer")
6e344dc34 ("filesetup: keep OS_O_DIRECT flag when pre-allocating file")

in reverse order, since we keep having issues with the basic idea of
using O_DIRECT for file layout or extensions, if the job file has
asked for O_DIRECT.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agowindowsaio: obey sequential/random I/O hinting
Sitsofe Wheeler [Mon, 4 Sep 2017 06:21:23 +0000 (07:21 +0100)]
windowsaio: obey sequential/random I/O hinting

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoglusterfs: silence printf specifier warnings
Sitsofe Wheeler [Sun, 3 Sep 2017 21:59:30 +0000 (22:59 +0100)]
glusterfs: silence printf specifier warnings

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agotravis: add 32 bit build, minor updates and cleanups
Sitsofe Wheeler [Sun, 3 Sep 2017 09:02:41 +0000 (10:02 +0100)]
travis: add 32 bit build, minor updates and cleanups

- Rejig the Travis file so it does a 32 bit Linux build (albeit on a 64
  bit system). GlusterFS is only installed on 64 bit Linux because the
  32 bit deb tries to pull in psmisc:i386 which conflicts with the
  regular (64 bit) psmisc. The clang 32 bit build works fine but only
  the gcc 32 bit build is done to reduce the number of builds for now.
- Minor reformatting to make it a bit easier to read the shell script
  (but behind the scenes it's still all squashed on to one line).
- Stop apt from installing/upgrading non-essential packages so as to
  reduce build time.
- Make OSX build use a newer Xcode.

6 years agoMerge branch 'shifted_logging' of https://github.com/sitsofe/fio
Jens Axboe [Sat, 2 Sep 2017 23:00:24 +0000 (17:00 -0600)]
Merge branch 'shifted_logging' of https://github.com/sitsofe/fio

6 years agostat: fix shifted windowed logging when using multiple directions
Sitsofe Wheeler [Wed, 30 Aug 2017 19:08:00 +0000 (20:08 +0100)]
stat: fix shifted windowed logging when using multiple directions

When using log_avg_msec and multiple I/O directions, the results
recorded for the directions other than the first are attributed to the
wrong time. This is demonstrated by the following:

sudo modprobe null_blk completion_nsec=100000000 irqmode=2
sudo ./fio --bs=4k --direct=1 --ioengine=libaio --log_avg_msec=1000 \
 --runtime=2s --disable_lat=1 --disable_bw_measurement=1 \
 --filename=/dev/nullb0 --write_iops_log=shiftedlog --rw=rw \
 --name=shiftedlog

results in this:
cat shiftedlog_iops.1.log
1000, 5, 0, 0
2000, 6, 0, 0
2000, 4, 1, 0
2256, 4, 1, 0

shiftedlog_iops.1.log is missing an entry at 1000ms for for the write
direction (1) because the sample has been misattributed to 2000ms (the
third row) due to iolog->avg_last being shared by all directions.

Fix the shifting by turning iolog->avg_last into an array indexed by
direction and only update the windowed stats for the current direction
from add_log_sample().

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

Reported-by: Kris Davis <shimrot@gmail.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agorevert/rework 81647a9a('fix load_ioengine() not to support no "external:" prefix')
Tomohiro Kusumi [Fri, 1 Sep 2017 19:54:12 +0000 (22:54 +0300)]
revert/rework 81647a9a('fix load_ioengine() not to support no "external:" prefix')

We have decided to revert 81647a9a, which disallowed loading an external
ioengine without using (explicitly documented)"external:" prefix.

[PATCH 4/5] fix load_ioengine() not to support no "external:" prefix
http://www.spinics.net/lists/fio/msg06241.html

> The current implementation (i.e. do 2 if 1 failed) happened to have
> been able to load an external ioengine with below syntax without
> "external:" prefix, but this is a bug rather than a feature.

This commit reverts what 81647a9a does, while keeping a commit made
on top of it. See below for details, which is also available in above
mailing list thread. Lines marked with \ are comments by Jens.

--
  >>>>>>> People have already started depending on the "wrong" behaviour e.g.
  >>>>>>> ioengine=libfio_ceph_objectstore.so # must be found in your LD_LIBRARY_PATH
  >>>>>>> from https://github.com/ceph/ceph/blob/master/src/test/fio/ceph-bluestore.fio
  >>>>>>> . Because they're external it's hard to find out just how prevalent
  >>>>>>> this behaviour is.
  >>>>>>
  >>>>>> Then they can add "external:".
  >>>>>> If it has ever been official (in docs/etc), then the program should
  >>>>>> maintain such behavior, like fio keeps kb_base=1024 by default.
  >>>>>>
  >>>>>> This isn't the first time fio broke external ioengines to begin with,
  >>>>>> and fio doesn't guarantee external ioengines.
  >>>>>> e.g. this commit more than a year ago broke ABI.
  >>>>>> 565e784df05c2529479eed8a38701a33b01894bd
  >>>>>>
  >>>>>> It's essentially the same as non mainline'd kernel modules are on
  >>>>>> their own to be uptodate with upstream.
  >>>>>
 \>>>>> No, those two are VERY different. Fio doesn't make any guarantees wrt
 \>>>>> keeping the same ABI (or API, even) for external engines. If they break,
 \>>>>> then you get to keep the pieces and glue them back together. We have
 \>>>>> the engine version number as well to guard against those kinds of
 \>>>>> changes.
 \>>>>>
 \>>>>> But we don't break job files, at least not knowingly, and definitely
 \>>>>> not just in the name of a cleanup.
  >>>>
  >>>> Yes, but you took this patch which breaks job files *wrongly* using
  >>>> external engine option syntax.
  >>>
 \>>> Right, but it's not in a release yet, so it's not impossible to just
 \>>> revert it.
  >>>
  >>>> By "job files wrongly using", I mean job files somehow found
  >>>> unofficial (i.e. undocumented, not intended) way to dlopen it.
  >>>
 \>>> This case is a bit difficult, since it isn't black and white. I took a
 \>>> look at some of the older documentation, and we have been documenting
 \>>> the need for 'external' for a long time (forever?). So I'd be inclined
 \>>> to let this one stay in.
  >>>
  >>>> If breaking this case is not okay, shouldn't this commit be reverted
  >>>> or the design be expand to allow both with/without prefix ?
  >>>
 \>>> The design (or intent, at least) has always been that if you do:
 \>>>
 \>>> ioengine=something
 \>>>
 \>>> then we first try and load 'something' as an internal engine. If that
 \>>> fails, we look for an external engine of that name. That makes sense to
 \>>> me, since it means you don't have to do anything special to load an
 \>>> external engine. I think we should try and retain that behavior, if we
 \>>> can.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agofix regression by 8c43ba62('filesetup: align layout buffer')
Tomohiro Kusumi [Fri, 1 Sep 2017 12:24:23 +0000 (15:24 +0300)]
fix regression by 8c43ba62('filesetup: align layout buffer')

8c43ba62('filesetup: align layout buffer') needs to use the same size
for fio_memalign() and fio_memfree().

If the size `bs' gets decreased while in the write(2) loop, the size
for freeing is smaller than it should be, and results in segfault
by dereferencing ->offset of the footer via irrelevant address somewhere
in user data.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd __load_ioengine() to separate ioengine loading from td context
Tomohiro Kusumi [Thu, 31 Aug 2017 20:13:08 +0000 (23:13 +0300)]
add __load_ioengine() to separate ioengine loading from td context

Add a sub function __load_ioengine(), which only takes name argument,
to be called from load_ioengine(). No functional changes.

This lets fio_show_ioengine_help() get rid of a local variable td
which only existed to call load_ioengine(&td, ...) while this td had
no actual thread context thus unneeded.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agofix load_ioengine() not to support no "external:" prefix
Tomohiro Kusumi [Thu, 31 Aug 2017 20:13:07 +0000 (23:13 +0300)]
fix load_ioengine() not to support no "external:" prefix

To load ioengines, it should be done by either
 1) find the ioengine from the existing (static linked) ioengines or
 2) dlopen the path in case of external ioengine,

but not to do 2 if 1 failed, as fio doesn't expect an ioengine to be
dynamically loaded unless with "external:" prefix by design.

The current implementation (i.e. do 2 if 1 failed) happened to have
been able to load an external ioengine with below syntax without
"external:" prefix, but this is a bug rather than a feature.

(--)ioengine=./engines/skeleton_external.so

The design of the external ioengine option since below commits in 2007
 7b395ca5('Prefix external io engine loading with 'external'')
 8a7bd877('Document loading external io engines')
is to use "external:/path/to/so" syntax.

This commit fixes above bug, which also potentially avoids the case
where "/path/to/so" within the given "external:/path/to/so" happens
to match the existing name, though this is normally unlikely to happen.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agocleanup ioengine_load() (for the next commit)
Tomohiro Kusumi [Thu, 31 Aug 2017 20:13:06 +0000 (23:13 +0300)]
cleanup ioengine_load() (for the next commit)

This commit removes name argument from ioengine_load(), as both
ioengine name and path are self contained in td.
No functional changes.

This makes the next commit's diff more clear by separating non
functional noise.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agofix broken external ioengine option
Tomohiro Kusumi [Thu, 31 Aug 2017 20:13:05 +0000 (23:13 +0300)]
fix broken external ioengine option

get_engine_name() function added to support external ioengine option
via "external:" prefix in below commits in 2007 has been broken.
 7b395ca5('Prefix external io engine loading with 'external'')
 8a7bd877('Document loading external io engines')

It seems to have been broken since below commit in 2011 which made
__handle_option() strip ':' and after while parsing the option.
 c44b1ff5('Add sub-option support (sort-of) and convert libaio_userspace_reap')

Above change made fio dlopen "external" instead of the path located
after "external:", since the path had already been stripped by
__handle_option() by the time get_engine_name() was called. This commit
fixes it by adding ->ioengine_so_path pointer to keep the path while
parsing using sub-option callback.

Note that removing get_engine_name() doesn't affect non "external:"
ioengine options, as the option parser also strips while parsing.

-- before this commit
 # ./fio --name=xxx --ioengine=external:./engines/skeleton_external.so
 fio: engine external not loadable
 fio: failed to load engine external
 fio: file:ioengines.c:91, func=dlopen, error=external: cannot open shared object file: No such file or directory

-- with this commit
 # ./fio --name=xxx --ioengine=external:./engines/skeleton_external.so
 xxx: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=engine_name, iodepth=1
 fio-3.0-32-g68f6f
 Starting 1 process
 xxx: you need to specify size=
 fio: pid=0, err=22/file:filesetup.c:973, func=total_file_size, error=Invalid argument

 Run status group 0 (all jobs):

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoskeleton: add option example
Tomohiro Kusumi [Thu, 31 Aug 2017 20:13:04 +0000 (23:13 +0300)]
skeleton: add option example

Add an example of ioengine specific options, which can/should exist
within each ioengine code. Also fix/add documentation.

Also see e59b9e11('move skip_bad= option to engines/mtd.c').

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agot/axmap: we don't need smalloc/sfree wrappers
Jens Axboe [Thu, 31 Aug 2017 14:34:27 +0000 (08:34 -0600)]
t/axmap: we don't need smalloc/sfree wrappers

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'verify_warn' of https://github.com/sitsofe/fio
Jens Axboe [Thu, 31 Aug 2017 14:21:48 +0000 (08:21 -0600)]
Merge branch 'verify_warn' of https://github.com/sitsofe/fio

6 years agolib/axmap: a few fixes/cleanups
Jens Axboe [Wed, 30 Aug 2017 19:03:26 +0000 (13:03 -0600)]
lib/axmap: a few fixes/cleanups

- If we clear a bit and it's lower than the first free cache,
  update the cache.

- Mark bit_masks[] as const.

- Clean up logic in axmap_first_free()

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'asmfix' of https://github.com/oohal/fio
Jens Axboe [Tue, 29 Aug 2017 21:35:49 +0000 (15:35 -0600)]
Merge branch 'asmfix' of https://github.com/oohal/fio

6 years agochange os_trim() prototype not to use int fd
Tomohiro Kusumi [Tue, 29 Aug 2017 21:12:16 +0000 (00:12 +0300)]
change os_trim() prototype not to use int fd

This is the same as the previous commit. The offset and length are
universal regardless of platforms, but int fd is not, thus it should
take struct fio_file*.

In fact, other fd related functions under os/ don't take int fd for
portability even if some of them work fine with int fd at the moment.

(OS headers basically (should)have no dependencies on fio functions
and structures, but struct fio_file is the only exception.)

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agochange fio_set_odirect() prototype not to use int fd
Tomohiro Kusumi [Tue, 29 Aug 2017 21:12:15 +0000 (00:12 +0300)]
change fio_set_odirect() prototype not to use int fd

This function should take struct fio_file*, since the idea of integer
fd in unix likes isn't necessarily usable on other platforms (Windows).

In fact, other fd related functions under os/ don't take int fd for
portability even if some of them work fine with int fd at the moment.

(OS headers basically (should)have no dependencies on fio functions
and structures, but struct fio_file is the only exception.)

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agofilesetup: add non O_DIRECT direct I/O support for initial layout setup
Tomohiro Kusumi [Tue, 29 Aug 2017 21:12:14 +0000 (00:12 +0300)]
filesetup: add non O_DIRECT direct I/O support for initial layout setup

8c43ba62('filesetup: align layout buffer') and
6e344dc3('filesetup: keep OS_O_DIRECT flag when pre-allocating file')
only consider OS with open(O_DIRECT).

This commit adds fio_set_directio() since now OS specific direct I/O
initialization is needed by both real ->fd and temporary ->fd while in
extend_file() to equally support the feature.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoadd ifdef __sun__ for Solaris specific code
Tomohiro Kusumi [Tue, 29 Aug 2017 21:12:13 +0000 (00:12 +0300)]
add ifdef __sun__ for Solaris specific code

ENOTTY on direct I/O setup failure via directio(3C) is Solaris (ZFS)
specific (as also mentioned in ZoL commit[1]).

Linux and many others which support O_DIRECT never come here, but
others supporting direct I/O via OS specific way don't necessarily
have the same ENOTTY behavior or ZFS itself.

This commit brings back the original log before 42f1ee68 for others.

[1] https://github.com/zfsonlinux/zfs/commit/a08c76a8ad63c28384ead72b53a3d7ef73f39357

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoHOWTO: add OpenBSD to direct I/O unsupported platform
Tomohiro Kusumi [Tue, 29 Aug 2017 21:12:12 +0000 (00:12 +0300)]
HOWTO: add OpenBSD to direct I/O unsupported platform

OpenBSD has neither open(O_DIRECT) nor its kernel specific way.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agocleanup NetBSD/OpenBSD header
Tomohiro Kusumi [Tue, 29 Aug 2017 21:12:11 +0000 (00:12 +0300)]
cleanup NetBSD/OpenBSD header

* NetBSD's <sys/rb.h> was renamed to <sys/rbtree.h> 7 years ago.
* Drop unneeded undefs.

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoarch/ppc: Fix get_cpu_clock asm clobber list
Oliver O'Halloran [Thu, 6 Jul 2017 08:47:10 +0000 (18:47 +1000)]
arch/ppc: Fix get_cpu_clock asm clobber list

Mark condition register 0 (cr0) as being clobbered by the inline asm in
get_cpu_clock(). Not doing this results in strange behaviour due to GCC
optimising away some checking. For example e.g:

  $ ./fio examples/null.fio --output-format=json
  time     5500  cycles_start=8085227422910      <--- bad!
  {
    "fio version" : "fio-2.21-89-gb034",
    <snip>

The extra output is due to the flag checking in dprint being removed
at higher optimisation levels.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
6 years agoMerge branch 'direct_layout_fix' of https://github.com/sitsofe/fio
Jens Axboe [Mon, 28 Aug 2017 15:57:30 +0000 (09:57 -0600)]
Merge branch 'direct_layout_fix' of https://github.com/sitsofe/fio

6 years agofilesetup: add direct=1 failure warning to layout
Sitsofe Wheeler [Mon, 21 Aug 2017 21:15:00 +0000 (22:15 +0100)]
filesetup: add direct=1 failure warning to layout

Add warning about the filesystem not liking direct=1/buffered=0 to
initial layout code.

v2:
- Update warning to include /buffered=0 so it matches other EINVAL
  warnings
- Minor commit message update

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agofilesetup: align layout buffer
Sitsofe Wheeler [Mon, 21 Aug 2017 21:15:00 +0000 (22:15 +0100)]
filesetup: align layout buffer

Since commit 6e344dc3445bfec0583072e82bea728ab8d54d58 ("filesetup: keep
OS_O_DIRECT flag when pre-allocating file") when direct=1 fio will set
the OS_O_DIRECT flag during file layout. Unfortunately this makes the
following job fail with due to an "Invalid argument" on Linux:

$ rm -f fiodirect.tmp; ./fio --direct=1 --bs=4k --filename=fiodirect.tmp \
 --size=16k --name=directtest
directtest: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.0-9-gb427
Starting 1 process
directtest: Laying out IO file (1 file / 0MiB)
fio: pid=35410, err=22/file:filesetup.c:227, func=write, error=Invalid argument

(where fiodirect.tmp is on a filesystem that supports O_DIRECT such as
ext4 and the job used to succeed)

The open(2) man page for Linux says:

"Under Linux 2.4, transfer sizes, and the alignment of the user buffer
and the file offset must all be multiples of the logical block size of
the filesystem.  Since Linux 2.6.0, alignment to the logical block size
of the underlying storage (typically 512 bytes) suffices."

The above is cryptic but suggests that on Linux 2.6 and above kernels
the transfer size, the *memory alignment of the user buffer* and the
file offset must all be multiples of the underlying logical block size
when using O_DIRECT.

This commit forces the memory of fio's layout I/O buffer to be aligned
to the system's page size in an attempt to meet the memory alignment
requirement. Altough approximate, this should handle all but the most
unusual setups for the near future and matches what init_io_u() does in
backend.c.

v2:
- Align buffer pointer to page size rather than maximum block size
- Update commit message, include example

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

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoengines/windowsaio: kill useless forward declarations
Jens Axboe [Sun, 27 Aug 2017 21:21:26 +0000 (15:21 -0600)]
engines/windowsaio: kill useless forward declarations

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 years agoMerge branch 'doc_runtime' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 27 Aug 2017 16:04:28 +0000 (10:04 -0600)]
Merge branch 'doc_runtime' of https://github.com/sitsofe/fio

6 years agoMerge branch 'fixes' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 27 Aug 2017 16:03:38 +0000 (10:03 -0600)]
Merge branch 'fixes' of https://github.com/sitsofe/fio

6 years agobackend: verify-trigger fixes
Sitsofe Wheeler [Sat, 26 Aug 2017 07:38:11 +0000 (08:38 +0100)]
backend: verify-trigger fixes

Clear the trigger_timeout after we have found it has been exceeded in
trigger_timedout() to stop us repeatedly firing the trigger again and
again in the future.

When --trigger-remote is unset, the server winds up with the remote
trigger command represented by buf[] being zero length rather than buf
being NULL in handle_trigger_cmd(). Cope with this by returning right
away if we find the cmd string is NULL or empty in exec_trigger().

Make server mode fio terminate after sending the verify state back to
the client so it goes on behave the same way as standalone fio. This
stops the while loop in thread_main() restating and in turn prevents
state being cleared away by clear_io_state().

Make keep_running() return false if td->terminate has been set Just In
Case.

The below would trigger the above problem before this patch:

cat <<EOF > trigger.fio
[global]
ioengine=null
time_based=1
runtime=10s
size=1M
bs=4k
rate=4k

[trigtest]
EOF
./fio --server &
./fio --trigger-timeout=2s --trigger='hostname' --client=localhost \
 --debug=net trigger.fio

Fixes https://github.com/axboe/fio/issues/431 ("fio intermittently fails
to perform IO when --trigger-timeout, --trigger is specified").

Reported-by: saurabhbpl <saurabh.shiva@gmail.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoMerge branch 'stat_base_overflow' of https://github.com/football1222/fio
Jens Axboe [Wed, 23 Aug 2017 14:34:37 +0000 (08:34 -0600)]
Merge branch 'stat_base_overflow' of https://github.com/football1222/fio

6 years agostat: increase the size of base to avoid overflow
Richard Liu [Wed, 23 Aug 2017 10:49:58 +0000 (18:49 +0800)]
stat: increase the size of base to avoid overflow

plat_idx_to_val() in stat.c has a variable base that is defined as an
unsigned int but it was designed to fit old settings where
FIO_IO_U_PLAT_GROUP_NR = 19.
With the alteration from usec to nsec in commit
d6bb626ef37d3905221ade2887b422717a07af09(nanosecond: update completion
latency recording and normal, json output to use nanoseconds)
FIO_IO_U_PLAT_GROUP_NR is now 29 and the range of latency changed from
uint32_t to uint64_t. This means in plat_idx_to_val(), variable base
can easily exceed a 32-bit range and overflow after error_bits reaches 26.

Eg.
Group MSB #discarded range of #buckets
error_bits value
27 32 26 [42949672968589934591]     64
base = 1 << (error_bits + FIO_IO_U_PLAT_BITS);
(1 << 32) will overflow
if change to:
base = ((unsigned long long) 1) << (error_bits + FIO_IO_U_PLAT_BITS);
base itself will still overflow
so base should be unsigned long long

6 years agoMerge branch 'timespec_add_msec_overflow' of https://github.com/sitsofe/fio
Jens Axboe [Tue, 22 Aug 2017 16:32:18 +0000 (10:32 -0600)]
Merge branch 'timespec_add_msec_overflow' of https://github.com/sitsofe/fio

6 years agotime: fix overflow in timespec_add_msec
Sitsofe Wheeler [Tue, 22 Aug 2017 05:19:29 +0000 (06:19 +0100)]
time: fix overflow in timespec_add_msec

Commit 8b6a404cdd2c40715885e562416c3db039912773 ("nanosecond: initial
commit changing timeval to timespec") introduced a change to
timespec_add_msec that decreased the time to (unsigned) overflow of
adj_nsec leading to strange values in the write_*_log files when using
log_avg_msec. The following fio job reproduces the problem:

./fio --ioengine=null --size=2G --time_based --runtime=11s \
 --ramp_time=5s --write_iops_log=overflow --log_avg_msec=5000 \
 --name=overflow

cat overflow_iops.1.log shows the following:
5000, 997853, 0, 0
10640, 141323, 0, 0

Compiling fio with clang's undefined behaviour
sanitizer with unsigned wraparound detection turned on by using

CC=clang ./configure --extra-cflags="-fsanitize=undefined,integer"

and running the previous job produces a lot of false positives but also
flags up this:

time.c:11:35: runtime error: unsigned integer overflow: 1000000 * 5000 cannot be represented in type 'unsigned int'

Fix this by forcing the type of the integer literal to ensure that a 64
bit multiplication takes place. Further, force the result variables to
be uint64_t allowing us to remove UL from other literals. Finally adjust
some spacing while we're here.

Fixes https://github.com/axboe/fio/issues/426 (which was also reported
on the mailing list - http://www.spinics.net/lists/fio/msg06190.html ).

Reported-by: Joseph R Gruher <joseph.r.gruher@intel.com>
Suggested-by: Vincent Fu <vincent.fu@wdc.com>
Suggested-by: Jeff Furlong <jeff.furlong@wdc.com>
Reviewed-by: Vincent Fu <vincent.fu@wdc.com>
Tested-by: Joseph R Gruher <joseph.r.gruher@intel.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoREADME: update/add mintty issue links
Sitsofe Wheeler [Fri, 18 Aug 2017 21:07:15 +0000 (22:07 +0100)]
README: update/add mintty issue links

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agoconfigure: clean up libverbs configure test
Sitsofe Wheeler [Thu, 17 Aug 2017 21:45:03 +0000 (22:45 +0100)]
configure: clean up libverbs configure test

Compiling the libverbs configure test generated warnings which would
cause libverbs to be detected as unavailable when using -Werror. Fix
this by changing an include to infiniband/verbs.h and eliminate the
unused stdio.h include while we're here.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agofio: implement 64 bit network/big endian byte swapping macros
Sitsofe Wheeler [Thu, 17 Aug 2017 06:37:01 +0000 (07:37 +0100)]
fio: implement 64 bit network/big endian byte swapping macros

Add cpu_to_be64/be64_to_cpu and make the RDMA ioengine use them so it no
longer needs to include infiniband/arch.h (which generates obsolete
warnings at compile time) or ntohll (which generates deprecation
warnings at compile time).

Tested-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
6 years agodoc: remove '--runtime' command line option
Sitsofe Wheeler [Sun, 13 Aug 2017 07:06:15 +0000 (08:06 +0100)]
doc: remove '--runtime' command line option

Commit 5bba8b3acee1bf1359470a82cac030942018405a ("Remove '--runtime'
command line option") removed the --runtime option from the fio tool and
its internal help. This commit removes it from the documentation files
too.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>