fio.git
4 weeks agoVerify the absence of holes in struct jobs_eta at compile time
Bart Van Assche [Wed, 14 Aug 2019 20:10:10 +0000 (13:10 -0700)]
Verify the absence of holes in struct jobs_eta at compile time

This patch verifies the correctness of the previous patch.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agoRefine packed annotations in stat.h
Bart Van Assche [Wed, 14 Aug 2019 20:10:09 +0000 (13:10 -0700)]
Refine packed annotations in stat.h

Instead of declaring the whole structure packed, only declare non-aligned
members packed. This patch is an alternative way to fix the following gcc 9
compiler warnings:

eta.c: In function 'calc_thread_status':
eta.c:510:7: error: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  510 |     je->rate);
      |     ~~^~~~~~
eta.c:522:66: error: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  522 |  calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je->rate);
      |                                                                ~~^~~~~~
eta.c:523:64: error: taking address of packed member of 'struct jobs_eta' may result in an unaligned pointer value [-Werror=address-of-packed-member]
  523 |  calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je->iops);
      |

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agoOptimize the code that copies strings
Bart Van Assche [Wed, 14 Aug 2019 20:10:08 +0000 (13:10 -0700)]
Optimize the code that copies strings

Using strncpy() to copy strings is suboptimal because strncpy writes a
bunch of additional unnecessary null bytes. Use snprintf() instead of
strncpy(). An additional advantage of snprintf() is that it guarantees
that the output string is '\0'-terminated.

This patch is an improvement for commit 32e31c8c5f7b ("Fix string copy
compilation warnings").

Cc: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agozbd: Improve robustness of unit tests
Bart Van Assche [Wed, 14 Aug 2019 20:10:07 +0000 (13:10 -0700)]
zbd: Improve robustness of unit tests

Give up if creation of the null_blk instance fails.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 weeks agozbd: Declare local functions 'static'
Bart Van Assche [Wed, 14 Aug 2019 20:10:06 +0000 (13:10 -0700)]
zbd: Declare local functions 'static'

This patch fixes two sparse warnings.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 weeks agot/zbd: Fix I/O bytes rounding errors
Shin'ichiro Kawasaki [Fri, 9 Aug 2019 03:28:36 +0000 (12:28 +0900)]
t/zbd: Fix I/O bytes rounding errors

When fio reports write bytes or read bytes, it rounds the number with
units MiB or KiB to fit the number within limited number of digits.
This results in rounding errors of the reported bytes and sometimes
causes test failures for test case #17 in test-zbd-support
which reports incorrect total I/O bytes in case both of write bytes
and read bytes are rounded up.

To avoid the rounding error, increase the number of digits from default
value 4 to 10 to keep precision. For example, a number "256MiB" will be
reported as "267911168B" with this change.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agoAdd tests from t/ to the Windows installer
Rebecca Cran [Mon, 5 Aug 2019 20:11:00 +0000 (13:11 -0700)]
Add tests from t/ to the Windows installer

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agonbd: Remove copy and paste error in example
Richard W.M. Jones [Sat, 3 Aug 2019 15:51:06 +0000 (16:51 +0100)]
nbd: Remove copy and paste error in example

Fixes a copy and paste error introduced in commit d643a1e29d
("engines: Add Network Block Device (NBD) support using libnbd.").

Thanks: Sitsofe Wheeler

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agoengines/splice: remove buggy ->mem_align set
Jens Axboe [Sat, 3 Aug 2019 14:33:24 +0000 (08:33 -0600)]
engines/splice: remove buggy ->mem_align set

Two things wrong here:

1) We align buffers by default, so no need for splice to do anything
   extra.
2) ->mem_align is not a true/false setting, it's the alignment itself.
   Hence the current setting to 1 is just buggy.

Fixes: https://github.com/axboe/fio/issues/810
Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agonbd: Document the NBD-specific uri parameter
Richard W.M. Jones [Fri, 2 Aug 2019 17:03:52 +0000 (18:03 +0100)]
nbd: Document the NBD-specific uri parameter

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agoparse: bump max value pairs supported from 24 to 32
Jens Axboe [Fri, 2 Aug 2019 16:53:22 +0000 (10:53 -0600)]
parse: bump max value pairs supported from 24 to 32

The recent addition of the nbd engine overflowed what we support.

Fixes: d643a1e29d31 ("engines: Add Network Block Device (NBD) support using libnbd")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agoengines: Add Network Block Device (NBD) support using libnbd.
Richard W.M. Jones [Fri, 2 Aug 2019 16:11:25 +0000 (17:11 +0100)]
engines: Add Network Block Device (NBD) support using libnbd.

