fio.git
3 years agoiolog: Fix write_iolog_close()
Damien Le Moal [Fri, 8 May 2020 07:56:39 +0000 (16:56 +0900)]
iolog: Fix write_iolog_close()

If the init_iolog() call from backend.c thread_main() fails (e.g. wrong
file path given), td->iolog_f is not set but write_iolog_close() is
still called from thread_main() error processing. This causes a seg
fault and unclean termination of fio. Fix this by changing
write_iolog_close() to do nothing if td->iolog_f is NULL.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge branch 'rados' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 14 May 2020 17:47:17 +0000 (11:47 -0600)]
Merge branch 'rados' of https://github.com/vincentkfu/fio

* 'rados' of https://github.com/vincentkfu/fio:
  engines/rados: fix build issue with thread_cond_t vs pthread_cond_t

3 years agoengines/rados: fix build issue with thread_cond_t vs pthread_cond_t
Vincent Fu [Thu, 14 May 2020 16:54:11 +0000 (12:54 -0400)]
engines/rados: fix build issue with thread_cond_t vs pthread_cond_t

The Travis-CI Linux build fails because the type for completed_more_io
was changed from pthread_cond_t to thread_cond_t:

https://travis-ci.org/github/axboe/fio/jobs/687073515

Change it back to pthread_cond_t.

Fixes: 1e30d8d005a568169c0749f5fc6fb2d5f09dcc97 ("engines/rados: Added
waiting for completion on cleanup.")
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agoMerge branch 'rados-cleanup-wait' of https://github.com/aclamk/fio
Jens Axboe [Thu, 14 May 2020 15:37:24 +0000 (09:37 -0600)]
Merge branch 'rados-cleanup-wait' of https://github.com/aclamk/fio

* 'rados-cleanup-wait' of https://github.com/aclamk/fio:
  engines/rados: Added waiting for completion on cleanup.

3 years agoengines/rados: Added waiting for completion on cleanup.
Adam Kupczyk [Sat, 9 May 2020 09:22:04 +0000 (05:22 -0400)]
engines/rados: Added waiting for completion on cleanup.

This change protects against problems when closing connection to ceph,
while some aio are in flight.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
3 years agoMerge branch 'helper-thread-select' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 13 May 2020 14:10:32 +0000 (08:10 -0600)]
Merge branch 'helper-thread-select' of https://github.com/vincentkfu/fio

* 'helper-thread-select' of https://github.com/vincentkfu/fio:
  helper_thread: better handle select() return value

3 years agohelper_thread: better handle select() return value
Vincent Fu [Tue, 12 May 2020 16:50:25 +0000 (12:50 -0400)]
helper_thread: better handle select() return value

On Windows, the ETA is not updated after ramp_time expires. For example:

C:\fio-dev>fio\fio --name=test --runtime=5s --time_based --ramp_time=5 --size=1M --ioengine=null --thread
test: (g=0): rw=read, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=null, iodepth=1
fio-3.19-54-g9bc8
Starting 1 thread
Jobs: 1 (f=0): [/(1)][-.-%][eta 00m:05s]
test: (groupid=0, jobs=1): err= 0: pid=5344: Tue May 12 10:40:49 2020
  read: IOPS=2535k, BW=9903MiB/s (10.4GB/s)(48.4GiB/5001msec)
    clat (nsec): min=38, max=10680, avg=40.94, stdev= 4.20
     lat (nsec): min=107, max=10751, avg=110.78, stdev= 6.13
...

Notice that the last ETA update line indicates that there are still 5s
of runtime left even though the job has finished. This occurs because
the while loop in helper_thread_main() finishes soon after ramp_time
expires instead of continuing to run until the last job has completed.
The while loop ends because the return value for select() is stored in
ret. select() can return positive values in non-error conditions. The
while loop should not end when select() returns a positive value.

Fixes: 700ad386aa88 ("helper_thread: Complain if select() fails")

3 years agoMerge branch 'btrace2fio' of https://github.com/liu-song-6/fio
Jens Axboe [Mon, 11 May 2020 18:09:31 +0000 (12:09 -0600)]
Merge branch 'btrace2fio' of https://github.com/liu-song-6/fio

* 'btrace2fio' of https://github.com/liu-song-6/fio:
  btrace2fio: create separate jobs for pid with both read/write and trim

3 years agobtrace2fio: create separate jobs for pid with both read/write and trim
Song Liu [Mon, 11 May 2020 17:27:07 +0000 (10:27 -0700)]
btrace2fio: create separate jobs for pid with both read/write and trim

Single fio job cannot do read/write and trim. Generate two separate jobs
for pid that does both read/write and trim: pidxxx and pidxxx_trim.

Signed-off-by: Song Liu <songliubraving@fb.com>
3 years agoMerge branch 'helper_thread_test' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 29 Apr 2020 15:05:11 +0000 (09:05 -0600)]
Merge branch 'helper_thread_test' of https://github.com/vincentkfu/fio

* 'helper_thread_test' of https://github.com/vincentkfu/fio:
  helper_thread: refactor status-interval and steadystate code
  helper_thread: fix inconsistent status intervals
  helper_thread: cleanups

3 years agohelper_thread: refactor status-interval and steadystate code
Vincent Fu [Wed, 29 Apr 2020 11:19:54 +0000 (05:19 -0600)]
helper_thread: refactor status-interval and steadystate code

The code patterns for the status-interval and steadystate tasks are the same.
So refactor the common code into a separate function. The disk util code is not
the same because the task has a return code.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agohelper_thread: fix inconsistent status intervals
Vincent Fu [Tue, 28 Apr 2020 18:16:46 +0000 (12:16 -0600)]
helper_thread: fix inconsistent status intervals

The signal handler safety changes to the helper thread have resulted in
inconsistent status-interval intervals. Consider the following:

$ ./fio-canonical/fio --name=test --rw=randwrite --ioengine=libaio --direct=1 --runtime=180 --time_based --filename=/dev/fioa --output=write-canonical.out --minimal --status-interval=1
$ cut -d ';' -f 50 < write-canonical.out | awk 'NR>1{print $1-p} {p=$1}' | sort -n | tail
1002
1002
1002
1002
1002
1042
1046
1251
1252
1252

Several of the status-interval output lines are ~1250ms apart.

This patch moves code for triggering the status-interval output from the main
fio process to the helper thread. The resulting intervals are much closer to
the desired 1000ms.

$ ./fio/fio --name=test --rw=randwrite --ioengine=libaio --direct=1 --runtime=180 --time_based --filename=/dev/fioa --minimal --status-interval=1 --output=write-test.out
$ cut -d ';' -f 50 < write-test.out | awk 'NR>1{print $1-p} {p=$1}' | sort -n | tail
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001

