fio.git
4 years agoWindows: Uninline CPU affinity functions
Bart Van Assche [Mon, 6 Jan 2020 04:17:41 +0000 (20:17 -0800)]
Windows: Uninline CPU affinity functions

None of the CPU affinity functions is in the hot path. Reduce the build
time by uninlining these functions.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoWindows: Use snprintf() instead of StringCch*()
Bart Van Assche [Mon, 6 Jan 2020 01:51:19 +0000 (17:51 -0800)]
Windows: Use snprintf() instead of StringCch*()

Use ANSI C functions instead of Windows-specific functions.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoInclude "oslib/asprintf.h" where necessary
Bart Van Assche [Sun, 5 Jan 2020 21:37:48 +0000 (13:37 -0800)]
Include "oslib/asprintf.h" where necessary

The header file "oslib/asprintf.h" must be included by every source file
that calls asprintf().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoWindows: Remove more unused OS dependent code
Bart Van Assche [Sun, 5 Jan 2020 19:40:36 +0000 (11:40 -0800)]
Windows: Remove more unused OS dependent code

Since commit 46bfd4e5170e ("Remove old OS dependent (unused) random code")
rand_r() is no longer used. Hence remove its definition.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoChange off64_t into uint64_t
Bart Van Assche [Sun, 5 Jan 2020 19:10:30 +0000 (11:10 -0800)]
Change off64_t into uint64_t

off64_t is Linux specific while uint64_t is defined by a C standard. This
change makes fio easier to port.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoFix the build in case FIO_HAVE_DISK_UTIL is not defined
Bart Van Assche [Mon, 6 Jan 2020 16:47:17 +0000 (08:47 -0800)]
Fix the build in case FIO_HAVE_DISK_UTIL is not defined

This patch fixes the following build error:

stat.c: In function 'show_thread_status_terse_all':
stat.c:1243:31: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
   show_disk_util(1, NULL, out);
                               ^

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoWindows: Fix multiple configure tests
Bart Van Assche [Mon, 6 Jan 2020 15:21:14 +0000 (07:21 -0800)]
Windows: Fix multiple configure tests

Auto-detect whether socklen_t, gettimeofday(), TCP_NODELAY and IPv6 are
supported instead of hard-coding that these are supported.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoconfigure: Improve the getopt_long_only() test
Bart Van Assche [Mon, 6 Jan 2020 19:00:24 +0000 (11:00 -0800)]
configure: Improve the getopt_long_only() test

Fix the following build error if configure is invoked with
--extra-cflags=-Werror:

/tmp/fio-conf-20209-133775-26866.c: In function 'main':
/tmp/fio-conf-20209-133775-26866.c:6:11: error: null argument where non-null required (argument 3) [-Werror=nonnull]
   int c = getopt_long_only(argc, argv, NULL, NULL, NULL);
           ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoconfigure: Improve the ibverbs test
Bart Van Assche [Mon, 6 Jan 2020 18:55:48 +0000 (10:55 -0800)]
configure: Improve the ibverbs test

This patch fixes the following configure test build error if configure is
invoked with --extra-cflags=-Werror:

/tmp/fio-conf-14710-130227-4466.c: In function 'main':
/tmp/fio-conf-14710-130227-4466.c:4:18: error: unused variable 'pd' [-Werror=unused-variable]
   struct ibv_pd *pd = ibv_alloc_pd(NULL);
                  ^~
cc1: all warnings being treated as errors

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMakefile: Use 'tr' if 'fmt' is not available
Bart Van Assche [Mon, 6 Jan 2020 02:16:54 +0000 (18:16 -0800)]
Makefile: Use 'tr' if 'fmt' is not available

NetBSD is not the only OS that does not provide 'fmt'. A native MinGW shell
does not provide 'fmt' either. Hence detect at runtime whether or not 'fmt'
is available.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMakefile: Avoid duplicating code
Bart Van Assche [Mon, 6 Jan 2020 02:16:20 +0000 (18:16 -0800)]
Makefile: Avoid duplicating code

Use the default compilation rule for building init.o instead of duplicating
it.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMerge branch 'master' of https://github.com/vincentkfu/fio
Jens Axboe [Mon, 6 Jan 2020 17:46:26 +0000 (10:46 -0700)]
Merge branch 'master' of https://github.com/vincentkfu/fio

* 'master' of https://github.com/vincentkfu/fio:
  t/steadystate_tests: relax acceptance criterion
  t/run-fio-tests: automatically skip t/jobs/t0005 on Windows

4 years agot/steadystate_tests: relax acceptance criterion
Vincent Fu [Fri, 20 Dec 2019 19:52:12 +0000 (14:52 -0500)]
t/steadystate_tests: relax acceptance criterion

Relax the acceptance criterion for tests that do not attain steady
state. Originally, only a 10ms difference between expected and actual
runtime was allowed. Change this to 50ms. I observed a spurious failure
where a test ran for 10017ms instead of the expected 10000ms.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agot/run-fio-tests: automatically skip t/jobs/t0005 on Windows
Vincent Fu [Thu, 12 Dec 2019 22:31:14 +0000 (15:31 -0700)]
t/run-fio-tests: automatically skip t/jobs/t0005 on Windows

t0005 uses direct IO with a sync ioengine which is not supported under
Windows. Automatically skip this test when run-fio-tests is run under
Windows.