This commit adds a new engine for testing Network Block Devices
directly.  It requires libnbd (https://github.com/libguestfs/libnbd).

To see how to test nbdkit or qemu-nbd read examples/nbd.fio.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agosmalloc: cleanup firstfree()
Jens Axboe [Wed, 31 Jul 2019 21:27:27 +0000 (15:27 -0600)]
smalloc: cleanup firstfree()

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agosmalloc: fix compiler warning on Windows
Vincent Fu [Wed, 31 Jul 2019 20:57:51 +0000 (16:57 -0400)]
smalloc: fix compiler warning on Windows

firstfree() triggers a warning from the Windows compiler used by
AppVeyor because it doesn't return a value if the for loop iterates to
completion. This patch resolves the compiler warning.

AppVeyor Windows build log: https://ci.appveyor.com/project/axboe/fio/builds/26381726

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agoRemove unused fio_assert()
Jens Axboe [Wed, 31 Jul 2019 21:15:50 +0000 (15:15 -0600)]
Remove unused fio_assert()

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 weeks agoMerge branch 'smalloc-gc' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 31 Jul 2019 19:58:44 +0000 (13:58 -0600)]
Merge branch 'smalloc-gc' of https://github.com/vincentkfu/fio

* 'smalloc-gc' of https://github.com/vincentkfu/fio:
  smalloc: fix garbage collection problem
  t/stest: make the test more challenging
  smalloc: print debug info on oom error

6 weeks agosmalloc: fix garbage collection problem
Vincent Fu [Tue, 30 Jul 2019 15:00:56 +0000 (09:00 -0600)]
smalloc: fix garbage collection problem

If a large request arrives when pool->next_non_full points to empty
space that is insufficient to satisfy the request, pool->next_non_full
will be inappropriately advanced when the free space is followed by
lines of fully allocated space. The free space originally pointed to by
pool->next_non_full will be unavailable unless a subsequent sfree() call
frees allocated space above it. Resolve this issue by advancing
pool->next_non_full only outside the search loop and only when it points
to fully allocated space.

6 weeks agot/stest: make the test more challenging
Vincent Fu [Fri, 26 Jul 2019 17:33:52 +0000 (11:33 -0600)]
t/stest: make the test more challenging

Add large smalloc requests to the sfree phase of the test. This exposes
a smalloc garbage collection issue.

6 weeks agosmalloc: print debug info on oom error
Vincent Fu [Tue, 30 Jul 2019 16:07:26 +0000 (12:07 -0400)]
smalloc: print debug info on oom error

Provide more details about the request and the state of the memory pools
when smalloc encounters an oom situation.

6 weeks agoMerge branch 'dev' of https://github.com/smartxworks/fio
Jens Axboe [Wed, 31 Jul 2019 16:55:51 +0000 (10:55 -0600)]
Merge branch 'dev' of https://github.com/smartxworks/fio

* 'dev' of https://github.com/smartxworks/fio:
  libiscsi: continue working when meets EINTR or EAGAIN

6 weeks agoMerge branch 'gnuplot-tabs' of https://github.com/kapsh/fio
Jens Axboe [Wed, 31 Jul 2019 16:54:43 +0000 (10:54 -0600)]
Merge branch 'gnuplot-tabs' of https://github.com/kapsh/fio

* 'gnuplot-tabs' of https://github.com/kapsh/fio:
  fio2gnuplot: fix TabErrors when running with Python 3

6 weeks agobssplit: Fix handling of 0 percentage
Damien Le Moal [Wed, 31 Jul 2019 04:32:07 +0000 (13:32 +0900)]
bssplit: Fix handling of 0 percentage

If a block size percentage is ispecified as 0 in bssplit, the block size
defined is not ignored by the loop in get_next_buflen(). In particular,
if the first (smallest) block size specified has a 0 percentage, the
loop is existed and that block size used as the next IO size, resulting
in a behavior equivalent to specifying 100%. E.g. using
--bssplit=64k/0,1024k/100 results in 100% of issued IOs to be 64KB
instead of 1MB.

Fix this by ignoring bssplit entries that have a 0 percentage. This is
safe as the initialization of the bssplit array ensure that the sum of
all percentages is always 100, guaranteeing that a block size will be
chosen for the next IO size.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 weeks agofio2gnuplot: fix TabErrors when running with Python 3
Alexander Kapshuna [Sat, 27 Jul 2019 15:45:32 +0000 (18:45 +0300)]
fio2gnuplot: fix TabErrors when running with Python 3

Closes #804

Signed-off-by: Alexander Kapshuna <kapsh@kap.sh>
7 weeks agoDocument io_uring feature
Jens Axboe [Fri, 26 Jul 2019 15:53:43 +0000 (09:53 -0600)]
Document io_uring feature

This was released with Linux 5.1, so we can document it now as the
API won't change.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 weeks agoengines/libaio: remove remnants of abandoned aio features
Jens Axboe [Fri, 26 Jul 2019 15:41:06 +0000 (09:41 -0600)]
engines/libaio: remove remnants of abandoned aio features

Before we had io_uring, aio grew support for polled IO and setup
through a new system call. As this never made it into Linux and
was abandoned in favor of io_uring, kill it off.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 weeks agolibiscsi: continue working when meets EINTR or EAGAIN
Kyle Zhang [Fri, 19 Jul 2019 07:50:01 +0000 (15:50 +0800)]
libiscsi: continue working when meets EINTR or EAGAIN