Reported-by: <nate.rivers@wdc.com>
Fixes: 31eca641ad91 ("Fix a potential deadlock in helper_do_stat()")
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agohelper_thread: cleanups
Vincent Fu [Tue, 28 Apr 2020 17:27:14 +0000 (11:27 -0600)]
helper_thread: cleanups

- instead of always using a timeout of DISK_UTIL_MSEC, use a possibly shorter
  period for the select() timeout
- drop the timespec_add_msec() call because the target is overwritten in short
  order by clock_gettime()

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoMerge branch 'gcc1' of https://github.com/kusumi/fio
Jens Axboe [Tue, 21 Apr 2020 21:44:31 +0000 (15:44 -0600)]
Merge branch 'gcc1' of https://github.com/kusumi/fio

* 'gcc1' of https://github.com/kusumi/fio:
  json: Fix compile error on RHEL6

4 years agojson: Fix compile error on RHEL6
Tomohiro Kusumi [Tue, 21 Apr 2020 19:17:12 +0000 (04:17 +0900)]
json: Fix compile error on RHEL6

eb2f29b7fd("Make the JSON code easier to analyze") doesn't compile
on RHEL6 using gcc4.x.

Using "{.object = val,}," for an union field seems to fix the issue,
but just use "arg.object = val;" instead as this is guaranteed to
compile on supported platforms.

--
    CC gettime.o
In file included from stat.h:7,
                 from thread_options.h:7,
                 from fio.h:18,
                 from gettime.c:7:
json.h: In function 'json_object_add_value_object':
json.h:95: error: unknown field 'object' specified in initializer
json.h:95: warning: missing braces around initializer
json.h:95: warning: (near initialization for 'arg.<anonymous>')
json.h:95: warning: initialization makes integer from pointer without a cast
make: *** [gettime.o] Error 1

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agojson: don't use named initializers for anonymous unions
Jens Axboe [Tue, 21 Apr 2020 03:20:03 +0000 (21:20 -0600)]
json: don't use named initializers for anonymous unions

Older compilers don't like it, and we can just do make it work a bit
differently instead.

Fixes: https://github.com/axboe/fio/issues/966
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: Fix I/O direction adjustment step for random read/write
Shin'ichiro Kawasaki [Thu, 16 Apr 2020 11:30:36 +0000 (20:30 +0900)]
zbd: Fix I/O direction adjustment step for random read/write

Commit fb0259fb ("zbd: Ensure first I/O is write for random read/write to
sequential zones") introduced a step to change direction of io_u from
read to write when that is the first I/O of the random read/write
workload to zoned block devices. However, such direction adjustment
results in inconsistent I/O length when read block size and write block
size are different.

To avoid the inconsistency between I/O direction and I/O length,
adjust the I/O direction before the I/O length is set. Move the step
from zbd_adjust_block() to set_rw_ddir(). To minimize changes in
set_rw_ddir(), introduce zbd_adjust_ddir() helper function.

Fixes: fb0259fb ("zbd: Ensure first I/O is write for random read/write to sequential zones")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'patch-1' of https://github.com/aakarshg/fio
Jens Axboe [Thu, 16 Apr 2020 20:04:26 +0000 (14:04 -0600)]
Merge branch 'patch-1' of https://github.com/aakarshg/fio

* 'patch-1' of https://github.com/aakarshg/fio:
  Add fio-histo-log-pctiles to make file

4 years agoAdd fio-histo-log-pctiles to make file
Aakarsh Gopi [Thu, 16 Apr 2020 18:34:46 +0000 (14:34 -0400)]
Add fio-histo-log-pctiles to make file

This was missing earlier

4 years agoMerge branch 'appveyor-artifacts' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 15 Apr 2020 14:29:01 +0000 (08:29 -0600)]
Merge branch 'appveyor-artifacts' of https://github.com/vincentkfu/fio

* 'appveyor-artifacts' of https://github.com/vincentkfu/fio:
  appveyor: make test artifacts available for inspection

4 years agoappveyor: make test artifacts available for inspection
Vincent Fu [Tue, 14 Apr 2020 14:10:45 +0000 (10:10 -0400)]
appveyor: make test artifacts available for inspection

For debugging test failures, package test artifacts and make them
available for download. Exclude certain files to reduce size of the
compressed archive.

Suggested-by: Sitsofe Wheeler <sitsofe@gmail.com>
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agozbd: fix sequential write pattern with verify= and max_open_zones=
Alexey Dobriyan [Mon, 13 Apr 2020 18:51:55 +0000 (21:51 +0300)]
zbd: fix sequential write pattern with verify= and max_open_zones=

Sequential write with max_open_zones=1 has interesting (read: buggy)
interaction with verify=.

If verify is off, then job runs correctly and IO is sequential,
and restarted from offset 0 and remains sequential.

If verify is on, then 1 full run is done and verified correctly.
At this point there is exactly 1 open zone which is the last zone.

Now IO restarts from offset 0 and pick_random_zone() picks opened zone
#0 which is the last zone because offset is 0. All IO is redirected
to the last zone, which is rewritten once triggering verify again.

IO pattern becomes: 1 full sequential rewrite followed by constant
sequential rewrites of the last zone.

[global]
filename=/dev/loop0
direct=1
zonemode=zbd
zonesize=1M
bs=512K
rw=write
verify=xxhash
[j]
max_open_zones=1
io_size=3G

Fix is to close every zone given that verification acts as a barrier
between jobs.

max_open_zones=2 can restart from half of the device, etc.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: Ensure first I/O is write for random read/write to sequential zones
Shin'ichiro Kawasaki [Mon, 13 Apr 2020 08:33:00 +0000 (17:33 +0900)]
zbd: Ensure first I/O is write for random read/write to sequential zones

In case read is chosen for the first random I/O for sequential write
required zones, fio stops because no data can be read from the zones with
empty status. Enforce to write at the first I/O to make sure data to read
exists for the following read operations.

The unexpected fio stop symptom was observed with test case #30 of
t/zbd/test-zbd-support. When the test case was run repeatedly resetting
all zones with -r option, it often passes with too short run time.

Reviewed-by: Damien Le Moal <damien.lemoaal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/zbd: Fix a bug in reset_zone() for all zones reset
Shin'ichiro Kawasaki [Mon, 13 Apr 2020 08:32:59 +0000 (17:32 +0900)]
t/zbd: Fix a bug in reset_zone() for all zones reset

The bash function reset_zone() is expected to reset all zones when -1 is
provided as its second argument. However, it fails to reset all zones
using blkzone command because of wrong and unnecessary options provided
to blkzone. Remove the option to fix it.

