fio.git
3 years agoengines/io_uring: Use atomic_{load_acquire,store_release}()
Bart Van Assche [Sun, 21 Jun 2020 21:17:58 +0000 (14:17 -0700)]
engines/io_uring: Use atomic_{load_acquire,store_release}()

This patch improves performance by using acquire and release semantics
instead of barriers and also brings the io_uring engine code closer to that
of liburing.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoengines/libaio: Use atomic_store_release() instead of read_barrier()
Bart Van Assche [Sun, 21 Jun 2020 21:16:59 +0000 (14:16 -0700)]
engines/libaio: Use atomic_store_release() instead of read_barrier()

This is a micro-optimization that does not affect the functionality of the
code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoarch/arch.h: Introduce atomic_{load_acquire,store_release}()
Bart Van Assche [Sun, 21 Jun 2020 21:38:41 +0000 (14:38 -0700)]
arch/arch.h: Introduce atomic_{load_acquire,store_release}()

Implement atomic_load_acquire() and atomic_store_release() with C11
atomic operations. These two primitives will be used in later patches.
This patch increases the minimum requirement for the compiler fio is
built with from C90 to C11.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agofio_sem: Remove a read_barrier() call
Bart Van Assche [Sun, 21 Jun 2020 20:54:15 +0000 (13:54 -0700)]
fio_sem: Remove a read_barrier() call

Since pthread_mutex_lock() already provides load-acquire semantics, calling
read_barrier() just after pthread_mutex_lock() is not necessary. See also
commit 4d4e80f2b426 ("Revamp file locking").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoMake __rand_0_1() compatible with clang
Bart Van Assche [Mon, 22 Jun 2020 02:01:00 +0000 (19:01 -0700)]
Make __rand_0_1() compatible with clang

This patch fixes the following clang compiler error:

crc/../arch/../lib/rand.h:109:25: error: implicit conversion from
      'unsigned long long' to 'double' changes value from 18446744073709551615
      to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion]
                return (val + 1.0) / (FRAND64_MAX + 1.0);
                                      ^~~~~~~~~~~ ~
crc/../arch/../lib/rand.h:9:22: note: expanded from macro 'FRAND64_MAX'
 #define FRAND64_MAX     (-1ULL)
                         ^~~~~

Fixes: e7b240474543 ("Fixups for poisson rate")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoconfigure: Use -Wimplicit-fallthrough=2 instead of -Wimplicit-fallthrough=3
Bart Van Assche [Mon, 22 Jun 2020 02:09:48 +0000 (19:09 -0700)]
configure: Use -Wimplicit-fallthrough=2 instead of -Wimplicit-fallthrough=3

This makes clang accept /* fallthrough */ as a fallthrough annotation.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoPriority bit log file format documentation update
Phillip Chen [Fri, 12 Jun 2020 18:30:24 +0000 (12:30 -0600)]
Priority bit log file format documentation update

Updates the description of log file formats to include and
describe the priority bit entry.

Signed-off-by: Phillip Chen <phillip.a.chen@seagate.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge branch 'zbd' of https://github.com/bvanassche/fio
Jens Axboe [Fri, 12 Jun 2020 14:48:44 +0000 (08:48 -0600)]
Merge branch 'zbd' of https://github.com/bvanassche/fio

* 'zbd' of https://github.com/bvanassche/fio:
  pshared: Improve mutex_init_pshared_with_type()
  zbd: Fix zoned_block_device_info.zone_size documentation
  zbd: Fix spelling of the "zonemode" job option

3 years agoMerge branch 'master' of https://github.com/raphael-nutanix/fio
Jens Axboe [Fri, 12 Jun 2020 14:48:20 +0000 (08:48 -0600)]
Merge branch 'master' of https://github.com/raphael-nutanix/fio

* 'master' of https://github.com/raphael-nutanix/fio:
  Fix typo in libiscsi error message

3 years agoFix typo in libiscsi error message
Raphael Norwitz [Thu, 11 Jun 2020 00:59:03 +0000 (20:59 -0400)]
Fix typo in libiscsi error message

On authentication failure when connecting to an iscsi server, fio will
print "sicsi: failed to connect to LUN : Failed to log in to target.".

This change fixes a typo, changing sicsi to iscsi.

Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
3 years agopshared: Improve mutex_init_pshared_with_type()
Bart Van Assche [Sat, 30 May 2020 23:03:48 +0000 (16:03 -0700)]
pshared: Improve mutex_init_pshared_with_type()

Skipping the pthread_mutexattr_settype() call if type == 0 is questionable
because it makes it impossible to initialize a mutex with type == 0 (type 0
corresponds to PTHREAD_MUTEX_TIMED_NP on Linux). Use symbolic names for
pthread mutex types and leave out the type == 0 check.