When poll meets EINTR or EAGAIN, it should continue working rather
than return error.

Signed-off-by: Kyle Zhang <kyle@smartx.com>
2 months agoMerge branch 'dev' of https://github.com/smartxworks/fio
Jens Axboe [Fri, 12 Jul 2019 16:44:45 +0000 (10:44 -0600)]
Merge branch 'dev' of https://github.com/smartxworks/fio

* 'dev' of https://github.com/smartxworks/fio:
  libiscsi: log reason of error when readcapacity failed

2 months agoFio 3.15 fio-3.15
Jens Axboe [Fri, 12 Jul 2019 16:40:36 +0000 (10:40 -0600)]
Fio 3.15

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agolibiscsi: log reason of error when readcapacity failed
Kyle Zhang [Fri, 12 Jul 2019 14:39:56 +0000 (22:39 +0800)]
libiscsi: log reason of error when readcapacity failed

Signed-off-by: Kyle Zhang <kyle@smartx.com>
2 months agoengines/http: set FIO_SYNCIO flag
Vincent Fu [Tue, 9 Jul 2019 14:54:40 +0000 (10:54 -0400)]
engines/http: set FIO_SYNCIO flag

This ioengine carries out synchronous operations. So the FIO_SYNCIO flag
needs to be set in order for latencies to be calculated correctly.

Fixes: https://github.com/axboe/fio/issues/797
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agofio: fix aio trim completion latencies
Vincent Fu [Mon, 8 Jul 2019 19:23:54 +0000 (15:23 -0400)]
fio: fix aio trim completion latencies

The io_uring, libaio, and posixaio ioengines actually carry out
synchronous trim operations, but latency timestamps are recorded as if
the trims were issued asynchronously. This patch fixes how timestamps
are recorded for trim operations issued by these ioengines.

Fixes: https://github.com/axboe/fio/issues/764
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoMerge branch 'optlenmax' of https://github.com/powernap/fio
Jens Axboe [Mon, 1 Jul 2019 20:26:29 +0000 (14:26 -0600)]
Merge branch 'optlenmax' of https://github.com/powernap/fio

* 'optlenmax' of https://github.com/powernap/fio:
  Increase maximum length of line in jobs file to 8192

2 months agoIncrease maximum length of line in jobs file to 8192
Nick Principe [Mon, 1 Jul 2019 19:45:21 +0000 (15:45 -0400)]
Increase maximum length of line in jobs file to 8192

Increase OPT_LEN_MAX to 8192, use OPT_LEN_MAX for string in
__parse_jobs_ini(), and document line length limit for job files in man
page.

Signed-off-by: Nick Principe nick@princi.pe
2 months agoengines/rbd: hide rbd_io_u_seen() if not used
Jens Axboe [Mon, 1 Jul 2019 20:09:23 +0000 (14:09 -0600)]
engines/rbd: hide rbd_io_u_seen() if not used

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoeta: Fix compiler warning
Damien Le Moal [Tue, 4 Jun 2019 07:07:32 +0000 (16:07 +0900)]
eta: Fix compiler warning

gcc 9 complains about directly referencing pointer values in the packed
structure jobs_eta. E.g.:

warning: taking address of packed member of ‘struct jobs_eta’ may
result in an unaligned pointer value [-Waddress-of-packed-member]

Remove this by using a local void pointer for the rate and iops array
references that generate the warning.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoFix string copy compilation warnings
Damien Le Moal [Tue, 4 Jun 2019 07:07:31 +0000 (16:07 +0900)]
Fix string copy compilation warnings

Fix the many warnings that gcc 9 spits out.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoMerge branch 'wip-tcmalloc' of https://github.com/dillaman/fio
Jens Axboe [Fri, 31 May 2019 21:37:18 +0000 (15:37 -0600)]
Merge branch 'wip-tcmalloc' of https://github.com/dillaman/fio

* 'wip-tcmalloc' of https://github.com/dillaman/fio:
  configure: attempt to link against tcmalloc by default if available

3 months agoconfigure: attempt to link against tcmalloc by default if available
Jason Dillaman [Fri, 31 May 2019 20:50:33 +0000 (16:50 -0400)]
configure: attempt to link against tcmalloc by default if available

librbd will run up to 20% faster under small IO workloads when fio is linked
against tcmalloc. By automatically linking against tcmalloc, it avoids
the need to use LD_PRELOAD to pull in a faster memory management toolset.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
3 months agoconfigure: check for gtk version using pkg-config
Helmut Grohne [Mon, 27 May 2019 19:32:57 +0000 (21:32 +0200)]
configure: check for gtk version using pkg-config

The previous way of running a program was incompatible with cross
compilation. The program is still being compiled as a sanity check, but
no longer run.

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoconfigure: apply ${cross_prefix} to pkg-config calls
Helmut Grohne [Mon, 27 May 2019 19:32:49 +0000 (21:32 +0200)]
configure: apply ${cross_prefix} to pkg-config calls

Otherwise, we're searching for build architecture libraries which is not
what we want.

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoglusterfs: update for new API
Jens Axboe [Thu, 23 May 2019 20:57:03 +0000 (14:57 -0600)]
glusterfs: update for new API