This failure was found with running test-zbd-support with -r option.

Reviewed-by: Damien Le Moal <damien.lemoaal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/zbd: Fix a bug in max_open_zones()
Shin'ichiro Kawasaki [Mon, 13 Apr 2020 08:32:58 +0000 (17:32 +0900)]
t/zbd: Fix a bug in max_open_zones()

When sg_inq command is executed to check if it can provide maximum open
zones, the command's standard output was not discarded and caused
unexpected script behavior. Fix it discarding the standard output.

Reviewed-by: Damien Le Moal <damien.lemoaal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: fix zonemode=zbd with NDEBUG
Alexey Dobriyan [Fri, 10 Apr 2020 19:06:21 +0000 (22:06 +0300)]
zbd: fix zonemode=zbd with NDEBUG

assert() with NDEBUG doesn't evaluate argument.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'fix-cflags' of https://github.com/Hi-Angel/fio
Jens Axboe [Mon, 13 Apr 2020 14:04:09 +0000 (08:04 -0600)]
Merge branch 'fix-cflags' of https://github.com/Hi-Angel/fio

* 'fix-cflags' of https://github.com/Hi-Angel/fio:
  configure/Makefile: don't override user CFLAGS

4 years agoconfigure/Makefile: don't override user CFLAGS
Konstantin Kharlamov [Mon, 13 Apr 2020 11:57:19 +0000 (14:57 +0300)]
configure/Makefile: don't override user CFLAGS

It is a usual practice to build sw by passing `CFLAGS="-foo"` on
configure stage. It didn't work with FIO though. This commit fixes two
problems:

* configure: this script was overriding user CFLAGS
* Makefile: this script was appending its own CFLAGS instead of
  prepending them. The problem with this one is that it sets a -O3
option, but a user may have wanted to disable optimization, so they set
-O0 option. And by appending our CFLAGS we make user CFLAGS to not work.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
4 years agoMerge branch 'zbd-build' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 8 Apr 2020 14:46:35 +0000 (08:46 -0600)]
Merge branch 'zbd-build' of https://github.com/vincentkfu/fio

* 'zbd-build' of https://github.com/vincentkfu/fio:
  Revert ".travis.yml: remove pip line from xcode11.2 config"
  zbd: fix Windows build errors

4 years agoexamples: add libzbc ioengine example scripts
Damien Le Moal [Wed, 8 Apr 2020 06:53:09 +0000 (15:53 +0900)]
examples: add libzbc ioengine example scripts

Add two example script files (random write and sequential read)
illustrating the use of the libzbc ioengine with zonemode=zbd.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoexamples: add zonemode=zbd example scripts
Damien Le Moal [Wed, 8 Apr 2020 06:46:59 +0000 (15:46 +0900)]
examples: add zonemode=zbd example scripts

Add two example script files (random write and sequential read)
illustrating the use of zonemode=zbd with the psync and libaio
ioengines.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: Fix missing mutex unlock and warnings detected with coverity
Damien Le Moal [Wed, 8 Apr 2020 06:46:45 +0000 (15:46 +0900)]
zbd: Fix missing mutex unlock and warnings detected with coverity

With max_open_zones != 0, if no candidate zone for open is found by
zbd_convert_to_open_zone(), the file zbd_info mutex as well as the
current target zone mutex must both be unlocked before returning NULL.

While at it, also assert check for min_bs != 0 where min_bs is used for
divisions to avoid division by zero warnings from coverity.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 6463db6c1d3a ("fio: fix interaction between offset/size...")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoRevert ".travis.yml: remove pip line from xcode11.2 config"
Vincent Fu [Wed, 8 Apr 2020 11:22:18 +0000 (07:22 -0400)]
Revert ".travis.yml: remove pip line from xcode11.2 config"

This reverts commit 839e0223363e323a4acbdfaf785b03d5aa9f53ba.

Two weeks ago an update to the xcode11.2 image required the above patch
to get macOS testing working. Recently the xcode11.2 image was changed
back to its earlier state. So we now need to revert the above patch for
testing to work.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agozbd: fix Windows build errors
Vincent Fu [Wed, 8 Apr 2020 11:20:12 +0000 (07:20 -0400)]
zbd: fix Windows build errors

Adding the os.h include resolves the build problems.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agozbd: Fix build errors on Windows and MacOS
Damien Le Moal [Wed, 8 Apr 2020 01:54:26 +0000 (10:54 +0900)]
zbd: Fix build errors on Windows and MacOS

Including dirent.h is not needed, so remove it to avoid a compilation
error on Windows and MacOS. Also make sure that EREMOTEIO is defined as
some OSes do not have this error code.

Fixes: b76949618d55 ("fio: Generalize zonemode=zbd")
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'rdma-fixes' of https://github.com/dmonakhov/fio
Jens Axboe [Tue, 7 Apr 2020 22:05:23 +0000 (16:05 -0600)]
Merge branch 'rdma-fixes' of https://github.com/dmonakhov/fio

* 'rdma-fixes' of https://github.com/dmonakhov/fio:
  engine/rdmaio: fix io_u initialization
  engines: check options before dereference

4 years agot/zbd: Add support for libzbc IO engine tests
Dmitry Fomichev [Tue, 7 Apr 2020 01:59:00 +0000 (10:59 +0900)]
t/zbd: Add support for libzbc IO engine tests

Modify the test-zbd-support script to accept SG node device files for
tests with the libzbc IO engine. This IO engine can also be tested with
a block device file using the new -l option which forces all test cases
to have the option --ioengine=libzbc.

New helper functions are added to discover the capacity, logical block
size etc of devices specified using an SG node file.

To facilitate troubleshooting of problems, the option -z is also added
to automatically add the option --debug=zbd to all test cases.

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofio: Introduce libzbc IO engine
Dmitry Fomichev [Tue, 7 Apr 2020 01:58:59 +0000 (10:58 +0900)]
fio: Introduce libzbc IO engine

Many storage users in the field are using Linux enterprise distributions
with somewhat old kernel versions 3.x that do not have zoned block
device/ZBC/ZAC support, or distributions with more recent kernel
versions that do not have zoned block device support enabled by
default, i.e. not supported by the distribution vendor.

Despite this, there are many examples of production applications using
SMR disks directly using SCSI passthrough commands.

SMR disks performance tests and qualification using fio in such
environments is possible using the sg IO engine but writing scripts
is not easy as the zonemode=zbd cannot be used due to its lack of
support for ZBC operations (report zones, zone reset, etc).