Fixes: 3ed6894b00c4 ("pshared: Add mutex_init_pshared_with_type()")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agozbd: Fix zoned_block_device_info.zone_size documentation
Bart Van Assche [Sat, 30 May 2020 22:54:09 +0000 (15:54 -0700)]
zbd: Fix zoned_block_device_info.zone_size documentation

Commit ee3696bdfd84 changed the unit of 'zone_size' from 512 bytes into one
byte. Bring the documentation of that member variable in sync with the code.

Fixes: ee3696bdfd84 ("zbd: Use bytes unit")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agozbd: Fix spelling of the "zonemode" job option
Bart Van Assche [Sat, 30 May 2020 22:24:07 +0000 (15:24 -0700)]
zbd: Fix spelling of the "zonemode" job option

The comment above zbd_adjust_ddir() refers to the fio "zonemode" option.
Make sure that the name of that option has been spelled correctly.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoMerge branch 'latency_window' of https://github.com/liu-song-6/fio
Jens Axboe [Wed, 10 Jun 2020 01:43:52 +0000 (19:43 -0600)]
Merge branch 'latency_window' of https://github.com/liu-song-6/fio

* 'latency_window' of https://github.com/liu-song-6/fio:
  init: fix unit of latency_window

3 years agoMerge branch 'nowait' of https://github.com/koct9i/fio
Jens Axboe [Wed, 10 Jun 2020 01:43:37 +0000 (19:43 -0600)]
Merge branch 'nowait' of https://github.com/koct9i/fio

* 'nowait' of https://github.com/koct9i/fio:
  engines: pvsync2 libaio io_uring: add support for RWF_NOWAIT

3 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Wed, 10 Jun 2020 01:43:16 +0000 (19:43 -0600)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  client: Make skipping option appending in handle_job_opt() more selective
  client: Fix two memory leaks in handle_job_opt()
  Make json_object_add_value_string() duplicate its 'value' argument

3 years agoMerge branch 'client-leak-fix' of https://github.com/bvanassche/fio
Jens Axboe [Wed, 10 Jun 2020 01:42:35 +0000 (19:42 -0600)]
Merge branch 'client-leak-fix' of https://github.com/bvanassche/fio

* 'client-leak-fix' of https://github.com/bvanassche/fio:
  client: Fix another memory leak in an error path
  client: Fix a memory leak in an error path

3 years agoclient: Fix another memory leak in an error path
Bart Van Assche [Sat, 30 May 2020 22:09:00 +0000 (15:09 -0700)]
client: Fix another memory leak in an error path

Duplicate the hostname after if (...) goto err instead of before that check.
This was found by inspecting get_new_client() callers. It is not clear to me
why Coverity did not complain about this function.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoclient: Fix a memory leak in an error path
Bart Van Assche [Sat, 30 May 2020 21:58:34 +0000 (14:58 -0700)]
client: Fix a memory leak in an error path

This patch fixes the following Coverity complaint:

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

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agot/run-fio-tests.py: Accept a wider range of IOPS values
Bart Van Assche [Sun, 7 Jun 2020 19:11:04 +0000 (12:11 -0700)]
t/run-fio-tests.py: Accept a wider range of IOPS values

This patch prevents that test 11 sporadically fails as follows:

DEBUG:root:Test 11: return code: 0
DEBUG:root:Test 11: skipped 0 lines decoding JSON data
DEBUG:root:Test 11: iops1: 997.670549
DEBUG:root:Test 11: ratio: 8.163684

Test 11 FAILED:  iops value mismatch,

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoSwitch to Python3
Bart Van Assche [Sun, 7 Jun 2020 19:11:03 +0000 (12:11 -0700)]
Switch to Python3

Support for Python2.7 in Linux distributions is being phased out. As an
example, some Linux distributions do not provide Python2.7 versions of
some of the Python packages fio Python scripts relies on. Hence switch
to Python3. Most of the Python code changes in this patch have been
generated by running the Python scripts through 2to3, the Python2 to
Python3 converter from python.org.