Apparently glusterfs just changes their API as they see fit. Add
a configure check for the newer version, which adds pre/post stat
variables in a few random spots.

This should fix compilation with v6.0 of the API.

Fixes: https://github.com/axboe/fio/issues/781
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoconfigure: add gettid() test
Jens Axboe [Wed, 22 May 2019 23:12:55 +0000 (17:12 -0600)]
configure: add gettid() test

Apparently some newer glibcs now have it, decades after the
fact.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoFio 3.14 fio-3.14
Jens Axboe [Wed, 22 May 2019 19:41:41 +0000 (13:41 -0600)]
Fio 3.14

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoio_uring: sync with liburing/kernel
Jens Axboe [Mon, 20 May 2019 14:49:49 +0000 (08:49 -0600)]
io_uring: sync with liburing/kernel

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agostat: remove terse v2 blank lines with description not set
Vincent Fu [Wed, 15 May 2019 20:05:03 +0000 (16:05 -0400)]
stat: remove terse v2 blank lines with description not set

The documentation says that the job description will appear on a second
line if this is set. If it is not set there will be an empty line.
Eliminate the empty line when the description is not set.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agodocs: improve terse output format documentation
Vincent Fu [Wed, 15 May 2019 20:05:02 +0000 (16:05 -0400)]
docs: improve terse output format documentation

Fix up some details and note client/server mode differences.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoclient: add a newline after terse disk util
Vincent Fu [Wed, 15 May 2019 20:05:01 +0000 (16:05 -0400)]
client: add a newline after terse disk util

In client/server mode terse disk utilization output appears at the end
of each blob of terse output. We need a newline so that the next blob of
terse output starts at the beginning of a line.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoclient: handle disk util for all output formats
Vincent Fu [Wed, 15 May 2019 20:05:00 +0000 (16:05 -0400)]
client: handle disk util for all output formats

Since fio allows multiple output formats, it should process the disk
utilization data for each output format that was requested by the user
when it is run in client/server mode.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoclient: do not print disk utilization for terse v2
Vincent Fu [Wed, 15 May 2019 20:04:59 +0000 (16:04 -0400)]
client: do not print disk utilization for terse v2

terse version 2 omits disk utilization data when fio is run locally.
Make this behavior the same when fio is run in client/server mode.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agot/io_uring: improve EOPNOTSUPP message
Jens Axboe [Thu, 9 May 2019 15:56:29 +0000 (09:56 -0600)]
t/io_uring: improve EOPNOTSUPP message

Put in one line and include kernel as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agot/io_uring: clarify polled support is fs + device
Jens Axboe [Wed, 8 May 2019 17:56:05 +0000 (11:56 -0600)]
t/io_uring: clarify polled support is fs + device

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoUpdate CFLAGS and LDFLAGS for FreeBSD builds
Rebecca Cran [Mon, 6 May 2019 22:12:41 +0000 (16:12 -0600)]
Update CFLAGS and LDFLAGS for FreeBSD builds

FreeBSD installs third-party headers into /usr/local/include
and libraries into /usr/local/lib.
Update CFLAGS and LDFLAGS to look there.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoMerge branch 'fix-infinite-loop-of-io_uring' of https://github.com/satoru-takeuchi/fio
Jens Axboe [Mon, 6 May 2019 16:24:24 +0000 (10:24 -0600)]
Merge branch 'fix-infinite-loop-of-io_uring' of https://github.com/satoru-takeuchi/fio

* 'fix-infinite-loop-of-io_uring' of https://github.com/satoru-takeuchi/fio:
  io_uring: fix possible infinite loop

4 months agoio_uring: fix possible infinite loop
Satoru Takeuchi [Sun, 5 May 2019 23:56:36 +0000 (08:56 +0900)]
io_uring: fix possible infinite loop

When reaping some completed I/O before io_uring_enter(), it waits forever.

Signed-off-by: Satoru Takeuchi <sat@cybozu.co.jp>
4 months agoio_uring: remove cachehit information
Jens Axboe [Thu, 25 Apr 2019 19:27:54 +0000 (13:27 -0600)]
io_uring: remove cachehit information

This patch never made it into the upstream kernel, remove knowledge
of it from fio.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoFix __FIO_OPT_G_ISCSI numbering
Jens Axboe [Thu, 25 Apr 2019 16:09:27 +0000 (10:09 -0600)]
Fix __FIO_OPT_G_ISCSI numbering

__FIO_OPT_G_NR must always be last, if it isn't then it doesn't
denote the last used bit.

Fixes: 247ef2aaf28a ("fio: add libiscsi engine")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agozbd random read conventional zones
Phillip Chen [Wed, 24 Apr 2019 21:47:41 +0000 (15:47 -0600)]
zbd random read conventional zones