Rather than modifying the sg IO engine, a simpler approach to provide
passthrough SMR support in fio is to use libzbc
(https://github.com/hgst/libzbc) to implement a ZBC compliant ioengine
supporting zonemode=zbd zone operations. With this, it becomes possible
to run more easily fio against SMR disks on systems without kernel
zoned block device support. This approach will also naturally enable
support for other ZBD disks varieties besides ZAC/ZBC SMR disks, namely
the upcoming Zone Domains/Zone Realms (ZD/ZR) drives, aka, dynamic
hybrid SMR drives.

This new libzbc IO engine implements the three IO engine methods related
to zoned devices: get_zoned_model(), report_zones() and reset_wp(),
allowing the use of zonemode=zbd. Special open_file(), close_file() and
get_file_size() methods are provided and implemented using libzbc
functions. The queue() operation allows only synchronous read and write
operations using the libzbc functions zbc_pread() and zbc_pwrite().

Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoioengines: Add zoned block device operations
Damien Le Moal [Tue, 7 Apr 2020 01:58:58 +0000 (10:58 +0900)]
ioengines: Add zoned block device operations

Define three new IO engines operations: zoned model discovery, zone
information report and zone write pointer reset. These allow an
ioengine to provide special implementation of these operations if the
system does not support them natively through system calls or on Linux
to replace the default Linux blkzoned.h ioctl based generic
implementation in oslib/linux-blkzoned.c.

FIO internal and external ioengines using direct device access
(e.g. Linux SG) or OS specific IO engines can provide an implementation
of these method to enabled zoned block device zonemode=zbd workloads.

On Linux, the IO engine zone operations have precedence over the
default zone operation implementation in oslib/linux-blkzoned.c.

This patch also increments FIO_IOOPS_VERSION to 26 and adds a
skeleton implementation of the new ioengine operations in
engines/skeleton_external.c.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofio: Generalize zonemode=zbd
Damien Le Moal [Tue, 7 Apr 2020 01:58:57 +0000 (10:58 +0900)]
fio: Generalize zonemode=zbd

Generalize the implementation of the zbd zonemode for non-linux systems
and Linux systems without the blkzoned.h header file (that is, linux
systems with a kernel predating v4.10 or kernels compiled without zoned
block device support).

The configuration option CONFIG_HAS_BLKZONED determines if the system
supports or not zoned block devices. This option can be set for Linux
only for now. If it is set, the file oslib/linux-blkzoned.c is compiled
and the 3 functions defined are used by the zbd.c code to determine a
block device zoned model, get zone information and reset zones.
For systems that do not set the CONFIG_HAS_BLKZONED option,
zonemode=zbd will be useable with regular block devices with the
zbd code emulating zones as is already done currently.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoengine/rdmaio: fix io_u initialization
Dmitry Monakhov [Tue, 7 Apr 2020 19:18:42 +0000 (22:18 +0300)]
engine/rdmaio: fix io_u initialization

Currenly rdmaio engine fataly broken.
We fill io_u buffer inside engine->init() phase, but at this point td->io_u_freelist is empty,
so initialization code does nothing, so io_u->engine_data will be unitialized,
later this result in null pointer dereferent in fio_rdmaio_prep()

This patch moves io_u initialization to post_init() callback

4 years agoengines: check options before dereference
Dmitry Monakhov [Tue, 7 Apr 2020 17:33:46 +0000 (20:33 +0300)]
engines: check options before dereference

If FIO_OPT_STR_STORE option not provided it is initialized with NULL value, but
there are many places which assumes that is may be empty string
For example, commands below endup with null pointer dereference
fio  --name=test --ioengine=e4engine --size=1M
fio  --name=test --ioengine=rdma --port=1234 --size=1M

4 years agozbd: fixup ->zone_size_log2 if zone size is not power of 2
Alexey Dobriyan [Mon, 6 Apr 2020 19:56:10 +0000 (22:56 +0300)]
zbd: fixup ->zone_size_log2 if zone size is not power of 2

Code like this doesn't work if log2 is 0xffffffff.

if (f->zbd_info->zone_size_log2 > 0)
                zone_idx = offset >> f->zbd_info->zone_size_log2;
        else
                zone_idx = offset / f->zbd_info->zone_size;

Other than that everything else works!

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: Fix potential zone lock deadlock
Damien Le Moal [Mon, 6 Apr 2020 10:51:32 +0000 (19:51 +0900)]
zbd: Fix potential zone lock deadlock

Commit b27aef6abfba ("zbd: use zone_lock to lock a zone") to fix
potential deadlocks with zonemode=zbd  zone locking was incomplete.
The execution of the zone lock stress test t/zbd test case 48 still
sometimes lead to deadlocks (a large number of repeated execution is
sometimes needed).

The remaining deadlock pattern identified with the repeated execution
of this test is due to the concurrent execution of jobs doing random
async writes to zones. In such case, any of the job may trigger an all
zone reset through the path get_next_rand_block() -> fio_file_reset()
while async writes are still inflight. The fix for this is to use the
zone_lock() function instead of directly calling pthread_mutex_lock()i
to ensure that no async IO is inflight for a zone that is part of a
reset range.

Suggested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofio: fix interaction between offset/size limited threads and "max_open_zones"
Alexey Dobriyan [Thu, 2 Apr 2020 19:21:02 +0000 (22:21 +0300)]
fio: fix interaction between offset/size limited threads and "max_open_zones"

If thread bumps into "max_open_zones" limit, it tries to close/reopen some
other zone before issuing IO. This scan is done over full list of block device's
opened zones. It means that a zone which doesn't belong to thread's working
area can be altered or IO can be retargeted at such zone.

If IO is retargeted then it will be dropped by "is_valid_offset()" check.

What happens with null block device testing is that one thread monopolises
IO and others threads do basically nothing.

This config will reliably succeed now:

[global]
zonemode=zbd
zonesize=1M
rw=randwrite
...
thread
numjobs=2
offset_increment=128M

[j]
max_open_zones=2
size=2M

Starting 2 threads
zbd      7991  /dev/nullb0: zbd model string: host-managed
zbd      7991  Device /dev/nullb0 has 1024 zones of size 1024 KB
zbd      8009  /dev/nullb0: examining zones 0 .. 2
zbd      8010  /dev/nullb0: examining zones 128 .. 130
zbd      8009  /dev/nullb0: opening zone 0
zbd      8010  /dev/nullb0: opening zone 128
zbd      8009  /dev/nullb0: queued I/O (0, 4096) for zone 0
zbd      8009  zbd_convert_to_open_zone(/dev/nullb0): starting from zone 128 (offset 1552384, buflen 4096)

retargeted for other thread's zone (zone 0 => zone 128)

zbd      8010  /dev/nullb0: queued I/O (134217728, 4096) for zone 128
zbd      8009  zbd_convert_to_open_zone(/dev/nullb0): returning zone 128
zbd      8009  Dropped request with offset 134221824

and dropped

Note: quasi-randomness is kind of necessary to spread I/O. Imagine index 0
is picked all the time, zone living there will be reopened constantly and
get relatively little I/O.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'github-issue-947' of https://github.com/vincentkfu/fio
Jens Axboe [Tue, 31 Mar 2020 16:21:48 +0000 (10:21 -0600)]
Merge branch 'github-issue-947' of https://github.com/vincentkfu/fio

* 'github-issue-947' of https://github.com/vincentkfu/fio:
  stat: eliminate extra log samples

4 years agostat: eliminate extra log samples
Vincent Fu [Tue, 31 Mar 2020 11:26:16 +0000 (07:26 -0400)]
stat: eliminate extra log samples

b2a432bfbb6d inadvertently added extra log samples.

$ ./fio-canonical/fio --name=test --time_based --runtime=10s --write_lat_log=fio-07-b2a432 --log_avg_msec=1000 --size=1G --rw=rw
test: (g=0): rw=rw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1
fio-3.17-93-gb2a4
Starting 1 process
...
$ cat fio-07-b2a432_clat.1.log
1000, 5851, 0, 0, 0
1000, 2551, 1, 0, 0
1000, 5028, 1, 0, 0
2000, 4175, 0, 0, 0
2000, 3214, 1, 0, 0
2000, 60619, 0, 0, 0
...

There should only be two lines at each timestamp (one for reads, one for
writes), but the first two timestamps have three lines each.

The cause is an inadvertent change in stat.c:add_log_sample() of
__add_stat_to_log to _add_stat_to_log. Reverting to the two-underscore
version resolves this issue.

Fixes: https://github.com/axboe/fio/issues/947
Fixes: b2a432bfbb6d ("Per-command priority: Priority logging and libaio/io_uring cmdprio_percentage")
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoMerge branch 'jsonplus2csv' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 26 Mar 2020 15:03:40 +0000 (09:03 -0600)]
Merge branch 'jsonplus2csv' of https://github.com/vincentkfu/fio