With this change we no longer need to skip test 5 in the appveyor setup.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoMerge branch 'json1' of https://github.com/kusumi/fio
Jens Axboe [Mon, 6 Jan 2020 15:22:38 +0000 (08:22 -0700)]
Merge branch 'json1' of https://github.com/kusumi/fio

* 'json1' of https://github.com/kusumi/fio:
  json: remove two redundant json_print_array() prototypes

4 years agojson: remove two redundant json_print_array() prototypes
Tomohiro Kusumi [Mon, 6 Jan 2020 15:04:47 +0000 (00:04 +0900)]
json: remove two redundant json_print_array() prototypes

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agoMerge branch 'memalign1' of https://github.com/kusumi/fio
Jens Axboe [Sun, 5 Jan 2020 17:31:40 +0000 (10:31 -0700)]
Merge branch 'memalign1' of https://github.com/kusumi/fio

* 'memalign1' of https://github.com/kusumi/fio:
  lib/memalign: remove smalloc()/sfree() dependency

4 years agolib/memalign: remove smalloc()/sfree() dependency
Tomohiro Kusumi [Sun, 5 Jan 2020 15:01:10 +0000 (00:01 +0900)]
lib/memalign: remove smalloc()/sfree() dependency

fio_memalign()/fio_memfree() implementation shouldn't depend on
smalloc()/sfree() which has dependency on fio code itself.
e.g. This forces unittest code to prepare stab functions for
smalloc()/sfree().

This smalloc()/sfree() dependency was added by 3114b675fd
("fio: enable cross-thread overlap checking with processes").

Rename fio_memalign()/fio_memfree() to __fio_memalign()/__fio_memfree()
and take a function pointer instead of a boolean flag.
Add fio_memalign()/fio_memfree() as an inlined wrapper for
__fio_memalign()/__fio_memfree() without API change.
The only real change here is lib/memalign functions got renamed.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Sun, 5 Jan 2020 03:22:16 +0000 (20:22 -0700)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  t/read-to-pipe-async: Complain if option -f is specified multiple times
  t/memlock: Free allocated memory
  helper_thread: Complain if select() fails
  Block signals for the helper thread

4 years agot/read-to-pipe-async: Complain if option -f is specified multiple times
Bart Van Assche [Sat, 4 Jan 2020 22:10:47 +0000 (14:10 -0800)]
t/read-to-pipe-async: Complain if option -f is specified multiple times

This patch fixes the following Coverity complaint:

CID 280676:  Resource leaks  (RESOURCE_LEAK)
Overwriting "file" in "file = strdup(optarg)" leaks the storage that "file"
points to.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agot/memlock: Free allocated memory
Bart Van Assche [Sat, 4 Jan 2020 22:07:54 +0000 (14:07 -0800)]
t/memlock: Free allocated memory

This patch fixes the following Coverity complaint:

CID 280679:  Resource leaks  (RESOURCE_LEAK)
Variable "buf" going out of scope leaks the storage it points to.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agohelper_thread: Complain if select() fails
Bart Van Assche [Sat, 4 Jan 2020 21:59:02 +0000 (13:59 -0800)]
helper_thread: Complain if select() fails

This patch suppresses the following Coverity complaint:

CID 280687:  Error handling issues  (CHECKED_RETURN)
Calling "select(1, &rfds, NULL, &efds, &timeout)" without checking return
value. This library function may fail and return an error code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoBlock signals for the helper thread
Bart Van Assche [Sat, 4 Jan 2020 21:58:52 +0000 (13:58 -0800)]
Block signals for the helper thread

Let another thread than the helper thread handle signals. This simplifies
error handling. As an example, the next patch will check the return value
of select() and won't have to check for EINTR due to this patch.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Sat, 4 Jan 2020 17:44:20 +0000 (10:44 -0700)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  Fix a potential deadlock in helper_do_stat()
  Handle helper_thread_create() failures properly

4 years agoFix a potential deadlock in helper_do_stat()
Bart Van Assche [Fri, 3 Jan 2020 19:35:22 +0000 (11:35 -0800)]
Fix a potential deadlock in helper_do_stat()

pthread_mutex_lock(), pthread_cond_signal() and pthread_mutex_unlock() are
not async-signal-safe and hence must not be used inside a singal handler
implementation. Rework the code for communication with the helper thread
such that it becomes async-signal-safe.

Compared to commit 31eca641ad91, tests for the pipe() and pipe2() system
calls have been added and a pipe simulation for Windows has been added
(pipe_over_localhost()).

Fixes: a47591e4923f ("Improve logging accuracy")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoHandle helper_thread_create() failures properly
Bart Van Assche [Fri, 3 Jan 2020 21:21:53 +0000 (13:21 -0800)]
Handle helper_thread_create() failures properly

Report helper_thread_create() failures. Make sure that no crash occurs
if helper_thread_create() fails.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Sat, 4 Jan 2020 04:00:17 +0000 (21:00 -0700)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  Improve the pthread_condattr_setclock() test
  Only build t/read-to-pipe-async if pread() is available
  .appveyor.yml: Convert to ASCII

4 years agoImprove the pthread_condattr_setclock() test
Bart Van Assche [Fri, 3 Jan 2020 20:52:47 +0000 (12:52 -0800)]
Improve the pthread_condattr_setclock() test