Initialize conventional zone write pointers to full so
zbd_find_zone will accept conventional zones when searching
around a randomly chosen empty zone.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Phillip Chen <phillip.a.chen@seagate.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agoMerge branch 'libiscsi' of https://github.com/smartxworks/fio
Jens Axboe [Mon, 22 Apr 2019 14:38:55 +0000 (08:38 -0600)]
Merge branch 'libiscsi' of https://github.com/smartxworks/fio

* 'libiscsi' of https://github.com/smartxworks/fio:
  fio: add libiscsi engine
  filesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO

4 months agofio: add libiscsi engine
Kyle Zhang [Wed, 10 Apr 2019 11:37:41 +0000 (19:37 +0800)]
fio: add libiscsi engine

Adding a new engine that access iscsi lun with libiscsi.

You could find example fio configuration in examples/libiscsi.fio .

Signed-off-by: Kyle Zhang <kyle@smartx.com>
4 months agofilesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO
Kyle Zhang [Thu, 11 Apr 2019 15:01:55 +0000 (23:01 +0800)]
filesetup: don't call create_work_dirs() for ioengine with FIO_DISKLESSIO

Don't create work dirs if ioengine has flag FIO_DISKLESSIO. So that
filename can contains '/'. It is useful when ioengine is based on
network and filename is used as url.

Also call create_work_dirs() just when setting up a file. So that
ioengine is loaded and ioengine flags are available.

Signed-off-by: Kyle Zhang <kyle@smartx.com>
4 months agozbd: Fix zone report handling
Damien Le Moal [Fri, 19 Apr 2019 03:40:49 +0000 (12:40 +0900)]
zbd: Fix zone report handling

fio may be executed concurrently with a block device revalidation by
the kernel. Device revalidation may lead to the block device capacity
to be changed to a smaller value (device changed) or to even 0 in case
of revalidation failure. In such case, the BLKREPORTZONE ioctl
executed from read_zone_info() may report a success with an empty zone
report when the start sector for the report is above the new capacity
of the device. This leads to an infinite loop inside parse_zone_info()
and the fio run never terminating.

Fix this problem by returning -EIO from read_zone_info() thus
avoiding the infinite loop in parse_zone_info(). This change does not
affect the normal case with a stable device as read_zone_info() is
always called with a valid start sector that does not result in an
empty zone report.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agofio: Add advise THP option to mmap engine
Keith Busch [Thu, 18 Apr 2019 16:25:56 +0000 (10:25 -0600)]
fio: Add advise THP option to mmap engine

The Linux specific transparent hugepage memory advisory has potentially
significant implications for how the memory management behaves. If the
platform supports it, add a new mmap ioengine specific option that advises
HUGEPAGE on an mmap'ed range. The option availability is detected during
configure. If the option is set, fio can test THP when used with private
anonymous memory (i.e. mmap /dev/zero).

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 months agoMerge branch 'master' of https://github.com/mingnus/fio
Jens Axboe [Wed, 17 Apr 2019 12:50:25 +0000 (06:50 -0600)]
Merge branch 'master' of https://github.com/mingnus/fio

* 'master' of https://github.com/mingnus/fio:
  rand: fix truncated rand_seed on Windows

5 months agorand: fix truncated rand_seed on Windows
Ming-Hung Tsai [Wed, 17 Apr 2019 04:25:10 +0000 (12:25 +0800)]
rand: fix truncated rand_seed on Windows

The long data type is 32-bit on LLP64 platforms

5 months agoMerge branch 'patch-1' of https://github.com/neheb/fio
Jens Axboe [Mon, 1 Apr 2019 12:57:22 +0000 (06:57 -0600)]
Merge branch 'patch-1' of https://github.com/neheb/fio

* 'patch-1' of https://github.com/neheb/fio:
  arch: fix build breakage on armv6 again

5 months agoarch: fix build breakage on armv6 again
Rosen Penev [Mon, 1 Apr 2019 04:19:03 +0000 (21:19 -0700)]
arch: fix build breakage on armv6 again

6K was missing from the defines.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
5 months agostat: eliminate unneeded curly braces
Vincent Fu [Mon, 25 Mar 2019 14:20:28 +0000 (10:20 -0400)]
stat: eliminate unneeded curly braces

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 months agoclient: put All clients section at end of normal output
Vincent Fu [Mon, 25 Mar 2019 14:20:27 +0000 (10:20 -0400)]
client: put All clients section at end of normal output

When fio runs multiple jobs on servers, it is possible for the "All
clients" output to appear in the middle of output for the individual
jobs. This patch puts the "All clients" output into a separate buffer
and displays it after the output for all the individual jobs.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 months agostat: fix accumulation of latency buckets
Vincent Fu [Thu, 21 Mar 2019 16:45:13 +0000 (12:45 -0400)]
stat: fix accumulation of latency buckets

The numbers of buckets for nsec, usec, and msec latencies may differ
from each other. So we need to iterate separately over the three types
of buckets.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/io_uring: memset() allocated memory
Keith Busch [Mon, 11 Mar 2019 16:46:47 +0000 (10:46 -0600)]
t/io_uring: memset() allocated memory

But I totally rushed this patch and just sent it once I heard it "worked",
and it really doesn't because malloc doesn't zero the buffer. My mistake,
kzalloc spoiled me. Here's the fix:

Fixes: e39863e3cb61 ("t/io_uring: add depth options")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/io_uring: add depth options
Keith Busch [Fri, 8 Mar 2019 21:59:59 +0000 (14:59 -0700)]
t/io_uring: add depth options

Make depth options command line parameters so a recompile isn't
required to see how it affects performance.

Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agoengines/skeleton_external: update gcc incantation
Jens Axboe [Thu, 7 Mar 2019 23:54:41 +0000 (16:54 -0700)]
engines/skeleton_external: update gcc incantation

Fixes: https://github.com/axboe/fio/issues/747
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/io_uring: stop when max number of files is reached
Jens Axboe [Wed, 6 Mar 2019 15:24:38 +0000 (08:24 -0700)]
t/io_uring: stop when max number of files is reached

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agoengines/sg: ensure we flag EIO on the right io_u
Jens Axboe [Thu, 28 Feb 2019 17:07:38 +0000 (10:07 -0700)]
engines/sg: ensure we flag EIO on the right io_u

For sync complete, set it on the io_u that corresponds to the hdr
we just read.

Fixes: a999bc49d7aa ("engines/sg: ensure we complete the right command for sync IO")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agoengines/sg: ensure we complete the right command for sync IO
Jens Axboe [Thu, 28 Feb 2019 17:04:38 +0000 (10:04 -0700)]
engines/sg: ensure we complete the right command for sync IO

Currently we just read back the first command that completes, and
assume it's the right one. That's totally bogus, we need to keep
going until we find the right completion.

Also only call td_verror() if we have an error, not uncondtionally.

Fixes: https://github.com/axboe/fio/issues/743
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agoengines/sg: kill dead function
Jens Axboe [Sun, 24 Feb 2019 15:13:39 +0000 (08:13 -0700)]
engines/sg: kill dead function

This makes clang error out.

Fixes: bc596cbcdbb5 ("t/zbd: Add multi-job libaio test")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/zbd: Add multi-job libaio test
Damien Le Moal [Thu, 21 Feb 2019 04:11:07 +0000 (13:11 +0900)]
t/zbd: Add multi-job libaio test

Introduce test case 46 to verify that write ordering is correct and that
no job deadlock occurs in the case of a multi job run with an
asynchronous I/O engine (libaio).

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agozbd: Avoid async I/O multi-job workload deadlock
Damien Le Moal [Thu, 21 Feb 2019 04:11:06 +0000 (13:11 +0900)]
zbd: Avoid async I/O multi-job workload deadlock

With zonemode=zbd, for a multi-job workload using asynchronous I/O
engines with a deep I/O queue depth setting, a job that is building a
batch of asynchronous I/Os to submit may end up waiting for an I/O
target zone lock held by another job that is also preparing a batch.
For small devices with few zones and/or a large number of jobs, such
prepare phase zone lock contention can be frequent enough to end up in a
situation where all jobs are waiting for zone locks held by other jobs
and no I/O being executed (so no zone being unlocked).

Avoid this situation by using pthread_mutex_trylock() instead of
pthread_mutex_lock() and by calling io_u_quiesce() to execute queued
I/O units if locking fails. pthread_mutex_lock() is then called to
lock the desired target zone. The execution of io_u_quiesce() forces
I/O execution progress and so zones to be unlocked, avoiding job
deadlock.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agozbd: Fix zone locking for async I/O engines
Damien Le Moal [Thu, 21 Feb 2019 04:11:05 +0000 (13:11 +0900)]
zbd: Fix zone locking for async I/O engines

For a zoned block device with zonemode=zbd, the lock on the target zone
of an I/O is held from the time the I/O is prepared with
zbd_adjust_block() execution in fill_io_u() until the I/O is queued in
td_io_queue(). For a sync I/O engines, this means that the target zone
of an I/O operations is locked throughout the liftime of an I/O unit,
resulting in the serialization of write request preparation and
execution, as well as serialization of write operations and reset zone
operations for a zone, avoiding error inducing reordering.

However, in the case of an async I/O engine, the engine ->commit()
method falls outside of the zone lock serialization for all I/O units
that will be issued by the method execution. This results in potential
reordering of write requests during issuing, as well as simultaneous
queueing of write requests and zone reset operations resulting in
unaligned write errors.

For example, using a 1GB null_blk zoned device, the command:

fio --name=nullb0 --filename=/dev/nullb0 --direct=1 --zonemode=zbd
    --bs=4k --rw=randwrite --ioengine=libaio --group_reporting=1
    --iodepth=32 --numjobs=4

always fails due to unaligned write errors.

Fix this by refining the control over zone locking and unlocking.
Locking of an I/O target zone is unchanged and done in
zbd_adjust_block(), but the I/O callback function zbd_post_submit()
which updates a zone write pointer and unlocks the zone is split into
two different callbacks zbd_queue_io() and zbd_put_io().
zbd_queue_io() updates the zone write pointer for write operations and
unlocks the target zone only if the I/O operation was not queued or if
the I/O operation completed during the execution of the engine
->queue() method (e.g. a sync I/O engine is being used). The execution
of this I/O callback is done right after executing the I/O engine
->queue() method. The zbd_put_io() callback is used to unlock an I/O
target zone after completion of an I/O from within the put_io_u()
function.