* 'jsonplus2csv' of https://github.com/vincentkfu/fio:
  .travis.yml: remove pip line from xcode11.2 config
  t/jsonplus2csv_test.py: test script for tools/fio_jsonplus_clat2csv
  tools/fio_jsonplus2csv: accommodate multiple lat measurements

4 years ago.travis.yml: remove pip line from xcode11.2 config
Vincent Fu [Wed, 25 Mar 2020 17:48:39 +0000 (13:48 -0400)]
.travis.yml: remove pip line from xcode11.2 config

travis-ci changed the xcode11.2 image and 'pip' is no longer available.
So only run 'pip install scipy' for the default xcode image.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agot/jsonplus2csv_test.py: test script for tools/fio_jsonplus_clat2csv
Vincent Fu [Wed, 25 Mar 2020 16:53:54 +0000 (12:53 -0400)]
t/jsonplus2csv_test.py: test script for tools/fio_jsonplus_clat2csv

Add a script to run a basic jsonplus to CSV conversion and then validate
the conversion.

Also integrate this test script with t/run-fio-tests.py and install the
python package 'six' to support fio_jsonplus_clat2csv in the AppVeyor
build/testing environment.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agotools/fio_jsonplus2csv: accommodate multiple lat measurements
Vincent Fu [Mon, 23 Mar 2020 22:14:40 +0000 (18:14 -0400)]
tools/fio_jsonplus2csv: accommodate multiple lat measurements

Add some intelligence to this script so that it works for any of
submission, completion, and total latency whenever they are present. The
CSV data format is changed to accommodate this.

While we're here also do the following:

add a way to generate optional debug output
add validate option that compares generated CSV data with the original
json+ data
fix style issues identified by pylint3
update documentation

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agozbd: add test for stressing zone locking
Naohiro Aota [Fri, 28 Feb 2020 07:12:48 +0000 (16:12 +0900)]
zbd: add test for stressing zone locking

Add a test to stress zone locking mechanism by having a large number of
threads with a small number of max_open_zones. Run 30 seconds time-based
fio under the timeout command. After 45 seconds, "timeout" kill -KILL the
fio process. If a zone lock deadlocks, fio is killed by the timeout
command, and this test fails. If not, fio runs to the end and this test
success.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoio_u: ensure io_u_quiesce() to process all the IOs
Naohiro Aota [Fri, 28 Feb 2020 07:12:47 +0000 (16:12 +0900)]
io_u: ensure io_u_quiesce() to process all the IOs

Currently, when IO have an error io_u_quiesce() stops processing
in-flight IOs there and leaves other IOs non-completed. This is not a
desired behavior for io_u_quiesce(). Fix it by continuing even on
error.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agobackend: always clean up pending aios
Naohiro Aota [Fri, 28 Feb 2020 07:12:46 +0000 (16:12 +0900)]
backend: always clean up pending aios

cleanup_pending_aios() is called when a thread exits with error, so all the
call site of this function is under "if (td->error)". However, commit
d28174f0189c ("workqueue: ensure we see deferred error for IOs"), for some
reason, added "if (td->error) return" at the head of this function, making
this function practically void. Revert this part to ensure cleaning up
pending aios.

Besides, cleanup_pending_aios() should not return even when
io_u_queued_complete() failed. Because, it keeps in-flight aios left.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: use zone_lock to lock a zone
Naohiro Aota [Fri, 28 Feb 2020 07:12:45 +0000 (16:12 +0900)]
zbd: use zone_lock to lock a zone

commit 6f0c608564c3 ("zbd: Avoid async I/O multi-job workload deadlock")
introduced io_u_quiesce() when it failed to lock a zone to avoid deadlock.
This situation can happen on the other locking place like
zbd_convert_to_open_zone(). Thus, introduce common helper "zone_lock" to
lock a zone.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: reset one zone at a time
Naohiro Aota [Fri, 28 Feb 2020 07:12:44 +0000 (16:12 +0900)]
zbd: reset one zone at a time

zbd_rest_zones() currently scans over device zones and try to reset as much
zones as possible at a time. However, this routine takes all the lock on
the range and causes a lot of lock contentions with other threads.

This commit change the behavior to hold the lock and examine one zone at a
time. While it will increase the number of ioctl() call when it need to
reset contiguous, the overhead of increased number of ioctl()s are anyway
amortized by device side's reset performance.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agozbd: avoid initializing swd when unnecessary
Naohiro Aota [Fri, 28 Feb 2020 07:12:43 +0000 (16:12 +0900)]
zbd: avoid initializing swd when unnecessary