Link with the pthread library if pthread_condattr_setclock() is not an
inline function.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoOnly build t/read-to-pipe-async if pread() is available
Bart Van Assche [Fri, 3 Jan 2020 20:41:33 +0000 (12:41 -0800)]
Only build t/read-to-pipe-async if pread() is available

Reported-by: Vincent Fu <vincent.fu@wdc.com>
Fixes: 5ad80fa7cf5b ("Makefile: Build more test code")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years ago.appveyor.yml: Convert to ASCII
Bart Van Assche [Fri, 3 Jan 2020 21:09:34 +0000 (13:09 -0800)]
.appveyor.yml: Convert to ASCII

Change a single character in a comment from UTF-8 into ASCII.

Fixes: a2b3cb65a9d3 ("appveyor: minor refactoring, clarifications")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMerge branch 'master' of https://github.com/kenbarr1/fio
Jens Axboe [Sat, 4 Jan 2020 00:15:31 +0000 (17:15 -0700)]
Merge branch 'master' of https://github.com/kenbarr1/fio

* 'master' of https://github.com/kenbarr1/fio:
  io_u: fix rate limiting to handle file wrap-around

4 years agoio_u: fix rate limiting to handle file wrap-around
Ken Barr [Fri, 3 Jan 2020 20:11:44 +0000 (15:11 -0500)]
io_u: fix rate limiting to handle file wrap-around

When using "rate" with "time_based", the amount of time to sleep should be based
on the invocation time (epoch) rather than the start time of a given loop
(start) because no other statistics are reset when a file is re-opened.
Prior to this change, a wrap-around would cause the rate_ddir code to compute
that ~0 time had elapsed since the last I/O (i.e., a near-infinite rate), and
trigger a very long sleep in an attempt to adjust to the given rate.

Testing done:
  Using configuration below...
    Before: starts at 100 MB/sec and drops to 0 after ~10 sec (upon wrap) before
    recovering at t ~ 20.
    After: maintains 100 MB/sec for the duration of the test

  [repro]
  # 1 GiB + 1 Byte, to force a fill_io_u failure, the file to close and
  # reopen, and the start timestamp to reset.
  size=1073741825
  bs=2097152
  direct=1
  ioengine=psync
  readwrite=write

  runtime=30s
  time_based
  rate=100m

  filename=data_file

4 years agoRevert "Fix a potential deadlock in helper_do_stat()"
Jens Axboe [Fri, 3 Jan 2020 19:32:07 +0000 (12:32 -0700)]
Revert "Fix a potential deadlock in helper_do_stat()"

This reverts commit 31eca641ad91634e5ffcf369cd756b0506a700c1.

Killing this for now as it breaks the Windows build.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Fri, 3 Jan 2020 19:20:41 +0000 (12:20 -0700)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  Fix a potential deadlock in helper_do_stat()
  t/read-to-pipe-async: Use the monotonic clock when measuring time intervals
  Use CLOCK_MONOTONIC for condition variables used by pthread_cond_timedwait()
  Makefile: Build more test code
  Suppress a Coverity taint warning in check_status_file()
  Micro-optimize __load_ioengine()

4 years agoMerge branch 'unit1' of https://github.com/kusumi/fio
Jens Axboe [Fri, 3 Jan 2020 19:19:10 +0000 (12:19 -0700)]
Merge branch 'unit1' of https://github.com/kusumi/fio

* 'unit1' of https://github.com/kusumi/fio:
  unittests: add unittest suite for oslib/strsep.c
  unittests: add unittest suite for oslib/strcasestr.c

4 years agoFix a potential deadlock in helper_do_stat()
Bart Van Assche [Tue, 31 Dec 2019 17:37:55 +0000 (09:37 -0800)]
Fix a potential deadlock in helper_do_stat()

pthread_mutex_lock(), pthread_cond_signal() and pthread_mutex_unlock() are
not async-signal-safe and hence must not be used inside a singal handler
implementation. Rework the code for communication with the helper thread
such that it becomes async-signal-safe.

Fixes: a47591e4923f ("Improve logging accuracy")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agot/read-to-pipe-async: Use the monotonic clock when measuring time intervals
Bart Van Assche [Wed, 1 Jan 2020 23:01:53 +0000 (15:01 -0800)]
t/read-to-pipe-async: Use the monotonic clock when measuring time intervals

Make the output independent of wall clock changes applied by e.g. ntpd.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoUse CLOCK_MONOTONIC for condition variables used by pthread_cond_timedwait()
Bart Van Assche [Wed, 1 Jan 2020 00:23:32 +0000 (16:23 -0800)]
Use CLOCK_MONOTONIC for condition variables used by pthread_cond_timedwait()

This patch ensures that the time during which pthread_cond_timedwait()
waits is not affected by wall clock adjustments by e.g. ntpd.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMakefile: Build more test code
Bart Van Assche [Wed, 1 Jan 2020 22:23:53 +0000 (14:23 -0800)]
Makefile: Build more test code

Build the t/io_uring, t/memlock and t/read-to-pipe-async executables if
'make all' is executed. Do not include t/time-test because it uses a
non-portable 128-bit integer type.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoSuppress a Coverity taint warning in check_status_file()
Bart Van Assche [Tue, 31 Dec 2019 17:35:10 +0000 (09:35 -0800)]
Suppress a Coverity taint warning in check_status_file()

Suppress the following Coverity complaint:

CID 24143 (#1 of 1): Use of untrusted string value (TAINTED_STRING)
tainted_string: Passing tainted string fio_status_file_path to unlink, which
cannot accept tainted data.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoMicro-optimize __load_ioengine()
Bart Van Assche [Wed, 1 Jan 2020 00:31:26 +0000 (16:31 -0800)]
Micro-optimize __load_ioengine()

Instead of copying the I/O engine name, use a pointer to the I/O engine
name. This patch suppresses the following false positive Valgrind complaint:

Conditional jump or move depends on uninitialised value(s)
   at 0x41D451: __load_ioengine (ioengines.c:133)
   by 0x41D451: load_ioengine (ioengines.c:161)
   by 0x41FA59: ioengine_load (init.c:1126)
   by 0x423B64: parse_cmd_line (init.c:2670)
   by 0x4241A3: parse_options (init.c:2965)
   by 0x40F587: main (fio.c:42)

The code for copying I/O engine names was introduced by commit 2866c82d598e
("[PATCH] Separate io engines into separate loadable objects").

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
4 years agoio_uring: Enable io_uring ioengine on aarch64 arch
Zhenyu Ye [Wed, 25 Dec 2019 15:02:57 +0000 (08:02 -0700)]
io_uring: Enable io_uring ioengine on aarch64 arch

This patch enables io_uring ioengine on aarch64 arch.

Signed-off-by: Zhenyu Ye <yezhenyu2@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoio_uring: add option for non-vectored read/write commands
Jens Axboe [Mon, 23 Dec 2019 15:54:25 +0000 (08:54 -0700)]
io_uring: add option for non-vectored read/write commands

Also syncs io_uring.h with the kernel 5.6 version.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agounittests: add unittest suite for oslib/strsep.c
Tomohiro Kusumi [Sun, 22 Dec 2019 05:26:25 +0000 (14:26 +0900)]
unittests: add unittest suite for oslib/strsep.c

See b8b0e1eea7780a02ff67f0caeba446cc403f1b37
("unittests: add CUnit based unittest framework") for usage.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agounittests: add unittest suite for oslib/strcasestr.c
Tomohiro Kusumi [Sat, 21 Dec 2019 16:46:28 +0000 (01:46 +0900)]
unittests: add unittest suite for oslib/strcasestr.c

See b8b0e1eea7780a02ff67f0caeba446cc403f1b37
("unittests: add CUnit based unittest framework") for usage.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agoMerge branch 'doc_fixes' of https://github.com/sitsofe/fio
Jens Axboe [Sat, 21 Dec 2019 14:04:58 +0000 (07:04 -0700)]
Merge branch 'doc_fixes' of https://github.com/sitsofe/fio

* 'doc_fixes' of https://github.com/sitsofe/fio:
  doc: fix up sphinx warnings
  HOWTO: fix up broken formatting in registerfiles section
  doc: stop saying backslashes need escaping

4 years agoMerge branch 'travis' of https://github.com/sitsofe/fio
Jens Axboe [Sat, 21 Dec 2019 14:04:34 +0000 (07:04 -0700)]
Merge branch 'travis' of https://github.com/sitsofe/fio

* 'travis' of https://github.com/sitsofe/fio:
  travis: switch to ubuntu 18.04 and install more libraries
  travis: remove duplicate xcode image and add comments

4 years agodoc: fix up sphinx warnings
Sitsofe Wheeler [Sat, 21 Dec 2019 09:53:19 +0000 (09:53 +0000)]
doc: fix up sphinx warnings

- Reference to merge-blktrace-only needs the leading dashes to work
  (seemingly because it takes no parameters?)
- Nothing seems to be html_static_path, we don't have an _static dir and
  it generates a warning "html_static_path entry '_static' does not
  exist" so disable it for now

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agoHOWTO: fix up broken formatting in registerfiles section
Sitsofe Wheeler [Sat, 21 Dec 2019 09:17:50 +0000 (09:17 +0000)]
HOWTO: fix up broken formatting in registerfiles section

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agodoc: stop saying backslashes need escaping
Sitsofe Wheeler [Wed, 30 Oct 2019 06:14:12 +0000 (06:14 +0000)]
doc: stop saying backslashes need escaping

In 02dd2689885c6d64d9d01a92e67d40f73c0afc72 ("HOWTO: update directory
and filename option descriptions") I added a change that stated that
backslashes needed escaping too but this is not (and never has been) the
case. Fix this thinko by removing all mentions of backslash escaping
being needed from the documentation.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agotravis: switch to ubuntu 18.04 and install more libraries
Sitsofe Wheeler [Sat, 5 Oct 2019 14:18:38 +0000 (15:18 +0100)]
travis: switch to ubuntu 18.04 and install more libraries

Also sort the package dependencies into alphabetical order to make it
easier to see what has changed in the future.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agotravis: remove duplicate xcode image and add comments
Sitsofe Wheeler [Sat, 5 Oct 2019 13:36:48 +0000 (14:36 +0100)]
travis: remove duplicate xcode image and add comments

We already build on whatever the default Travis xcode image is
which is currently 9.4 so remove the duplicate build targeting 9.4 and
add some comments explaining the purpose of the different builds.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agoMerge branch 'mine/patch-2' of https://github.com/hannesweisbach/fio
Jens Axboe [Thu, 19 Dec 2019 12:38:30 +0000 (05:38 -0700)]
Merge branch 'mine/patch-2' of https://github.com/hannesweisbach/fio

* 'mine/patch-2' of https://github.com/hannesweisbach/fio:
  Add example job file for exit_what
  Expand choices for exitall

4 years agoAdd example job file for exit_what
Hannes Weisbach [Thu, 19 Dec 2019 09:33:24 +0000 (10:33 +0100)]
Add example job file for exit_what

4 years agoExpand choices for exitall
Hannes Weisbach [Wed, 27 Nov 2019 09:57:49 +0000 (10:57 +0100)]
Expand choices for exitall

Add exit_what thread_option with the following choices:

- "group" (default) exit all jobs of the same group (equal to "exitall=1")
- "stonewall", quit all jobs until the next stonewall
- "all", quit *all* jobs

Signed-off-by: Hannes Weisbach <hannes.weisbach@gmail.com>
4 years agoMerge branch 'windows_mkdir' of https://github.com/sitsofe/fio
Jens Axboe [Thu, 19 Dec 2019 03:13:58 +0000 (20:13 -0700)]
Merge branch 'windows_mkdir' of https://github.com/sitsofe/fio

* 'windows_mkdir' of https://github.com/sitsofe/fio:
  filesetup: fix directory creation issues

4 years agofilesetup: fix directory creation issues
Sitsofe Wheeler [Sun, 8 Dec 2019 18:03:57 +0000 (18:03 +0000)]
filesetup: fix directory creation issues

- Fix double directory prefix concatenation that was happening after
  95af8dd57a7a9a564f99492bb1e04bb6d13b95b1 ("filesetup: don't call
  create_work_dirs() for ioengine with FIO_DISKLESSIO") refactored some
  code
- Stop always using '/' and switch to using FIO_OS_PATH_SEPARATOR when
  concatenating the directory value to the filename in set_name_idx()
- Change the permissions directories are created with to have the
  execute bit so they can be entered(!)
- Fix bug where filenames that were absolute unix paths would prevent
  the creation of intermediate directories
- Remove the configure mkdir test and introduce fio_mkdir to hide mkdir
  platform differences
- Make Windows mkdir emulation more robust against multiple slashes
  after the drive letter and when dealing dealing with with paths
  containing drive letters in general

This commit makes the following work on Windows:
./fio --thread --name=doubleslashtest \
 --filename='C\:\\Windows\Temp\fio.tmp' --size=4k --bs=4k --rw=read

The next example now works when D:\1\ exists but D:\1\2\ doesn't:

./fio --thread --name=mkdirtest --directory='D\:\1' \
 --filename='2\fio.tmp' --size=4k --bs=4k --rw=read

The following now works on macOS/Linux when /tmp/1/ exists but /tmp/1/2/
doesn't:

./fio --name=mkdirtest --directory='/tmp/1' \
 --filename='2/fio.tmp' --size=4k --bs=4k --rw=read

Fixes https://github.com/axboe/fio/issues/784 ,
https://github.com/axboe/fio/issues/864 and
https://github.com/axboe/fio/issues/870

Tested-by: Astolfo Rueda <astolfor@microsoft.com>
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
4 years agoMerge branch 'issue-878' of https://github.com/vincentkfu/fio
Jens Axboe [Wed, 18 Dec 2019 16:53:48 +0000 (09:53 -0700)]
Merge branch 'issue-878' of https://github.com/vincentkfu/fio

* 'issue-878' of https://github.com/vincentkfu/fio:
  client/server: add missing fsync data structures

4 years agoclient/server: add missing fsync data structures
Vincent Fu [Mon, 16 Dec 2019 15:15:11 +0000 (10:15 -0500)]
client/server: add missing fsync data structures

In client/server mode, fsync latencies were missing because a couple
data structures were missed in the client/server send/receive thread
stats code. This patch adds those data structures and now we are able to
see the fsync latencies in client/server mode.

Fixes: https://github.com/axboe/fio/issues/878
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agoMerge branch 'cygwin-build-error' of https://github.com/vincentkfu/fio
Jens Axboe [Mon, 16 Dec 2019 23:14:40 +0000 (16:14 -0700)]
Merge branch 'cygwin-build-error' of https://github.com/vincentkfu/fio

* 'cygwin-build-error' of https://github.com/vincentkfu/fio:
  Makefile: add libssp for Windows

4 years agoMerge branch 'travis-xcode11.2-python' of https://github.com/vincentkfu/fio
Jens Axboe [Mon, 16 Dec 2019 23:08:35 +0000 (16:08 -0700)]
Merge branch 'travis-xcode11.2-python' of https://github.com/vincentkfu/fio

* 'travis-xcode11.2-python' of https://github.com/vincentkfu/fio:
  .travis.yml: xcode11.2 scipy issue

4 years agoFio 3.17 fio-3.17
Jens Axboe [Mon, 16 Dec 2019 22:48:43 +0000 (15:48 -0700)]
Fio 3.17

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMakefile: add libssp for Windows
Vincent Fu [Thu, 12 Dec 2019 22:22:06 +0000 (15:22 -0700)]
Makefile: add libssp for Windows

Recent Cygwin mingw releases require linking against libssp to avoid
undefined symbols.

See https://github.com/msys2/MINGW-packages/issues/5868 for discussion.
https://github.com/msys2/MINGW-packages/issues/5803 also contains
discussion of possibly disabling the FORTIFY_SOURCE linker flag.

Fixes: https://github.com/axboe/fio/issues/881
Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years ago.travis.yml: xcode11.2 scipy issue
Vincent Fu [Fri, 13 Dec 2019 19:58:23 +0000 (12:58 -0700)]
.travis.yml: xcode11.2 scipy issue

The previous commit that added support for xcode11.2 resolved the
steadystate_tests scipy dependency with 'pip3 install scipy'. However,
the travis xcode11.2 image changed and now we need 'pip install scipy'
to provide the scipy dependency. To forestall future issues, install
scipy for both python2 and python3.

Also enable debug output in run-fio-tests.py to provide more information
in case of failure.

Signed-off-by: Vincent Fu <vincent.fu@wdc.com>
4 years agot/io_uring: check for CONFIG_HAVE_GETTID
Jens Axboe [Thu, 12 Dec 2019 19:34:50 +0000 (12:34 -0700)]
t/io_uring: check for CONFIG_HAVE_GETTID

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/run-fio-tests: relax acceptance criterion for t0011
Vincent Fu [Tue, 10 Dec 2019 17:54:42 +0000 (12:54 -0500)]
t/run-fio-tests: relax acceptance criterion for t0011

I saw a handful of benign failures for t0011 when run on
travis/appveyor. This patch allows the test to still pass with a
measured IOPS of 998 to 1002 and adds a debug print for the value
actually observed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years ago.appveyor.yml: run run-fio-tests.py
Vincent Fu [Tue, 10 Dec 2019 17:54:41 +0000 (12:54 -0500)]
.appveyor.yml: run run-fio-tests.py

- Add CUnit support
- install SciPy
- skip test 5 because Windows does not support direct I/O with sync
ioengines

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years ago.travis.yml: run t/run-fio.tests.py as part of build
Vincent Fu [Tue, 10 Dec 2019 17:54:40 +0000 (12:54 -0500)]
.travis.yml: run t/run-fio.tests.py as part of build

- install SciPy and CUnit support
- skip test 6 because of timeout
- skip zbd tests 1007, 1008 because installing kernel modules is not supported
- replace xcode8.3 (lacks python3) with latest xcode11.2

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/steadystate_tests: use null ioengine for tests
Vincent Fu [Tue, 10 Dec 2019 17:54:39 +0000 (12:54 -0500)]
t/steadystate_tests: use null ioengine for tests

Instead of reading from /dev/zero just use the null ioengine. This
enables the script to run on Windows.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/run-fio-tests: identify test id for debug messages
Vincent Fu [Tue, 10 Dec 2019 17:54:38 +0000 (12:54 -0500)]
t/run-fio-tests: identify test id for debug messages

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/run-fio-tests: improve Windows support
Vincent Fu [Tue, 10 Dec 2019 17:54:37 +0000 (12:54 -0500)]
t/run-fio-tests: improve Windows support

- add .exe extension for fio and unittest
- for python scripts use 'python.exe script.py' instead of ./script.py
- make JSON decoding more resilient by lopping off up to four of the
first lines when encountering decoding errors. This helps Windows
because for some jobs fio prints an informational message about
requiring threads

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/run-fio-tests: detect requirements and skip tests accordingly
Vincent Fu [Tue, 10 Dec 2019 17:54:36 +0000 (12:54 -0500)]
t/run-fio-tests: detect requirements and skip tests accordingly

Also provide an option to skip requirement checking

Suggested-by: <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agot/run-fio-tests: a few small improvements
Vincent Fu [Tue, 10 Dec 2019 17:54:35 +0000 (12:54 -0500)]
t/run-fio-tests: a few small improvements

- add debug option that changes logging level
- improve error handling
- more output on test failures
- Python 3.5 compatibility with pathlib.Path and os.path.join
- warn if fio executable not found but don't abort because some tests
can run without the fio executable

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years ago.gitignore: ignore zbd test output files
Vincent Fu [Tue, 10 Dec 2019 17:54:34 +0000 (12:54 -0500)]
.gitignore: ignore zbd test output files

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofilesetup: ensure to setup random generator properly
Jens Axboe [Sat, 7 Dec 2019 05:03:04 +0000 (22:03 -0700)]
filesetup: ensure to setup random generator properly

If we have ZONED or ZONED_ABS set, we need to go through the same
path as RANDOM. If not, we fail miserably later.

Fixes: https://github.com/axboe/fio/issues/873
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoRenumber RWF_UNCACHED
Jens Axboe [Fri, 6 Dec 2019 19:36:53 +0000 (12:36 -0700)]
Renumber RWF_UNCACHED

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agopvsync2: add support for RWF_UNCACHED
Jens Axboe [Fri, 6 Dec 2019 16:08:29 +0000 (09:08 -0700)]
pvsync2: add support for RWF_UNCACHED

See commit 4a87b5840d35 ("io_uring: add support for RWF_UNCACHED")
for details on this feature.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoio_uring: add support for RWF_UNCACHED
Jens Axboe [Fri, 6 Dec 2019 15:35:28 +0000 (08:35 -0700)]
io_uring: add support for RWF_UNCACHED

If this is set, and the kernel supports it, buffered IO will be
uncached. This means that reads are dropped from the cache if we
are the ones instantiating the pages, and writes are sync and
dropped from the page cache on IO completion.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoMerge branch 'engine-rados-fix-first' of https://github.com/aclamk/fio
Jens Axboe [Wed, 27 Nov 2019 17:23:12 +0000 (10:23 -0700)]
Merge branch 'engine-rados-fix-first' of https://github.com/aclamk/fio

* 'engine-rados-fix-first' of https://github.com/aclamk/fio:
  engines/rados: fix error with getting last instead of first element from list

4 years agoengines/rados: fix error with getting last instead of first element from list
Adam Kupczyk [Wed, 27 Nov 2019 15:18:32 +0000 (10:18 -0500)]
engines/rados: fix error with getting last instead of first element from list

    A thinko has popped in implementation. Consumer function `getevent()` did pick last (newest) instead of first (oldest).

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
4 years agoMerge branch 'fallocate-truncate' of https://github.com/tripped/fio
Jens Axboe [Tue, 26 Nov 2019 18:57:52 +0000 (11:57 -0700)]
Merge branch 'fallocate-truncate' of https://github.com/tripped/fio

* 'fallocate-truncate' of https://github.com/tripped/fio:
  filesetup: add fallocate=truncate option.

4 years agoMerge branch 'rados-now-use-completion-callbacks' of https://github.com/aclamk/fio
Jens Axboe [Tue, 26 Nov 2019 04:40:38 +0000 (21:40 -0700)]
Merge branch 'rados-now-use-completion-callbacks' of https://github.com/aclamk/fio

* 'rados-now-use-completion-callbacks' of https://github.com/aclamk/fio:
  engines/rados: changed polling to completion callbacks methodology

4 years agoMerge branch 'const1' of https://github.com/kusumi/fio
Jens Axboe [Tue, 26 Nov 2019 04:40:19 +0000 (21:40 -0700)]
Merge branch 'const1' of https://github.com/kusumi/fio

* 'const1' of https://github.com/kusumi/fio:
  parse: Silence discard-const warning on OpenBSD

4 years agoengines/rados: changed polling to completion callbacks methodology
Adam Kupczyk [Mon, 25 Nov 2019 17:55:07 +0000 (12:55 -0500)]
engines/rados: changed polling to completion callbacks methodology

Previously, getevent() function polled operations that have been submitted to check if some of them have already finished.
Now, each rados operation invokes completion callback. This callback adds to list of completed operations.
In this version getevent() only peeks if completed list has some operations.

There are two benefits:
1) small one - this works faster then previous version
2) big one - when there is a huge amount of operations in fly, getevent() might be more overloaded then producer. In this scenario some old operations are finished, but not picked up and properly noticed. This caused absurdely long execution times, when actually everything was working properly.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
4 years agoparse: Silence discard-const warning on OpenBSD
Tomohiro Kusumi [Mon, 25 Nov 2019 15:13:48 +0000 (00:13 +0900)]
parse: Silence discard-const warning on OpenBSD

This might be overkill just to silence the warnings, but having
a common function for const and non-const version makes it discard
const pointer at some point.

--
    CC parse.o
parse.c: In function 'find_option_c':
parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type
parse.c: In function 'get_option':
parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type
parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type
parse.c: In function 'parse_cmd_option':
parse.c:1051: warning: passing argument 1 of 'find_option' discards qualifiers from pointer target type

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
4 years agot/run-fio-tests: improve error handling
Vincent Fu [Mon, 11 Nov 2019 16:30:55 +0000 (11:30 -0500)]
t/run-fio-tests: improve error handling

More gracefully handle errors when running a test. Also change the
EXAMPLE to refer to fio's canonical git repository.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agoio_u: move to next zone even if zoneskip is unset
Vincent Fu [Mon, 11 Nov 2019 16:30:54 +0000 (11:30 -0500)]
io_u: move to next zone even if zoneskip is unset

This patch makes fio's behavior under zonemode=strided conform to the
documentation:

    I/O happens in a single zone until zonesize bytes have been
    transferred. After that number of bytes has been transferred
    processing of the next zone starts.

With zonemode=strided, before commit 35f561eb, fio would only move to
the next zone when zoneskip > 0 and zonesize bytes were written. There
would always be zoneskip bytes between the end of one zone and the
beginning of the next zone. If zoneskip was not set or set to 0, all IO
would happen in the first zone.

Commit 35f561eb changed this so that fio would move to the next zone
upon writing zonesize bytes if zoneskip was explicitly set to a value >=
0. This option made it possible for zones to be contiguous. The
documentation was not updated to reflect the new behavior.

I originally intended to submit a patch to update fio's documentation,
but upon further reflection it seems better to change fio's behavior and
have a clean user interface than to change the documentation to note
that zoneskip must be explciitly set in order for fio to move to the
next zone.

This patch also updates t/strided.py to reflect the new behavior.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofilesetup: improve LFSR init failure error message
Vincent Fu [Mon, 11 Nov 2019 16:30:53 +0000 (11:30 -0500)]
filesetup: improve LFSR init failure error message

Especially with small sample spaces, the LFSR random generator
occasionally fails to initialize successfully. When this occurs, the
error message refers to problems allocating a random map. Change the
error message to explicitly mention the LFSR failure.

OLD BEHAVIOR
$ ./fio --name=test --ioengine=null --size=4k --random_generator=lfsr --rw=randread --randrepeat=0
test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=null, iodepth=1
fio-3.16-13-g998b-dirty
Starting 1 process
fio: failed allocating random map. If running a large number of jobs, try the 'norandommap' option or set 'softrandommap'. Or give a larger --alloc-size to fio.

NEW BEHAVIOR
$ ./fio --name=test --ioengine=null --size=4k --random_generator=lfsr --rw=randread --randrepeat=0
test: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=null, iodepth=1
fio-3.16-37-g65ee
Starting 1 process
fio: failed initializing LFSR

Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 years agofilesetup: add fallocate=truncate option.
Trip Volpe [Thu, 7 Nov 2019 23:13:48 +0000 (15:13 -0800)]
filesetup: add fallocate=truncate option.

Fixes #833. Provides the ability to initially "layout" the file
by ftruncating it to the desired size before performing IO. This
is mainly useful on Windows, which serializes all writes that
extend the size of a file. Using this option with a suitable
iodepth allows fio to emulate the behavior of Windows Explorer
file copy, which always truncates to the expected size before
issuing writes for performance reasons.

4 years agoMerge branch 'testing' of https://github.com/vincentkfu/fio
Jens Axboe [Thu, 7 Nov 2019 00:04:17 +0000 (17:04 -0700)]
Merge branch 'testing' of https://github.com/vincentkfu/fio

* 'testing' of https://github.com/vincentkfu/fio:
  t/run-fio-tests: a script to automate running fio tests
  t/jobs: fix t0011 syntax error
  t/jobs: clean up t0009 and use only 4 CPUs
  t/jobs: drop time_based in t0007
  t/jobs: use current directory for test file for t0003 and t0004
  t/jobs: fixup t0002 test jobs
  t/stest: non-zero exit value on failure
  t/sgunmap-test.py: drop six.moves dependency
  t/steadystate_tests: better support automated testing
  t/strided.py: change LFSR tests
  t/readonly: replace shell script with python script
  t/iee754: add return value

4 years agot/run-fio-tests: a script to automate running fio tests
Vincent Fu [Fri, 18 Oct 2019 19:05:35 +0000 (15:05 -0400)]
t/run-fio-tests: a script to automate running fio tests

fio actually has a substantial test infrastructure but lacks a
convenient way to run existing tests in an automated fashion. This
script provides the means to run almost all of fio's existing tests with
a single command. A full run finishes in less than 10 minutes.

This script can be used to catch bugs before patches are submitted. It
can also be used to test new fio builds as patches are committed to the
repository.

4 years agot/jobs: fix t0011 syntax error
Vincent Fu [Thu, 17 Oct 2019 15:53:04 +0000 (11:53 -0400)]
t/jobs: fix t0011 syntax error

4 years agot/jobs: clean up t0009 and use only 4 CPUs
Vincent Fu [Thu, 17 Oct 2019 18:38:24 +0000 (14:38 -0400)]
t/jobs: clean up t0009 and use only 4 CPUs

There are two runtime= lines in t0009. Comment out the one that is
ignored.

Also reduce the number of CPUs required from 6 to 4 so that this can be
run on more systems. The failure still occurs on systems with four CPUs.

4 years agot/jobs: drop time_based in t0007
Vincent Fu [Thu, 17 Oct 2019 15:52:27 +0000 (11:52 -0400)]
t/jobs: drop time_based in t0007

This is an extraneous option that produces a warning message which
complicates using this job file for automated testing.

4 years agot/jobs: use current directory for test file for t0003 and t0004
Vincent Fu [Thu, 17 Oct 2019 15:54:03 +0000 (11:54 -0400)]
t/jobs: use current directory for test file for t0003 and t0004

This makes it easier to investigate problems when these job files are
used for automated testing.

4 years agot/jobs: fixup t0002 test jobs
Vincent Fu [Wed, 6 Nov 2019 16:22:10 +0000 (11:22 -0500)]
t/jobs: fixup t0002 test jobs

- add .fio extension to match other job files
- change line endings from DOS to UNIX
- use local file instead of device

4 years agot/stest: non-zero exit value on failure
Vincent Fu [Wed, 16 Oct 2019 19:03:32 +0000 (15:03 -0400)]
t/stest: non-zero exit value on failure

To facilitate automated testing, return a non-zero exit value when a
smalloc failure occurs.

4 years agot/sgunmap-test.py: drop six.moves dependency
Vincent Fu [Wed, 30 Oct 2019 23:55:21 +0000 (19:55 -0400)]
t/sgunmap-test.py: drop six.moves dependency

range was never actually used in this script.

4 years agot/steadystate_tests: better support automated testing
Vincent Fu [Tue, 29 Oct 2019 10:09:54 +0000 (06:09 -0400)]
t/steadystate_tests: better support automated testing

To better support using this script for automated testing, do the
following:

- Use a more portable python interpreter reference
- Drop six.moves dependency
- Eliminate two potential divide-by-zero runtime errors
- Count and report the number of passed and failed tests
- Keep the output of the test jobs for inspection in case of failure
- Exit code 0 if all tests pass and non-zero otherwise

4 years agot/strided.py: change LFSR tests
Vincent Fu [Mon, 28 Oct 2019 23:45:31 +0000 (19:45 -0400)]
t/strided.py: change LFSR tests

LFSR init fails on occasion with small zoneranges. This patch increases
the zonerange for LFSR tests to eliminate these failures.

Also fix a typo in the last test job.