To simplify the code the helper functions zbd_queue_io_u() and
zbd_put_io_u() which respectively call an io_u zbd_queue_io() and
zbd_put_io() callbacks are introduced. These helper functions are
conditionally defined only if CONFIG_LINUX_BLKZONED is set.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/zbd: Default to using blkzone tool
Shin'ichiro Kawasaki [Thu, 21 Feb 2019 04:11:04 +0000 (13:11 +0900)]
t/zbd: Default to using blkzone tool

The test-zbd-support script fails to execute for partition devices with
the error message "Open /dev/sdX1 failed (No such file or directory)"
when libzbc tools are used by the script to open the specified
partition device. This is due to libzbc also opening a partition holder
block device file, which when closed causes a partition table
revalidation and the partition device files to be deleted and
recreated by udev through the RRPART ioctl.

To avoid the failure, default to using blkzone for zone report and
reset if supported by the system (util-linux v2.30 and higher) as this
tool does not open the older device and avoids the same problem.
To obtain the device maximum number of open zones, which is not
advertized by blkzone, use sg_inq for SCSI devices and use the default
maximum of 128 for other device types (i.e. null_blk devices in zone
mode).

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/zbd: Fix test 2 and 3 result handling
Damien Le Moal [Thu, 21 Feb 2019 04:11:03 +0000 (13:11 +0900)]
t/zbd: Fix test 2 and 3 result handling

Removal of the message "No I/O performed" when fio does not execute any
I/O broke zbd tests 2 and 3 as this message is looked after to test for
success. Fix this by looking for a "Run status" line starting with
"WRITE:" for test 2 and "READ:" for test 3. The run status lines are not
printed when no I/O is performed. Testing for the absence of these
strings thus allows to easily test if I/Os where executed or not.

Fixes: ff3aa922570c ("Kill "No I/O performed by ..." message")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agot/zbd: Fix handling of partition devices
Shin'ichiro Kawasaki [Thu, 21 Feb 2019 04:11:02 +0000 (13:11 +0900)]
t/zbd: Fix handling of partition devices

To allow t/zbd/tests-zbd-support test script to run correctly on
partitions of zoned block devices, fix access to the device properties
through sysfs by referencing the sysfs directory of the holder block
device. Doing so, the "zoned", "logical_block_size" and "mq" attributes
can be correctly accessed.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agosg: Clean up handling of big endian data fields
Dmitry Fomichev [Thu, 21 Feb 2019 04:11:01 +0000 (13:11 +0900)]
sg: Clean up handling of big endian data fields

Getting and setting values in SCSI commands and descriptors,
which are big endian, in SG driver can use a bit of cleanup.
This patch simplifies SG driver code by introducing a set of
accessor functions for reading raw big endian values from SCSI
buffers and another set for properly storing the local values
as big endian byte sequences.

The patch also adds some missing endianness conversion macros
in os.h.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agosg: Avoid READ CAPACITY failures
Dmitry Fomichev [Thu, 21 Feb 2019 04:11:00 +0000 (13:11 +0900)]
sg: Avoid READ CAPACITY failures

Some SCSI devices (very large disks or SMR zoned disks in particular)
do not support the READ CAPACITY(10) command and only reply
successfully to the READ CAPACITY(16) command. This patch forces the
execution READ CAPACITY(16) if READ CAPACITY(10) fails with
CHECK CONDITION.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agozbd: Fix partition block device handling
Shin'ichiro Kawasaki [Thu, 21 Feb 2019 04:10:59 +0000 (13:10 +0900)]
zbd: Fix partition block device handling

For fio to correctly handle the zonemode=zbd mode with partitions of
zoned block devices, the partition block device file must be identified
as a zoned disk. However, partition block device files do not have
a zoned sysfs file. This patch allows a correct identification of the
device file zone model by accessing the sysfs "zoned" file of the
holder disk for partition devices.

Change get_zbd_model() function to resolve the symbolic link to the
sysfs path to obtain the canonical sysfs path. The canonical sysfs
path of a partition device includes both of the holder device name and
the partition device name. If the given device is a partition device,
cut the partition device name in the canonical sysfs path to access
the "zoned" file in the holder device sysfs path.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agooptions: catch division by zero in setting CPU affinity
Vincent Fu [Tue, 19 Feb 2019 21:44:08 +0000 (16:44 -0500)]
options: catch division by zero in setting CPU affinity

Catch a division by zero and abort with a helpful message instead of a
signal 8 floating point error.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
6 months agostat: use long doubles to identify latency percentiles
Vincent Fu [Tue, 19 Feb 2019 21:44:07 +0000 (16:44 -0500)]
stat: use long doubles to identify latency percentiles

In some cases, the 100th percentile latency is not correctly identified
because of problems with double precision floating point arithmetic.
Use long doubles instead in the while loop condition to reduce the
likelihood of encountering this problem.