Notes:
- Python is only used by fio test scripts and not by fio itself.
- Older versions of RHEL / CentOS 6 do not support Python3.
  Python3 binaries for RHEL 6 / CentOS 6 are available e.g. in the EPEL
  repository (https://fedoraproject.org/wiki/EPEL).

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoci/travis-install.sh, MacOS: Install the Python 'six' package
Vincent Fu [Sun, 7 Jun 2020 19:11:02 +0000 (12:11 -0700)]
ci/travis-install.sh, MacOS: Install the Python 'six' package

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
[bvanassche: edited commit message / only retained "pip install six" command /
 changed 'pip' into 'pip3']
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoci/travis-install.sh: Install python3-six package
Bart Van Assche [Sun, 7 Jun 2020 19:11:01 +0000 (12:11 -0700)]
ci/travis-install.sh: Install python3-six package

Additionally, report the Python3 path and version.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years ago.travis.yml: Move shell code out of .travis.yml
Bart Van Assche [Sun, 7 Jun 2020 19:11:00 +0000 (12:11 -0700)]
.travis.yml: Move shell code out of .travis.yml

Shell code in a .travis.yml file is hard to test. Make it easy to run the
shell code locally and to verify that code with shellcheck by moving the
shell code into separate files.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMakefile: include linux-blkzoned.c for Android, if set
Jens Axboe [Fri, 5 Jun 2020 13:06:46 +0000 (07:06 -0600)]
Makefile: include linux-blkzoned.c for Android, if set

Fixes: https://github.com/axboe/fio/issues/1008
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: Fix max_open_zones checks
Shin'ichiro Kawasaki [Wed, 27 May 2020 01:20:13 +0000 (10:20 +0900)]
zbd: Fix max_open_zones checks

Commit 219c662d3b12 ("zbd: introduce per job maximum open zones limit")
introduced job_max_open_zones option which limits the number of open
zones per job. It has similar role as max_open_zones option which limits
the number of open zones for all jobs. It was intended that these two
options both work, but the commit replaced some checks for max_open_zones
simply with checks for job_max_open_zones. Because of this, when
max_open_zones is set and job_max_open_zones is not set, fio fails to
limit the number of open zones. This resulted in test case #29 failure
of t/zbd/test-zbd-support script for regular null_blk devices.

To fix the failure, modify the checks to target both job_max_open_zones
and max_open_zones.

Fixes: 219c662d3b12 ("zbd: introduce per job maximum open zones limit")
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agogfio: don't have multiple versions of main_ui
Jens Axboe [Tue, 2 Jun 2020 14:20:03 +0000 (08:20 -0600)]
gfio: don't have multiple versions of main_ui

Also comment a fall-through case appropriately, so newer GCC
don't warn.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoengines: pvsync2 libaio io_uring: add support for RWF_NOWAIT
Konstantin Khlebnikov [Mon, 25 May 2020 17:29:22 +0000 (20:29 +0300)]
engines: pvsync2 libaio io_uring: add support for RWF_NOWAIT

Add bool option "nowait" into engines which could support this feature.

Add test for libaio >= 0.3.111 into configure script to be compatible with
prior versions where field iocb.aio_rw_flags was declared as "__pad2".

By default if a request cannot be executed immediately (e.g. resource starvation,
waiting on locks) it is queued and the initiating process will be blocked until
the required resource becomes free.

This option sets the RWF_NOWAIT flag (supported from the 4.14 Linux kernel) and
the call will return instantly with EAGAIN or a partial result rather than waiting.

It is useful to also use ignore_error=EAGAIN when using this option.

Note: glibc 2.27, 2.28 have a bug in syscall wrappers preadv2, pwritev2.
They return EOPNOTSUP instead of EAGAIN.

For cached I/O, using this option usually means a request operates only with
cached data. Currently the RWF_NOWAIT flag does not supported for cached write.

For direct I/O, requests will only succeed if cache invalidation isn't required,
file blocks are fully allocated and the disk request could be issued immediately.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Link: https://lwn.net/Articles/724631/
3 years agoMerge branch 'pshared1' of https://github.com/kusumi/fio
Jens Axboe [Fri, 29 May 2020 14:16:10 +0000 (08:16 -0600)]
Merge branch 'pshared1' of https://github.com/kusumi/fio

* 'pshared1' of https://github.com/kusumi/fio:
  pshared: fix comment on supported platforms

3 years agopshared: fix comment on supported platforms
Tomohiro Kusumi [Fri, 29 May 2020 14:08:34 +0000 (23:08 +0900)]
pshared: fix comment on supported platforms

FreeBSD supports it, but NetBSD/OpenBSD don't.

 # uname
 FreeBSD
 # ./configure | grep "POSIX pshared"
 POSIX pshared support         yes

 # uname
 NetBSD
 # ./configure | grep "POSIX pshared"
 POSIX pshared support         no

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
3 years agoMerge branch 'python3-testing' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 28 May 2020 19:27:15 +0000 (13:27 -0600)]
Merge branch 'python3-testing' of https://github.com/vincentkfu/fio

* 'python3-testing' of https://github.com/vincentkfu/fio:
  travis: install python3 scipy for Linux and macOS tests
  testing: change two test scripts to refer to python3