When enable_check_swd == false, there is no use to initialize swd. Just
disable it in this case.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agogauss.c: correct the stddev initializtion
Feng Tang [Tue, 17 Mar 2020 12:53:31 +0000 (20:53 +0800)]
gauss.c: correct the stddev initializtion

Signed-off-by: Feng Tang <feng.tang@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/io_uring: don't use *rand48_r() variants
Jens Axboe [Mon, 16 Mar 2020 14:30:36 +0000 (08:30 -0600)]
t/io_uring: don't use *rand48_r() variants

Not available on all platforms.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'patch-1' of https://github.com/neheb/fio
Jens Axboe [Mon, 16 Mar 2020 00:59:19 +0000 (18:59 -0600)]
Merge branch 'patch-1' of https://github.com/neheb/fio

* 'patch-1' of https://github.com/neheb/fio:
  configure: fix vasprintf check under musl

4 years agoconfigure: fix vasprintf check under musl
Rosen Penev [Sun, 15 Mar 2020 21:43:39 +0000 (14:43 -0700)]
configure: fix vasprintf check under musl

It errors when passing NULL or 0. Passing an empty va_list works.

4 years agoFio 3.19 fio-3.19
Jens Axboe [Thu, 12 Mar 2020 17:12:50 +0000 (11:12 -0600)]
Fio 3.19

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoengines/io_uring: delete fio_option_is_set() calls when submitting sqes
Xiaoguang Wang [Thu, 12 Mar 2020 11:16:17 +0000 (19:16 +0800)]
engines/io_uring: delete fio_option_is_set() calls when submitting sqes

The fio_option_is_set() call in fio_ioring_prep() is time-consuming,
which will reduce sqe's submit rate drastically. To fix this issue,
add two new variables to record whether ioprio_class or ioprio_set
is set. I use a simple fio job to evaluate the performance:
    fio -name=fiotest -filename=/dev/nvme0n1 -iodepth=4 -thread -rw=read
    -ioengine=io_uring -hipri=0 -sqthread_poll=0 -direct=1 -bs=4k -size=10G
    -numjobs=1 -time_based -runtime=120

Before this patch:
  READ: bw=969MiB/s (1016MB/s), 969MiB/s-969MiB/s (1016MB/s-1016MB/s),
  io=114GiB (122GB), run=120001-120001msec

With this patch:
  READ: bw=1259MiB/s (1320MB/s), 1259MiB/s-1259MiB/s (1320MB/s-1320MB/s),
  io=148GiB (158GB), run=120001-120001msec

Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'patch-1' of https://github.com/felixonmars/fio
Jens Axboe [Tue, 3 Mar 2020 15:11:08 +0000 (08:11 -0700)]
Merge branch 'patch-1' of https://github.com/felixonmars/fio

* 'patch-1' of https://github.com/felixonmars/fio:
  Correct multiple typos in engines/libhdfs.c

4 years agoCorrect multiple typos in engines/libhdfs.c
Felix Yan [Tue, 3 Mar 2020 07:37:54 +0000 (15:37 +0800)]
Correct multiple typos in engines/libhdfs.c

4 years agoMerge branch 'filestat3' of https://github.com/kusumi/fio
Jens Axboe [Mon, 2 Mar 2020 16:34:38 +0000 (09:34 -0700)]
Merge branch 'filestat3' of https://github.com/kusumi/fio

* 'filestat3' of https://github.com/kusumi/fio:
  engines/filestat: add statx(2) syscall support

4 years agoengines/filestat: add statx(2) syscall support
Tomohiro Kusumi [Mon, 2 Mar 2020 15:31:25 +0000 (00:31 +0900)]
engines/filestat: add statx(2) syscall support

This commit
1) tests existence of statx(2) and libc support on ./confiugre.
2) adds oslib/statx.c and implements statx(2) using above result.
3) adds statx(2) support in filestat ioengine.

Confirmed compilation on Fedora31, FreeBSD, and NetBSD.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agoMerge branch 'genfio-bash' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 1 Mar 2020 22:43:14 +0000 (15:43 -0700)]
Merge branch 'genfio-bash' of https://github.com/sitsofe/fio

* 'genfio-bash' of https://github.com/sitsofe/fio:
  genfio: use /bin/bash hashbang

4 years agoMerge branch 'fix-win-raw' of https://github.com/sitsofe/fio
Jens Axboe [Sun, 1 Mar 2020 22:42:48 +0000 (15:42 -0700)]
Merge branch 'fix-win-raw' of https://github.com/sitsofe/fio

* 'fix-win-raw' of https://github.com/sitsofe/fio:
  filesetup: fix win raw disk access and improve dir creation failure msg

4 years agoMerge branch 'clean1' of https://github.com/kusumi/fio
Jens Axboe [Sun, 1 Mar 2020 22:41:37 +0000 (15:41 -0700)]
Merge branch 'clean1' of https://github.com/kusumi/fio

* 'clean1' of https://github.com/kusumi/fio:
  Makefile: don't fail to remove conditionally compiled binaries on clean

4 years agofilesetup: fix win raw disk access and improve dir creation failure msg
Sitsofe Wheeler [Sun, 1 Mar 2020 18:27:19 +0000 (18:27 +0000)]
filesetup: fix win raw disk access and improve dir creation failure msg