Also, print an error message when latency percentiles are not
successfully identified.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoconfigure: enable -Wimplicit-fallthrough if we have it
Jens Axboe [Mon, 11 Feb 2019 20:30:52 +0000 (13:30 -0700)]
configure: enable -Wimplicit-fallthrough if we have it

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoDocument switch fall-through cases
Jens Axboe [Mon, 11 Feb 2019 18:20:29 +0000 (11:20 -0700)]
Document switch fall-through cases

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoio_uring: sync header with the kernel
Jens Axboe [Sun, 10 Feb 2019 16:36:48 +0000 (09:36 -0700)]
io_uring: sync header with the kernel

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoclient/server: inflate error handling
Jeff Furlong [Fri, 8 Feb 2019 23:33:34 +0000 (16:33 -0700)]
client/server: inflate error handling

Occasionally fio client/server with zlib enabled may report:

fio: inflate error -5
fio: failed decompressing log
fio: failed converting IO log

The error -5 is a Z_BUF_ERROR, and references are available at
https://zlib.net/zlib_how.html and https://www.zlib.net/manual.html  It
seems that when decompressing the buffer, if the buffer chunk is the
same size as remaining data in the buffer, the Z_BUF_ERROR can safely be
ignored.  So one idea is to ignore the safe errors noting the zlib
references:

"inflate() can also return Z_STREAM_ERROR, which should not be possible
here, but could be checked for as noted above for def(). Z_BUF_ERROR
does not need to be checked for here, for the same reasons noted for
def(). Z_STREAM_END will be checked for later.

        ret = inflate(&strm, Z_NO_FLUSH);
        assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
        switch (ret) {
        case Z_NEED_DICT:
            ret = Z_DATA_ERROR;     /* and fall through */
        case Z_DATA_ERROR:
        case Z_MEM_ERROR:
            (void)inflateEnd(&strm);
            return ret;
        }

...

The way we tell that deflate() has no more output is by seeing that it
did not fill the output buffer, leaving avail_out greater than zero.
However suppose that deflate() has no more output, but just so happened
to exactly fill the output buffer! avail_out is zero, and we can't tell
that deflate() has done all it can. As far as we know, deflate() has
more output for us. So we call it again. But now deflate() produces no
output at all, and avail_out remains unchanged as CHUNK. That deflate()
call wasn't able to do anything, either consume input or produce output,
and so it returns Z_BUF_ERROR. (See, I told you I'd cover this later.)
However this is not a problem at all. Now we finally have the desired
indication that deflate() is really done, and so we drop out of the
inner loop to provide more input to deflate()."

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoFio 3.13 fio-3.13
Jens Axboe [Fri, 8 Feb 2019 19:47:47 +0000 (12:47 -0700)]
Fio 3.13

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agostat: put 'percentiles' object in appropriate 'clat_ns' or 'lat_ns' parent
Vincent Fu [Thu, 7 Feb 2019 15:51:07 +0000 (10:51 -0500)]
stat: put 'percentiles' object in appropriate 'clat_ns' or 'lat_ns' parent

In the JSON output, the 'percentiles' object currently always appears within the
'clat_ns' object. Put it inside the 'lat_ns' object when --lat_percentiles=1 is set.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agostat: clean up calc_clat_percentiles
Vincent Fu [Thu, 7 Feb 2019 15:51:06 +0000 (10:51 -0500)]
stat: clean up calc_clat_percentiles

We already know the size of the buffer needed. So there
is no need to do anything fancy when allocating it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoImprove wording in REPORTING-BUGS
Jens Axboe [Mon, 4 Feb 2019 16:01:48 +0000 (09:01 -0700)]
Improve wording in REPORTING-BUGS

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agot/io_uring: verbose error for -95/-EOPNOTSUPP failure
Jens Axboe [Fri, 1 Feb 2019 05:55:52 +0000 (22:55 -0700)]
t/io_uring: verbose error for -95/-EOPNOTSUPP failure

If we fail with this error and polling is enabled, it's because the
file system hosting the file doesn't support polling. Let the user
know.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoio_uring: ensure we use the right argument syscall
Jens Axboe [Tue, 29 Jan 2019 19:20:02 +0000 (12:20 -0700)]
io_uring: ensure we use the right argument syscall

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agot/io_uring: fix bad if
Jens Axboe [Tue, 29 Jan 2019 19:04:22 +0000 (12:04 -0700)]
t/io_uring: fix bad if

We need braces for that check, or it's always going to be true.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoio_uring: update to kernel struct io_uring_params
Jens Axboe [Tue, 29 Jan 2019 13:25:54 +0000 (06:25 -0700)]
io_uring: update to kernel struct io_uring_params

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoio_uring: sync with kernel
Jens Axboe [Mon, 28 Jan 2019 18:42:20 +0000 (11:42 -0700)]
io_uring: sync with kernel

- Update to newer kernel API header
- Use IORING_ENTER_SQ_WAKEUP

Signed-off-by: Jens Axboe <axboe@kernel.dk>