3 years agotravis: install python3 scipy for Linux and macOS tests
Vincent Fu [Thu, 28 May 2020 14:12:52 +0000 (10:12 -0400)]
travis: install python3 scipy for Linux and macOS tests

Since the test scripts triggered by TravisCI now all rely on python3,
make sure we always install scipy for python3.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agotesting: change two test scripts to refer to python3
Vincent Fu [Thu, 28 May 2020 13:05:06 +0000 (09:05 -0400)]
testing: change two test scripts to refer to python3

Since python2 is no longer supported we should now use python3 in our
test scripts. Change the shebang lines for two test scripts to refer to
python3.

Note that t/sgunmap-test.py and t/sgunmap-perf.py still refer to
python2.  I no longer have the means to test those two scripts and am
leaving those unchanged.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agoMerge branch 'testing' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 28 May 2020 17:07:31 +0000 (11:07 -0600)]
Merge branch 'testing' of https://github.com/vincentkfu/fio

* 'testing' of https://github.com/vincentkfu/fio:
  .travis: enable arm64 architecture builds
  t/run-fio-tests: pass-through arguments to test scripts
  appveyor: use on_finish section to upload artifacts

3 years ago.travis: enable arm64 architecture builds
Vincent Fu [Tue, 26 May 2020 20:55:58 +0000 (16:55 -0400)]
.travis: enable arm64 architecture builds

The travis-ci containers do not support the cmdprio_percentage option.
So skip latency_percentile.py tests using that option.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agot/run-fio-tests: pass-through arguments to test scripts
Vincent Fu [Tue, 26 May 2020 20:54:44 +0000 (16:54 -0400)]
t/run-fio-tests: pass-through arguments to test scripts

Add an option to pass-through arguments to specified test scripts. This
can be used to alter the behavior of tests on different platforms.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agoappveyor: use on_finish section to upload artifacts
Vincent Fu [Tue, 26 May 2020 17:22:38 +0000 (13:22 -0400)]
appveyor: use on_finish section to upload artifacts

We cannot rely on the artifacts section to upload test artifacts because
when a test failure occurs, the entire build process stops and the
artifacts are not uploaded. Use the on_finish section instead to upload
test artifacts.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agozbd: Fix compilation error on BSD
Shin'ichiro Kawasaki [Thu, 28 May 2020 12:56:42 +0000 (21:56 +0900)]
zbd: Fix compilation error on BSD

Commit b76949618d55 ("fio: Generalize zonemode=zbd") enabled zbd.c
compilation on other operating systems than Linux. This caused a
compilation error on NetBSD as follows:

ld: zbd.o: in function `parse_zone_info':
fio/zbd.c:422: undefined reference to `pthread_mutexattr_setpshared'
ld: zbd.o: in function `init_zone_info':
fio/zbd.c:378: undefined reference to `pthread_mutexattr_setpshared'
gmake: *** [Makefile:483: fio] Error 1

Same error is expected on other BSD OSes.

Fix this by initializing mutex using helper functions pshared.c provides.
To initialize mutex with POSIX_MUTEX_RECURSIVE attribute type, utilize
mutex_init_pshared_with_type().

Reported-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fixes: b76949618d55 ("fio: Generalize zonemode=zbd")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agopshared: Add mutex_init_pshared_with_type()
Shin'ichiro Kawasaki [Thu, 28 May 2020 12:56:41 +0000 (21:56 +0900)]
pshared: Add mutex_init_pshared_with_type()

To initialize mutex to be shared across processes, the helper function
mutex_init_pshared() is available. However, it does not allow to set
mutex attribute types such as POSIX_MUTEX_RECURSIVE.

To allow setting mutex attribute types, introduce another helper function
mutex_init_pshared_with_type(). It initialize mutex for sharing across
processes and set attribute types specified as its argument.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agot/zbd: make the test script easier to terminate
Dmitry Fomichev [Mon, 25 May 2020 21:32:56 +0000 (06:32 +0900)]
t/zbd: make the test script easier to terminate

Very often, it takes more than one ^C to terminate test-zbd-support
script. Just a single ^C does end the test that is currently being
executed, but then the script proceeds to the next test. This commit
adds a simple signal handler to exit the test loop after receiving
a Ctrl-C.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agot/zbd: beautify test script output
Dmitry Fomichev [Mon, 25 May 2020 21:32:55 +0000 (06:32 +0900)]
t/zbd: beautify test script output

The test printout columns are better aligned now. Also, the test
result, PASS/FAIL, is now color-coded and that makes it easier
to spot failures.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agolibzbc: fix whitespace errors
Dmitry Fomichev [Mon, 25 May 2020 21:32:54 +0000 (06:32 +0900)]
libzbc: fix whitespace errors