The commit df18600fd06258b96ae6f6b530ecdff541c2a82d ("filesetup: fix
directory creation issues") broke Windows raw/physical disk access
because Windows doesn't consider a path that only consists of a
namespace (such as the device namespace "\\.\" - see
https://docs.microsoft.com/en-gb/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN#namespaces
for information on Windows' namespaces) to exist as a directory(!).

Workaround the issue for raw devices by explicitly considering the
device namespace subcomponent to always be valid. Further, intermediate
path components in UNC paths or paths starting with a namespace might
also not "exist" so introduce backwards scanning for the longest
pre-existing directory to sidestep this. The function doing this is made
available for non-windows platforms so a similar code path is used
everywhere.

Tests done:

Windows:
> ./fio.exe --name=dtest --thread --size=16k --rw=write `
  --filename 'fio.tmp'
> ./fio.exe --name=dtest --thread --size=16k --rw=write `
  --filename '\\?\C\:\Windows\Temp\fio\fio.tmp'
> Clear-Disk 1 -RemoveData -Confirm:$false # Destroys partition data!
> ./fio.exe --name=dtest --thread --size=16k --rw=write `
   --filename '\\.\PhysicalDrive1'
> ./fio.exe --name=dtest --thread --size=16k --rw=write `
  --filename '\fio.tmp'
> ./fio.exe --name=dtest --thread --size=16k --rw=write `
  --filename '\\LOCALHOST\Users\User\fio\fio.tmp'

macOS:
$ rm -rf /tmp/fio
$ ./fio --name=dtest --size=16k --filename /tmp/fio/fio.tmp \
  --rw=write

Finally, change the directory creation error message to give a human
error message rather than just an errno.

Fixes: https://github.com/axboe/fio/issues/916
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agogenfio: use /bin/bash hashbang
Sitsofe Wheeler [Sun, 1 Mar 2020 22:01:39 +0000 (22:01 +0000)]
genfio: use /bin/bash hashbang

Not all distros have done usrmerge - Debian
https://salsa.debian.org/debian/fio/-/blob/5a608e04b947aed0d3b49d7ca9a85ed9afe9ec56/debian/patches/genfio-interpreter
and SUSE (https://build.opensuse.org/request/show/541207 ) have been
carrying a patch changing the interpreter for genfio back to /bin/bash
and that's before you get to other OSes such as macOS...

Since /bin/bash works everywhere let's do this upstream too.

Fixes: https://github.com/axboe/fio/pull/883
Inspired-by: Changcheng Liu <changcheng.liu@aliyun.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agoio_uring: we should not need two write barriers for SQ updates
Jens Axboe [Thu, 27 Feb 2020 02:54:12 +0000 (19:54 -0700)]
io_uring: we should not need two write barriers for SQ updates

Just after updating the tail should be fine.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofio: remove duplicate global definition of tsc_reliable
Eric Sandeen [Fri, 31 Jan 2020 19:19:07 +0000 (13:19 -0600)]
fio: remove duplicate global definition of tsc_reliable

Newer gcc v10 complains about globals being defined twice due to
a new default -fno-common flag. This causes build failures:

  LINK t/fio-dedupe
/usr/bin/ld: t/arch.o:(.bss+0x4): multiple definition of `tsc_reliable'; gettime.o:(.bss+0x4): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:499: t/fio-dedupe] Error 1

Each of the tests which call arch_init() to initialize tsc_reliable:

  File          Function       Line
1 t/dedupe.c    main           536 arch_init(argv);
2 t/lfsr-test.c main            37 arch_init(argv);
3 t/stest.c     main            86 arch_init(argv);

already link with gettime.o which defines tsc_reliable,
so there is no need to provide it from t/arch.c

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'div-by-zero' of https://github.com/vincentkfu/fio
Jens Axboe [Mon, 24 Feb 2020 15:23:52 +0000 (08:23 -0700)]
Merge branch 'div-by-zero' of https://github.com/vincentkfu/fio

* 'div-by-zero' of https://github.com/vincentkfu/fio:
  t/latency_percentiles: avoid division by zero

4 years agot/latency_percentiles: avoid division by zero
Vincent Fu [Mon, 24 Feb 2020 14:20:46 +0000 (09:20 -0500)]
t/latency_percentiles: avoid division by zero

For the smallest latency durations, the actual and approximate values
should be exactly the same. Use this property to avoid a division by
zero when the actual latency value is zero.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoMakefile: don't fail to remove conditionally compiled binaries on clean
Tomohiro Kusumi [Thu, 13 Feb 2020 15:57:31 +0000 (00:57 +0900)]
Makefile: don't fail to remove conditionally compiled binaries on clean

`rm -f $(T_PROGS) $(T_TEST_PROGS)` in `clean` target is intended to
remove all binaries under t directory, but it actually fails to remove
`t/{fio-btrace2fio,io_uring,read-to-pipe-async}` files for not
evaluating platform specific variables on `make clean`.

 # uname -r
 5.4.17-200.fc31.x86_64
 # make clean
 # file t/* | grep ELF | awk '{print $1,$2,$3,$4,$5}'
 t/fio-btrace2fio: ELF 64-bit LSB executable,
 t/io_uring: ELF 64-bit LSB executable,
 t/read-to-pipe-async: ELF 64-bit LSB executable,

The easiest way to fix this is to hard-code these conditionally
compiled binaries.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agoMerge branch 'master' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 6 Feb 2020 19:17:25 +0000 (12:17 -0700)]
Merge branch 'master' of https://github.com/vincentkfu/fio

* 'master' of https://github.com/vincentkfu/fio:
  t/run-fio-tests: fix style issues
  gfio: add high/low priority latency results
  .gitignore: add some test programs
  stat: summary statistics for both high/low priority latencies

4 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Thu, 6 Feb 2020 18:58:09 +0000 (11:58 -0700)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  Make the JSON code easier to analyze

4 years agoUnify architecture io_uring syscall numbers
Jens Axboe [Thu, 6 Feb 2020 14:59:00 +0000 (07:59 -0700)]
Unify architecture io_uring syscall numbers

Only Alpha is the odd one out, apart from that all architectures use
the same system call number. So pull the code out arch headers, and
into the generic arch header.

Fixes: https://github.com/axboe/fio/issues/923
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMake the JSON code easier to analyze
Bart Van Assche [Wed, 5 Feb 2020 05:18:31 +0000 (21:18 -0800)]
Make the JSON code easier to analyze

Coverity reports the following false positive for the JSON code in stat.c:

CID 284826 (#1 of 1): Resource leak (RESOURCE_LEAK)
17. leaked_storage: Variable percentile_object going out of scope leaks the storage it points to.

Suppress this false positive by making the JSON code easier to analyze. The
changes in this patch are as follows:
- Change the macros in json.h into inline functions such that the compiler
  performs argument type verification at compile time.
- Pass a struct json_value pointer to json_*_add_value_type() instead of
  using varargs.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agot/run-fio-tests: fix style issues
Vincent Fu [Wed, 5 Feb 2020 21:17:42 +0000 (16:17 -0500)]
t/run-fio-tests: fix style issues

Many style issues were identified by pylint3. Fix most of them.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agogfio: add high/low priority latency results
Vincent Fu [Wed, 5 Feb 2020 19:55:50 +0000 (14:55 -0500)]
gfio: add high/low priority latency results

For the cmdprio_percentage option, add high/low priority summary
statistics and latency percentiles.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years ago.gitignore: add some test programs
Vincent Fu [Wed, 5 Feb 2020 19:12:17 +0000 (14:12 -0500)]
.gitignore: add some test programs

t/io_uring, t/memlock, and t/read-to-pipe-async are now routinely built.
Add them to .gitignore to avoid cluttering up the output of 'git
status'.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agostat: summary statistics for both high/low priority latencies
Vincent Fu [Wed, 5 Feb 2020 19:05:50 +0000 (14:05 -0500)]
stat: summary statistics for both high/low priority latencies

For the sake of completeness, include summary statistics for both high
and low priority latencies in the normal output when cmdprio_percentage
is used.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoFio 3.18 fio-3.18
Jens Axboe [Wed, 5 Feb 2020 14:59:58 +0000 (07:59 -0700)]
Fio 3.18

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'latency-rebase-again' of https://github.com/vincentkfu/fio
Jens Axboe [Tue, 4 Feb 2020 17:05:09 +0000 (10:05 -0700)]
Merge branch 'latency-rebase-again' of https://github.com/vincentkfu/fio

* 'latency-rebase-again' of https://github.com/vincentkfu/fio:
  t/run-fio-tests: increase time allowed for tests to pass
  t/run-fio-tests: add latency_percentiles.py
  t/latency_percentiles: test latency percentile reporting
  stat: fix high/low prio unified rw bug
  fio: better distinguish between high and low priority
  stat: make priority summary statistics consistent with percentiles
  docs: updates for slat, clat, lat percentile reporting
  gfio: display slat, clat, and lat percentiles
  fio: report percentiles for slat, clat, lat
  fio: groundwork for adding slat, lat percentiles

4 years agoMerge branch 'filestat2' of https://github.com/kusumi/fio
Jens Axboe [Tue, 4 Feb 2020 17:04:19 +0000 (10:04 -0700)]
Merge branch 'filestat2' of https://github.com/kusumi/fio

* 'filestat2' of https://github.com/kusumi/fio:
  engines/filestat: change "lstat" bool option to "stat_type" str option

4 years agoengines/filestat: change "lstat" bool option to "stat_type" str option
Tomohiro Kusumi [Tue, 4 Feb 2020 12:25:47 +0000 (21:25 +0900)]
engines/filestat: change "lstat" bool option to "stat_type" str option

Per suggestion from Jens, change a bool option to str option
to better support stat(2) variants (at this point before 3.18).

https://github.com/axboe/fio/pull/912#issuecomment-577814885

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agot/run-fio-tests: increase time allowed for tests to pass
Vincent Fu [Mon, 3 Feb 2020 16:06:36 +0000 (11:06 -0500)]
t/run-fio-tests: increase time allowed for tests to pass

With a 300s timeout I occasionally see tests fail when they usually
pass. Bump the timeout to 600s to give tests more of an opportunity to
finish successfully.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agot/run-fio-tests: add latency_percentiles.py
Vincent Fu [Tue, 21 Jan 2020 19:10:38 +0000 (14:10 -0500)]
t/run-fio-tests: add latency_percentiles.py

Add the latency percentiles test script to the general test script.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agot/latency_percentiles: test latency percentile reporting
Vincent Fu [Fri, 17 Jan 2020 20:50:45 +0000 (15:50 -0500)]
t/latency_percentiles: test latency percentile reporting

This script runs fio jobs exercising the slat_percentiles,
clat_percentiles, and lat_percentiles options under various conditions.
It carries out several tests comparing write_lat_log data with
percentiles reported by fio.

It also includes limited tests of high/low priority latency reporting
with the cmdprio_percentage option. Only Linux supports the
cmdprio_percentage option. Skips these tests on other platforms.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agostat: fix high/low prio unified rw bug
Vincent Fu [Fri, 31 Jan 2020 22:27:26 +0000 (17:27 -0500)]
stat: fix high/low prio unified rw bug

With unified_rw_reporting enabled, high/low priority summary statistics
were not correctly reported. This patch fixes the problem.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agofio: better distinguish between high and low priority
Vincent Fu [Thu, 30 Jan 2020 22:37:05 +0000 (17:37 -0500)]
fio: better distinguish between high and low priority

Change the variable names for the low priority latency variables to
explicity distinguish them from the high priority latency variables.
Also rename the JSON objects to do the same. This reduces the mental
effort required to read the code and output.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agostat: make priority summary statistics consistent with percentiles
Vincent Fu [Thu, 30 Jan 2020 20:16:52 +0000 (15:16 -0500)]
stat: make priority summary statistics consistent with percentiles

When lat_percentiles=1, reported high/low priority percentiles will
describe total latency values. Make the summary statistics (min, max,
mean, stddev) also describe total latency. Otherwise there will be a
mismatch in the JSON output with completion latency summary statistics
combined with total latency percentile values.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agodocs: updates for slat, clat, lat percentile reporting
Vincent Fu [Thu, 9 Jan 2020 16:15:00 +0000 (11:15 -0500)]
docs: updates for slat, clat, lat percentile reporting

Modify the HOWTO and man page to reflect changes to the slat, clat, and
lat percentile reporting options.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agogfio: display slat, clat, and lat percentiles
Vincent Fu [Tue, 21 Jan 2020 22:00:39 +0000 (17:00 -0500)]
gfio: display slat, clat, and lat percentiles

Display in the results window slat, clat, and lat percentiles if they
were requested by the user.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agofio: report percentiles for slat, clat, lat
Vincent Fu [Wed, 29 Jan 2020 19:08:26 +0000 (14:08 -0500)]
fio: report percentiles for slat, clat, lat

Currently, fio can report percentiles for either completion latencies or
total latencies. This patch adds the ability to simultaneously report
percentiles for submission, completion, and total latencies.

- simplify the JSON lat percentile reporting code
- parsing the JSON output will be unaffected, although now setting
lat_percentiles=1 no longer suppresses clat percentiles
- this may break parsing of the normal output since more latency
percentile blocks may be displayed
- to maintain backward compatibility in the terse output, total
latencies are reported if lat_percentiles=1 even when clat percentiles
have also been computed
- change the gtod_reduce callback to only change option values when
gtod_reduce=1
- for the new cmdprio_percentage latencies, if lat_percentiles=1,
*total* latency percentiles will be tracked. Otherwise, *completion*
latency percentiles will be tracked.
- also make sure we skip the high/low priority latency code if we are
producing output for sync latencies.
- make add_slat_sample use an unsigned long long for the time to be
consistent with other functions

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agofio: groundwork for adding slat, lat percentiles
Vincent Fu [Thu, 23 Jan 2020 19:46:14 +0000 (14:46 -0500)]
fio: groundwork for adding slat, lat percentiles

Expand the data structure used for tabulating completion latency
percentiles so that we will have the ability to tabulate percentiles for
submission and total latency as well. This should not change fio's
behavior.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoMerge branch 'stat-averaging-interval-start-fix' of https://github.com/maciejsszmigie...
Jens Axboe [Tue, 28 Jan 2020 21:15:35 +0000 (14:15 -0700)]
Merge branch 'stat-averaging-interval-start-fix' of https://github.com/maciejsszmigiero/fio

* 'stat-averaging-interval-start-fix' of https://github.com/maciejsszmigiero/fio:
  stat: fix calculation of bw and iops statistics based on samples