Make checkpatch happy... no functional change.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agolibzbc: cleanup init code
Dmitry Fomichev [Mon, 25 May 2020 21:32:53 +0000 (06:32 +0900)]
libzbc: cleanup init code

Make sure every allocated data structure gets freed in case of
unsuccessful libzbc ioengine initialization.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoclient: Make skipping option appending in handle_job_opt() more selective
Bart Van Assche [Fri, 7 Feb 2020 14:54:29 +0000 (06:54 -0800)]
client: Make skipping option appending in handle_job_opt() more selective

Instead of not appending an option to the option list if JSON output is
disabled, only skip appending an option to the JSON option list. See also
commit b127b679769c ("client: fix segfault for !json output").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoclient: Fix two memory leaks in handle_job_opt()
Bart Van Assche [Sun, 24 May 2020 20:35:54 +0000 (13:35 -0700)]
client: Fix two memory leaks in handle_job_opt()

Do not leak p if pdu->global != 0.

This is an improvement for a previous attempt to fix handle_job_opt(). See
also commit ebae36a28aee ("client: Fix memory leaks in handle_job_opt()").

Do not leak strdup(pdu->name) when calling json_object_add_value_string().
That function namely (indirectly) duplicates its 'name' argument.

This patch fixes the following Coverity complaint:

CID 169311 (#1 of 1): Resource leak (RESOURCE_LEAK)
9. leaked_storage: Variable p going out of scope leaks the storage it points to.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoMake json_object_add_value_string() duplicate its 'value' argument
Bart Van Assche [Sun, 24 May 2020 20:25:37 +0000 (13:25 -0700)]
Make json_object_add_value_string() duplicate its 'value' argument

Having some json_object_add_value_string() callers duplicate the 'value'
argument others not is dubious because it can lead to dangling pointers,
e.g. when passing strings to json_object_add_value_string() that live less
long than the created JSON object. See e.g. the 'time_buf' stack array that
is passed by fio_client_json_init() to json_object_add_value_string().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoMerge branch 'parse-and-fill-pattern' of https://github.com/bvanassche/fio
Jens Axboe [Sun, 24 May 2020 18:03:56 +0000 (12:03 -0600)]
Merge branch 'parse-and-fill-pattern' of https://github.com/bvanassche/fio

* 'parse-and-fill-pattern' of https://github.com/bvanassche/fio:
  Do not read past the end of fmt_desc[]
  Declare a static variable 'const'
  Fix spelling in a source code comment

3 years agoDo not read past the end of fmt_desc[]
Bart Van Assche [Sun, 24 May 2020 03:39:47 +0000 (20:39 -0700)]
Do not read past the end of fmt_desc[]

Callers of parse_format() pass a size in bytes while the parse_format()
function itself expects a number of elements. Fix this by making the
fmt_desc[] array NULL-terminated. This patch fixes the following Coverity
complaint:

CID 300986 (#1 of 1): Out-of-bounds access (OVERRUN)
overrun-buffer-arg: Overrunning array fmt_desc of 1 24-byte elements by
passing it to a function which accesses it at element index 23 (byte
offset 575) using argument 24U.

Cc: Roman Pen <r.peniaev@gmail.com>
Fixes: 634bd210c17a ("lib/pattern: add set of functions to parse combined pattern input")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoDeclare a static variable 'const'
Bart Van Assche [Sun, 24 May 2020 03:30:17 +0000 (20:30 -0700)]
Declare a static variable 'const'

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoFix spelling in a source code comment
Bart Van Assche [Sun, 24 May 2020 03:28:21 +0000 (20:28 -0700)]
Fix spelling in a source code comment

Change two occurrences of 'descritor' into 'descriptor'

Cc: Roman Pen <r.peniaev@gmail.com>
Fixes: 634bd210c17a ("lib/pattern: add set of functions to parse combined pattern input")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3 years agoFio 3.20 fio-3.20
Jens Axboe [Sat, 23 May 2020 17:14:14 +0000 (11:14 -0600)]
Fio 3.20

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge branch 'master' of https://github.com/ffontaine/fio
Jens Axboe [Sat, 23 May 2020 17:13:25 +0000 (11:13 -0600)]
Merge branch 'master' of https://github.com/ffontaine/fio

* 'master' of https://github.com/ffontaine/fio:
  Makefile: fix build of io_uring on sh4

3 years agoMakefile: fix build of io_uring on sh4
Fabrice Fontaine [Sat, 23 May 2020 17:07:40 +0000 (19:07 +0200)]
Makefile: fix build of io_uring on sh4

SuperH compile currently fails with:

/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sh4-buildroot-linux-uclibc/8.3.0/../../../../sh4-buildroot-linux-uclibc/bin/ld: t/io_uring.o: in function `submitter_fn':
/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/build/fio-3.19/t/io_uring.c:131: undefined reference to `arch_flags'
/usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/host/opt/ext-toolchain/bin/../lib/gcc/sh4-buildroot-linux-uclibc/8.3.0/../../../../sh4-buildroot-linux-uclibc/bin/ld: /usr/lfs/hdd_v1/rc-buildroot-test/scripts/instance-0/output-1/build/fio-3.19/t/io_uring.c:367: undefined reference to `arch_flags'
collect2: error: ld returned 1 exit status

Fix that by ensuring we have a stub arch.o with the necessary arch flags

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3 years agozbd: make zbd_info->mutex non-recursive
Alexey Dobriyan [Thu, 21 May 2020 23:17:16 +0000 (02:17 +0300)]
zbd: make zbd_info->mutex non-recursive

There is no reason for it to be recursive. Resursiveness leaked
from struct fio_zone_info::mutex initialisation.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: introduce per job maximum open zones limit
Alexey Dobriyan [Thu, 21 May 2020 23:17:15 +0000 (02:17 +0300)]
zbd: introduce per job maximum open zones limit

It is not possible to maintain sustained per-thread iodepth in ZBD mode.
The way code is written, "max_open_zones" acts as a global limit, and
once one or few threads open all "max_open_zones" zones, other threads
can't open anything and _exit_ prematurely.

This config is guaranteed to make equal number of zone resets/IO now:
each thread generates identical pattern and doesn't intersect with other
threads:

zonemode=zbd
zonesize=...
rw=write

numjobs=N
offset_increment=M*zonesize

[j]
size=M*zonesize

Patch introduces "job_max_open_zones" which is per-thread/process limit.
"max_open_zones" remains per file/device limit. Both limits are checked
for each open zone so one thread can't kick out others.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: don't lock zones outside working area
Alexey Dobriyan [Thu, 21 May 2020 23:17:14 +0000 (02:17 +0300)]
zbd: don't lock zones outside working area

Currently threads lock each other zones even if their working areas as
defined by [f->file_offset, f->file_offset + f->io_size) don't intersect.
This leads to unnecessary quiescing.

Patch clamps every zone to [->min_zone, ->max_zone) when doing search
for opened zone and more importantly adds an assert so that any
unnecessary zone locking becomes very visible.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: bump ZBD_MAX_OPEN_ZONES
Alexey Dobriyan [Thu, 21 May 2020 23:17:13 +0000 (02:17 +0300)]
zbd: bump ZBD_MAX_OPEN_ZONES

128 opened zones is not enough for us!

4096 opened zones is OK for 64×iodepth=64 stress testing.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoverify: decouple seed generation from buffer fill
Alexey Dobriyan [Thu, 21 May 2020 23:17:12 +0000 (02:17 +0300)]
verify: decouple seed generation from buffer fill

It is nicer this way and there will be more code in this area
with ZBD verification.

Signed-off-by: Alexey Dobriyan (SK hynix) <adobriyan@gmail.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge branch 'latency_run' of https://github.com/liu-song-6/fio
Jens Axboe [Thu, 21 May 2020 14:36:07 +0000 (08:36 -0600)]
Merge branch 'latency_run' of https://github.com/liu-song-6/fio

* 'latency_run' of https://github.com/liu-song-6/fio:
  Add option latency_run to continue enable latency_target

3 years agoMerge branch 'testing' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 20 May 2020 20:19:12 +0000 (14:19 -0600)]
Merge branch 'testing' of https://github.com/vincentkfu/fio

* 'testing' of https://github.com/vincentkfu/fio:
  t/zbd: improve error handling for test scripts
  testing: use max-jobs to speed up testing
  docs: update cmdprio_percentage with note about root user
  t/latency_percentiles: run cmdprio_percentage tests only if root
  t/run-fio-tests: better catch file errors
  t/jsonplus2csv_test: reduce file size

3 years agot/zbd: improve error handling for test scripts
Vincent Fu [Tue, 19 May 2020 18:55:56 +0000 (14:55 -0400)]
t/zbd: improve error handling for test scripts

Use exit instead of return to abort the scripts if modprobe null_blk
fails. With return, the script continues to run after printing an error
message. Also abort if the null block device setup fails for the regular
null block device test script.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agotesting: use max-jobs to speed up testing
Vincent Fu [Mon, 18 May 2020 18:14:12 +0000 (14:14 -0400)]
testing: use max-jobs to speed up testing

Allocating fio's default memory footprint takes a few moments. Following
https://www.spinics.net/lists/fio/msg08529.html, use the max-jobs option
to reduce fio's memory footprint. This reduces the runtime of the full
test suite by about 40s.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agodocs: update cmdprio_percentage with note about root user
Vincent Fu [Mon, 18 May 2020 17:50:53 +0000 (13:50 -0400)]
docs: update cmdprio_percentage with note about root user

The io_uring/libaio cmdprio_percentage option can only be used when fio
is run from the root user account because IOs are submitted with IO
priority class IOPRIO_CLASS_RT. Note in the documentation that fio must
be run from the root account to use this option.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agoMerge branch 'issue-989' of https://github.com/Nordix/fio
Jens Axboe [Wed, 20 May 2020 13:06:43 +0000 (07:06 -0600)]
Merge branch 'issue-989' of https://github.com/Nordix/fio

* 'issue-989' of https://github.com/Nordix/fio:
  Corrected scope of for-loop

3 years agoCorrected scope of for-loop
Lars Ekman [Wed, 20 May 2020 09:27:11 +0000 (11:27 +0200)]
Corrected scope of for-loop

Fixes #989 - fio2gnuplot dont generate clat (raw) plots

Signed-off-by: Lars Ekman <lars.g.ekman@est.tech>
3 years agoMerge branch '32-bit-fixes' of https://github.com/sitsofe/fio
Jens Axboe [Tue, 19 May 2020 22:14:19 +0000 (16:14 -0600)]
Merge branch '32-bit-fixes' of https://github.com/sitsofe/fio

* '32-bit-fixes' of https://github.com/sitsofe/fio:
  Fix 32-bit/LLP64 platform truncation issues

3 years agoFix 32-bit/LLP64 platform truncation issues
Sitsofe Wheeler [Tue, 19 May 2020 21:41:49 +0000 (22:41 +0100)]
Fix 32-bit/LLP64 platform truncation issues

- After 140a6888 ("rate: Convert the rate and rate_min options to
  FIO_OPTS_ULL") landed 32-bit/LLP64 platforms need additional changes
  to cope with 64 bit I/O rate values
- The seed is 64 bit but was being being truncated to 32 bits in
  td_fill_rand_seeds_internal() on bit/LLP64 platforms

Prior to this commit when running an fio compiled with

CC=clang-9 ./configure \
  --extra-cflags="-fsanitize=undefined,implicit-integer-truncation "
  "-fno-builtin"

using this job

./fio --ioengine=null --bs=1M --rate=6G --rate_min=5G --name=test --size=100G

warnings like the following were produced

init.c:996:27: runtime error: implicit conversion from type 'uint64_t' (aka 'unsigned long long') of value 5942511153023025289 (64-bit, unsigned) to type 'unsigned int' changed the value to 2914779273 (32-bit, unsigned)
[..]
backend.c:212:25: runtime error: implicit conversion from type 'unsigned long long' of value 12886999040 (64-bit, unsigned) to type 'unsigned long' changed the value to 2097152 (32-bit, unsigned)

inside a 32-bit Ubuntu 18.04 docker container.

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

3 years agoAdd option latency_run to continue enable latency_target
Song Liu [Mon, 18 May 2020 05:39:49 +0000 (22:39 -0700)]
Add option latency_run to continue enable latency_target

Currently, latency_target run will exist once fio find the highest queue
depth that meets latency_target. Add option latency_run. If set, fio will
continue running and try to meet latency_target by adusting queue depth.

Signed-off-by: Song Liu <songliubraving@fb.com>
3 years agoinit: fix unit of latency_window
Song Liu [Mon, 18 May 2020 05:46:21 +0000 (22:46 -0700)]
init: fix unit of latency_window

latency_window has unit of microseconds, and is compared against
usec_window. Therefore, there is no need to fix it up to nanoseconds.

Signed-off-by: Song Liu <songliubraving@fb.com>
3 years agoMerge branch 'stephen/rate-ull' of https://github.com/sbates130272/fio
Jens Axboe [Tue, 19 May 2020 18:31:49 +0000 (12:31 -0600)]
Merge branch 'stephen/rate-ull' of https://github.com/sbates130272/fio

* 'stephen/rate-ull' of https://github.com/sbates130272/fio:
  rate: Convert the rate and rate_min options to FIO_OPTS_ULL

3 years agoAllow more flexibility in zone start and span
Pierre Labat [Fri, 15 May 2020 16:22:13 +0000 (11:22 -0500)]
Allow more flexibility in zone start and span

Allow sequential read to start anywhere in a zone (option
offset), and have a span smaller than a zone (option size).

A use case is a Key Value Store reading a set of keys or values
starting somewhere in a zone.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Pierre Labat <plabat@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agot/latency_percentiles: run cmdprio_percentage tests only if root
Vincent Fu [Mon, 18 May 2020 17:41:52 +0000 (13:41 -0400)]
t/latency_percentiles: run cmdprio_percentage tests only if root

The libaio/io_uring cmdprio_percentage option only works when fio is run
from the root user account. Skip these tests (instead of failing) when
this test script is run from a regular user account.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agot/run-fio-tests: better catch file errors
Vincent Fu [Mon, 18 May 2020 14:26:21 +0000 (10:26 -0400)]
t/run-fio-tests: better catch file errors

Handle file not found errors more gracefully. Make sure we always catch
exceptions when opening files so that we can fail gracefully when
problems occur.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agot/jsonplus2csv_test: reduce file size
Vincent Fu [Mon, 18 May 2020 14:06:42 +0000 (10:06 -0400)]
t/jsonplus2csv_test: reduce file size

Reduce the file size to better accommodate testing on low-powered
devices. Also add a comment about the ionegine choice.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
3 years agot/zbd: Use max-jobs=16 option
Damien Le Moal [Fri, 8 May 2020 07:56:45 +0000 (16:56 +0900)]
t/zbd: Use max-jobs=16 option

Use max-jobs option to reduce memory usage and speedup execution of
test-zbd-support.

With --max-jobs=16, twice the largest number of jobs used in all test
cases, the execution time of test-zbd-support against a zoned nullblk
device is lowered from 64s to 41s on a laptop.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoio_u: Optimize set_rw_ddir()
Damien Le Moal [Fri, 8 May 2020 07:56:44 +0000 (16:56 +0900)]
io_u: Optimize set_rw_ddir()

There is no need to execute zbd_adjust_ddir() for a job that is not
using zonemode=zbd. So move the job mode test out of zbd_adjust_ddir()
and conditionally execute this function by first testing the job mode
in set_rw_ddir().

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: Rename zbd_init()
Damien Le Moal [Fri, 8 May 2020 07:56:43 +0000 (16:56 +0900)]
zbd: Rename zbd_init()

Clarify the execution context of zbd_init() by renaming this function
to zbd_setup_files() as it is called from the setup_files() function.
While at it, wrap the use of zbd_free_zone_info() into the inline
function zbd_close_file() to avoid an unecessary function call when
closing files that are not zoned block device files of zonemode=zbd
jobs, that is, files that do not have zbd_info initialized.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: Optimize zbd_file_reset()
Damien Le Moal [Fri, 8 May 2020 07:56:42 +0000 (16:56 +0900)]
zbd: Optimize zbd_file_reset()

For a job not writing, a device zones will not be reset by executing
zbc_file_reset() so there is no need to scan all zones of the job
operating range. Avoid this overhead by returning early for jobs that
are not writing.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: Fix read with verify
Damien Le Moal [Fri, 8 May 2020 07:56:41 +0000 (16:56 +0900)]
zbd: Fix read with verify

For a read only workload with verify option enabled, executing
zbd_replay_write_order() will ignore target zones that are full and try
to open another zone. This either triggers an assert if max_open_zones
is unused, or result in verify failing. Fix this by executing
zbd_replay_write_order() only for writing workloads. This fix is also
consistent with the fact that zoned devices do not implicitly open
zones for read operations.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agozbd: Fix potential deadlock on read operations
Damien Le Moal [Fri, 8 May 2020 07:56:40 +0000 (16:56 +0900)]
zbd: Fix potential deadlock on read operations

For read-only workloads, zbd_find_zone() has a similar zone locking
behavior as for write IOs: zones to be read are locked when an IO is
prepared and unlocked when the IO completes. With an asynchronous IO
engine, this can create deadlocks if 2 threads are trying to read the
same 2 zones. For instance, if thread A already has a lock on zone 1
and is waiting for a lock on zone 2 while thread B already has a lock
on zone 2 and waiting for a lock on zone 1.

The fix is similar to previous fixes for this potential deadlock,
namely, use zone_lock() instead of directly calling pthread_mutex_lock()
to ensure that a thread issues the IOs it already has prepared if it
encounters a locked zone, doing so ensuring forward progress.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
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 agorate: Convert the rate and rate_min options to FIO_OPTS_ULL
Stephen Bates [Fri, 8 May 2020 14:14:49 +0000 (08:14 -0600)]
rate: Convert the rate and rate_min options to FIO_OPTS_ULL

In many high-performance systems today it is possible to exceed 4GiB/s
throughput. Therefore convert the rate and rate_min options from
FIO_OPTS_INT to FIO_OPTS_ULL.

Fixes #716.

Signed-off-by: Stephen Bates <sbates@raithlin.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