fio.git
2 years agoos: introduce ioprio_value() helper
Damien Le Moal [Fri, 3 Sep 2021 15:20:23 +0000 (15:20 +0000)]
os: introduce ioprio_value() helper

Introduce the ioprio_value() helper function to calculate a priority
value based on a priority class and priority level. For Linux and
Android, this is defined as an integer equal to the priority class
shifted left by 13 bits and or-ed with the priority level. For
Dragonfly, ioprio_value() simply returns the priority level as there
is no concept of priority class.

Use this new helper in the io_uring and libaio engines to set IO
priority when the cmdprio_percentage option is used.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agotools: fiograph: do not overwrite input script file
Damien Le Moal [Fri, 3 Sep 2021 15:20:22 +0000 (15:20 +0000)]
tools: fiograph: do not overwrite input script file

In fiograph.py, the setup_commandline() function mistakenly initializes
the output_file variable to the input fio script file, causing this file
to always be overwritten, even if an output file is specified using the
--output option. Fix this by properly initializing the output_file
variable using the --output option argument value. If an output file
name is not provided, the input script file name is used by default.

Also fix fiograph configuration file to remove the cmdprio_percentage
option repeated entry for io_uring and libaio.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agomanpage: fix definition of prio and prioclass options
Damien Le Moal [Fri, 3 Sep 2021 15:20:21 +0000 (15:20 +0000)]
manpage: fix definition of prio and prioclass options

Remove the reference to the hipri_percentage option in the definition of
the prio and prioclass options as hipri_percentage controls the use of
RWF_HIPRI flag which triggers I/O completion polling, which is unrelated
with I/O priority (polling and I/O priority can be used together). This
change is done in both fio man page and HOWTO document.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agomanpage: fix formatting
Damien Le Moal [Fri, 3 Sep 2021 15:20:20 +0000 (15:20 +0000)]
manpage: fix formatting

For ioengine options supported by multiple ioengines, remove spaces
after commas in the ioengine list to have troff correctly format in bold
the entire ioengine list and option name. Also add "=int" indicators
missing for some options.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agooslib: Fix blkzoned_get_max_open_zones()
Damien Le Moal [Wed, 1 Sep 2021 06:41:53 +0000 (15:41 +0900)]
oslib: Fix blkzoned_get_max_open_zones()

When the kernel does not have the sysfs atttribute file
queue/max_open_zones, blkzoned_get_max_open_zones() returns success
without initializing the max_open_zones value to 0 to indicate to the
caller (zbd_get_max_open_zones() in zbd.c) that the device limit is
unknown. If the max_open_zones variable in zbd_get_max_open_zones() is
not already 0 (depending on the memory status), the missing
initialization in blkzoned_get_max_open_zones() can cause errors or
misbehavior as an incorrect, random, limit may be used.

Fix this by always initializing max_open_zones to 0 when the
max_open_zones sysfs attribute file does not exist.

Reported-by: Bao-Hua Li <baohua.li@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agot/io_uring: further simplify inflight tracking
Jens Axboe [Sat, 28 Aug 2021 21:37:25 +0000 (15:37 -0600)]
t/io_uring: further simplify inflight tracking

Don't dump the last submitter inflight as well, just use file_depths()
for all of them.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agot/io_uring: pretty up multi-file depths
Jens Axboe [Fri, 27 Aug 2021 18:44:02 +0000 (12:44 -0600)]
t/io_uring: pretty up multi-file depths

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoio_uring: don't clear recently set sqe->rw_flags
Niklas Cassel [Thu, 26 Aug 2021 16:45:05 +0000 (16:45 +0000)]
io_uring: don't clear recently set sqe->rw_flags

Commit 7c70f506e438 ("engines/io_uring: move sqe clear out of hot path")
removed the memset of sqe from fio_ioring_prep().

This commit did add a clear of the sqe->rw_flags, however, it did so
after both RWF_UNCACHED and RWF_NOWAIT flags might have been set,
effectively clearing these flags if they got set.

This doesn't make any sense. Make sure that we clear sqe->rw_flags
before, not after, setting the flags.

Fixes: 7c70f506e438 ("engines/io_uring: move sqe clear out of hot path")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoio_uring: fix misbehaving cmdprio_percentage option
Niklas Cassel [Thu, 26 Aug 2021 16:45:05 +0000 (16:45 +0000)]
io_uring: fix misbehaving cmdprio_percentage option

Commit 7c70f506e438 ("engines/io_uring: move sqe clear out of hot path")
removed the memset of sqe from fio_ioring_prep().

Before this commit, fio_ioring_prio_prep() behaved properly, because
sqe->ioprio was always cleared by the memset in fio_ioring_prep().

cmdprio_percentage=20 is supposed to set the highest priority class for
20% of the total I/Os, however, because sqes got reused without clearing
the ioprio field, this meant that the number of I/Os sent with the highest
priority became 95% already after 10 seconds. Quite far off from the
intended 20%.

Fix this by explicitly clearing the priority in fio_ioring_prio_prep().
Note that prio/prioclass cannot be used together with cmdprio_percentage,
so we do not need to do an additional clear in fio_ioring_prep().

engines/libaio.c doesn't explicitly clear the ioprio, nor does it memset
the descriptor entry, this is because io_prep_pread()/io_prep_pwrite() in
libaio itself performs a memset.

Fixes: 7c70f506e438 ("engines/io_uring: move sqe clear out of hot path")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoio_uring: always initialize sqe->flags
Niklas Cassel [Thu, 26 Aug 2021 16:45:04 +0000 (16:45 +0000)]
io_uring: always initialize sqe->flags

Commit 7c70f506e438 ("engines/io_uring: move sqe clear out of hot path")
removed the memset of sqe from fio_ioring_prep().

Later, force_async was added in commit 5a59a81d2923 ("engines/io_uring:
allow setting of IOSQE_ASYNC").

The force_async commit sets sqe->flags every N requests, however,
since we no longer do a memset, this commit should have made sure that
flags is always initialized, such that we don't have sqe->flags set on
reused sqes where we didn't intend to.

Fixes: 5a59a81d2923 ("engines/io_uring: allow setting of IOSQE_ASYNC")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'wip-cxx' of https://github.com/tchaikov/fio
Jens Axboe [Thu, 26 Aug 2021 14:46:36 +0000 (08:46 -0600)]
Merge branch 'wip-cxx' of https://github.com/tchaikov/fio

* 'wip-cxx' of https://github.com/tchaikov/fio:
  arch,lib/seqlock: implement seqlock with C++ atomic if compiled with C++

2 years agoarch,lib/seqlock: implement seqlock with C++ atomic if compiled with C++
Kefu Chai [Wed, 11 Aug 2021 04:29:39 +0000 (12:29 +0800)]
arch,lib/seqlock: implement seqlock with C++ atomic if compiled with C++

because some functions declared by <stdatomic.h> share the same names
with those declared by <atomic>, for instance `kill_dependency()` is
defined as a macro by <stdatomic.h>, while it is defined as a template
function in <atomic>.

this renders it impossible to compile an ioengine written in C++ if
its source file includes both <atomic> and <fio.h>. the latter includes
<stdatomic.h> via arch/arch.h. the compile error would look like:

In file included from ../src/test/fio/fio_ceph_objectstore.cc:26:
In file included from src/fio/fio.h:18:
In file included from src/fio/thread_options.h:8:
In file included from src/fio/gettime.h:7:
src/fio/lib/seqlock.h:21:9: error: expected ')'
                seq = atomic_load_acquire(&s->sequence);
                      ^
src/fio/arch/../lib/../arch/arch.h:47:32: note: expanded from macro 'atomic_load_acquire'
        atomic_load_explicit((_Atomic typeof(*(p)) *)(p),       \
                                      ^
src/fio/lib/seqlock.h:21:9: note: to match this '('

to address this issue, instead of using the functions in <stdatomic.h> to
implement seqlock, use the primitives offered by C++ standard library
if the source code is compiled using a C++ compiler.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
2 years agoMerge branch 'master' of https://github.com/DamonPalovaara/fio
Jens Axboe [Sat, 21 Aug 2021 02:58:42 +0000 (20:58 -0600)]
Merge branch 'master' of https://github.com/DamonPalovaara/fio

* 'master' of https://github.com/DamonPalovaara/fio:
  fixed type boot->bool

2 years agofixed type boot->bool
Damon Palovaara [Fri, 20 Aug 2021 22:22:58 +0000 (15:22 -0700)]
fixed type boot->bool

2 years agoMerge branch 'patch-1' of https://github.com/antroseco/fio
Jens Axboe [Wed, 18 Aug 2021 16:47:55 +0000 (10:47 -0600)]
Merge branch 'patch-1' of https://github.com/antroseco/fio

* 'patch-1' of https://github.com/antroseco/fio:
  server: reopen standard streams to /dev/null

2 years agoserver: reopen standard streams to /dev/null
Andreas Economides [Wed, 18 Aug 2021 12:19:51 +0000 (13:19 +0100)]
server: reopen standard streams to /dev/null

For some custom ioengines (see https://github.com/spdk/spdk/issues/1118),
it's not trivial to suppress output to stdout and stderr, so they would
write to some other file descriptor fio had opened - which is bad.

This change ensures that fd's 0, 1, and 2 (stdin, stdout, stderr) are
always valid and can be used without any unintended consequences.

Signed-off-by: Andreas Economides <andreas.economides@nutanix.com>
2 years agoMerge branch 'dfs_update_13_api' of https://github.com/johannlombardi/fio
Jens Axboe [Fri, 13 Aug 2021 16:01:31 +0000 (10:01 -0600)]
Merge branch 'dfs_update_13_api' of https://github.com/johannlombardi/fio

* 'dfs_update_13_api' of https://github.com/johannlombardi/fio:
  engines/dfs: add support for 1.3 DAOS API

2 years agot/io_uring: allow multiple IO threads
Jens Axboe [Wed, 11 Aug 2021 22:54:23 +0000 (16:54 -0600)]
t/io_uring: allow multiple IO threads

If you do:

t/io_uring -n2 /dev/dev1 /dev/dev2

then t/io_uring will create two IO threads, and each one will get
a file/device assigned. In the above example, thread 1 will run
on dev1, thread 2 on dev2.

Note that for now, you'll need at least as many files as threads.
Adding support for adding the same file set over the specified
threads (if we have less files than threads) is left as an
exercise for the reader. You know where to send the patches.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoengines/dfs: add support for 1.3 DAOS API
Johann Lombardi [Tue, 10 Aug 2021 13:03:21 +0000 (15:03 +0200)]
engines/dfs: add support for 1.3 DAOS API

A few changes were done to the pool connect and container open API
in DAOS 1.3+. UUID string or label are now passed via the API
instead of uuid_t structures. Change the dfs engine accordingly.

Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
2 years agot/zbd: Add test #58 to test zone reset by trim workload
Shin'ichiro Kawasaki [Fri, 6 Aug 2021 01:07:11 +0000 (10:07 +0900)]
t/zbd: Add test #58 to test zone reset by trim workload

To exercise zone reset by trim workload, add the test case #58. As the
precondition, it fills several zones. After that, a trim job and a write
job run in parallel for 30 seconds. The ratio of trim commands and write
commands is controlled by --flow option.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Tested-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoHOWTO/man: Describe trim support by zone reset for zoned devices
Shin'ichiro Kawasaki [Fri, 6 Aug 2021 01:07:10 +0000 (10:07 +0900)]
HOWTO/man: Describe trim support by zone reset for zoned devices

Previous commits added trim support for zoned devices. Update HOWTO and
man page to describe it. Also add missing description about libzbc I/O
engine to HOWTO.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoengines/libzbc: Enable trim for libzbc I/O engine
Shin'ichiro Kawasaki [Fri, 6 Aug 2021 01:07:09 +0000 (10:07 +0900)]
engines/libzbc: Enable trim for libzbc I/O engine

The trim workload to zoned block devices is supported as zone reset, and
this feature is available for I/O engines which support both zoned
devices and trim workload. Libzbc I/O engine supports zoned devices but
lacks trim workload support. To enable trim support with libzbc I/O
engine, remove the check which inhibited trim from requests to libzbc
I/O engine. Also set file open flags for trim same as write, and call
zbd_do_io_u_trim() for trim I/O.

Of note is that libzbc I/O engine now can support trim to sequential
write required zones only. The trim I/Os to conventional zones are
reported as an error.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: Support zone reset by trim
Shin'ichiro Kawasaki [Fri, 6 Aug 2021 01:07:08 +0000 (10:07 +0900)]
zbd: Support zone reset by trim

Enable trim workload for zonemode=zbd by modifying do_io_u_trim() to
call zoned block device unique function zbd_do_io_u_trim() which resets
the target zone. This allows fio to emulate workloads which mix data
read/write and zone resets with zonemode=zbd.

To call reset zones, the trim I/O shall have offset aligned to zone
start and block size same as zone size. Reset zone is called only to
sequential write required zones and sequential write preferred zones.
Conventional zones are handled in same manner as regular block devices
by calling os_trim() function.

When zones are reset with random trim workload, choose only non-empty
zones as trim target. This avoids meaningless trim to empty zones and
makes the workload more realistic. To find the non-empty zones, utilize
zbd_find_zone() helper function which is already used for read workload,
specifying 1 byte as the minimum valid data size.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: Add min_bytes argument to zbd_find_zone()
Shin'ichiro Kawasaki [Fri, 6 Aug 2021 01:07:07 +0000 (10:07 +0900)]
zbd: Add min_bytes argument to zbd_find_zone()

The helper function zbd_find_zone() finds a zone with at least
min_bs[DDIR_READ] bytes of readable data before the zone write pointer.
This patch generalizes this function to allow finding a non-empty zone.
To do so, add the min_bytes argument to specify the minimum readable
data of a zone to filter the search. Specifying 1 to min_bytes then
become equivalent to finding a non-empty zone.

This change will allow to reuse this function to find a suitable zone
for trim I/O.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoioengines: fix crash with --enghelp option
Vincent Fu [Wed, 4 Aug 2021 18:29:05 +0000 (18:29 +0000)]
ioengines: fix crash with --enghelp option

Since f6931a1dd35896433c8cc2e10de51372a2c496c4 commands like the
following segfault:

fio --enghelp=sg
fio --enghelp=sg,sg_write_mode

This is because free_ioengine() assumes that td->io_ops is not NULL.
Make this true when free_ioengine() is called by
fio_show_ioengine_help() to avoid the crash.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agobackend: clarify io scheduler setting error message
Vincent Fu [Wed, 4 Aug 2021 18:29:04 +0000 (18:29 +0000)]
backend: clarify io scheduler setting error message

If you know *how* fio tries to confirm that the IO scheduler was
successfully set, then the error message "io scheduler not found" makes
sense. However, if you don't know what fio does to confirm the io
scheduler setting, then the error message is confusing. This patch
modifies the error message to indicate that the selected IO scheduler
could not be set.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: Improve random zone index generation logic
Ankit Kumar [Wed, 4 Aug 2021 11:23:08 +0000 (16:53 +0530)]
zbd: Improve random zone index generation logic

Existing random zone index generation logic is dependent on the file size.
For smaller I/O sizes the random zone index always return a particular
section of open zones. As this index is used to return one of the open zones,
it was observed that after one of the max_open_zones / job_max_open_zones limit
is reached all further I/O's are redirected to only a few open zones till they
are full.

This patch modifies the random zone index genration logic so that it is uniform
across all the open zones.

It reverts part of the commit 6463db6c1
('fio: fix interaction between offset/size limited threads and
"max_open_zones"')

Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoHOWTO: Add missing documentation for job_max_open_zones
Ankit Kumar [Wed, 4 Aug 2021 11:23:07 +0000 (16:53 +0530)]
HOWTO: Add missing documentation for job_max_open_zones

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agofio: remove raw device support
Eric Sandeen [Tue, 3 Aug 2021 17:23:35 +0000 (10:23 -0700)]
fio: remove raw device support

As of Linux kernel commit 603e4922f1c ("remove the raw driver"),
linux/raw.h is gone, and raw device support no longer exists.
Because of this, fio can no longer build against the current Linux
kernel headers.

So, remove raw device support from fio as well.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoiolog: don't attempt read chunking with blktrace format
Jens Axboe [Mon, 2 Aug 2021 14:23:24 +0000 (08:23 -0600)]
iolog: don't attempt read chunking with blktrace format

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'master' of https://github.com/anson-lo/fio
Jens Axboe [Sun, 1 Aug 2021 14:36:01 +0000 (08:36 -0600)]
Merge branch 'master' of https://github.com/anson-lo/fio

* 'master' of https://github.com/anson-lo/fio:
  Fix an error triggered by double releasing the lock

2 years agoFix an error triggered by double releasing the lock
anson-lo [Sun, 1 Aug 2021 04:33:22 +0000 (12:33 +0800)]
Fix an error triggered by double releasing the lock

Fix an error triggered by double releasing the lock.
Fixes: https://github.com/axboe/fio/issues/1254.

Signed-off-by: Anson Lo ycaibb@gmail.com
2 years agoMakefile: update libzbc git repository
Damien Le Moal [Wed, 28 Jul 2021 07:05:42 +0000 (16:05 +0900)]
Makefile: update libzbc git repository

Update the GIT repository used for libzbc in the fulltes directive from
pointing to the now deprecated hgst reporitory to the currentxi
https://github.com/westerndigitalcorporation/libzbc repository.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'evelu-fix-engines' of https://github.com/ErwanAliasr1/fio
Jens Axboe [Sun, 25 Jul 2021 22:48:02 +0000 (16:48 -0600)]
Merge branch 'evelu-fix-engines' of https://github.com/ErwanAliasr1/fio

* 'evelu-fix-engines' of https://github.com/ErwanAliasr1/fio:
  engines/exec: Code cleanup to remove leaks

2 years agoengines/exec: Code cleanup to remove leaks
Erwan Velu [Sun, 25 Jul 2021 22:01:18 +0000 (00:01 +0200)]
engines/exec: Code cleanup to remove leaks

As per the coverty reports, there was some issues in my code :
- Some structures were not properly freed before returning.
- Some file descriptors were not properly closed
- Testing with 'if (!int)' isn't a good way to test if the value is negative

Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
2 years agoengines/exec: style cleanups
Jens Axboe [Sun, 25 Jul 2021 18:55:37 +0000 (12:55 -0600)]
engines/exec: style cleanups

No functional changes in this patch.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'evelu-exec' of https://github.com/ErwanAliasr1/fio
Jens Axboe [Sun, 25 Jul 2021 15:37:35 +0000 (09:37 -0600)]
Merge branch 'evelu-exec' of https://github.com/ErwanAliasr1/fio

* 'evelu-exec' of https://github.com/ErwanAliasr1/fio:
  fiograph: Adding exec engine support
  engines: Adding exec engine

2 years agoMerge branch 'dedupe_workset' of https://github.com/bardavid/fio
Jens Axboe [Thu, 15 Jul 2021 15:54:03 +0000 (09:54 -0600)]
Merge branch 'dedupe_workset' of https://github.com/bardavid/fio

* 'dedupe_workset' of https://github.com/bardavid/fio:
  dedupe: allow to generate dedupe buffers from working set

2 years agoMerge branch 'cmd-test-be' of https://github.com/tuan-hoang1/fio
Jens Axboe [Thu, 15 Jul 2021 15:26:01 +0000 (09:26 -0600)]
Merge branch 'cmd-test-be' of https://github.com/tuan-hoang1/fio

* 'cmd-test-be' of https://github.com/tuan-hoang1/fio:
  server: fix missing le32_to_cpu conversion when opcode is FIO_NET_CMD_TEXT

2 years agoserver: fix missing le32_to_cpu conversion when opcode is FIO_NET_CMD_TEXT
Tuan Hoang [Thu, 15 Jul 2021 13:57:31 +0000 (15:57 +0200)]
server: fix missing le32_to_cpu conversion when opcode is FIO_NET_CMD_TEXT

Reported-by: Manuel Gotin <manuel.gotin@ibm.com>
Signed-off-by: Tuan Hoang <tmhoang@linux.ibm.com>
2 years agodedupe: allow to generate dedupe buffers from working set
Bar David [Thu, 17 Jun 2021 12:39:58 +0000 (15:39 +0300)]
dedupe: allow to generate dedupe buffers from working set

This commit introduced new dedupe generation mode "working_set".
Working set mode simulates a more realistic approach to deduped data,
in which deduped buffers are generated from pre-existing working set -
% size of the device or file.

In other words, dedupe is not usually expected to be close
in time with the source buffer, as well as source buffers
are usually composed of small subset of the entire file or device.

Signed-off-by: Bar David <bardavvid@gmail.com>
2 years agoMakefile: use override directive on engine CFLAGS
Stefan Hajnoczi [Tue, 6 Jul 2021 17:27:00 +0000 (18:27 +0100)]
Makefile: use override directive on engine CFLAGS

The GNU Make documentation says the following about the override
keyword:

  Subsequent assignments or appends to this variable which are not
  marked override will be ignored.

  https://www.gnu.org/software/make/manual/html_node/Override-Directive.html

When the override CFLAGS line was moved in commit
f4bd2c3d80bc35f76892205a7e50426711e3def3 it broke the engine template,
which does not use the override directive. Since the engine template is
now evaluated afterwards, the engine CFLAGS are ignored.

Add the override keyword to the engine template so that engine CFLAGS
are honored again.

Note that the CONFIG_DYNAMIC_ENGINES case doesn't need the override
directive. It seems that GNU Make assigns CFLAGS even without the
override directive in this case:

  $$($(1)_OBJS): CFLAGS := -fPIC $$($(1)_CFLAGS) $(CFLAGS)

Fixes: f4bd2c3d80bc35f76892205a7e50426711e3def3 ("fix dynamic engine build")
Cc: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'dedupe_bugfix' of https://github.com/bardavid/fio
Jens Axboe [Thu, 1 Jul 2021 19:27:39 +0000 (13:27 -0600)]
Merge branch 'dedupe_bugfix' of https://github.com/bardavid/fio

* 'dedupe_bugfix' of https://github.com/bardavid/fio:
  dedupe: fixing bug with subsequent dedupe buffer generation

2 years agodedupe: fixing bug with subsequent dedupe buffer generation
Bar David [Thu, 1 Jul 2021 13:32:52 +0000 (16:32 +0300)]
dedupe: fixing bug with subsequent dedupe buffer generation

When unique pages are generated onto the write buffer the seed
used to generate the page is copied later to the buf_state_prev
for future dedupe generation.

However, the get_buf_state API returns pointer to the prev
seed. Then when the caller uses it to re-generate the buffer
it changes the internal seed and advances the PRNG.
A subsequent intention to create another dedup might result in
generating a unique page instead.

Signed-off-by: Bar David <bardavvid@gmail.com>
2 years agofiograph: Adding exec engine support
Erwan Velu [Tue, 29 Jun 2021 14:23:43 +0000 (16:23 +0200)]
fiograph: Adding exec engine support

Since fiograph is merged, let's add the specific options of this engine
into it and render the example job.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
2 years agoengines: Adding exec engine
Erwan Velu [Wed, 12 May 2021 07:54:11 +0000 (09:54 +0200)]
engines: Adding exec engine

When performing benchmarks with fio, some need to execute
tasks in parallel to the job execution. A typical use-case would be
observing performance/power metrics.

Several implementations were possible :
 - Adding an exec_run in addition of the existing exec_{pre|post}run
 - Implementating performance/power metrics in fio
 - Adding an exec engine

1°) Adding an exec_run
This was my first intention but quickly noticed that exec_{pre-post}run
are executed for each 'numjob'. In the case of performance/power
monitoring, this doesn't make sense to spawn an instance for each
thread.

2°) Implementing performance/power metrics
This is possible but would require lot of work to maintain this part of
fio while 3rd party tools already take care of that perfectly.

3°) Adding an engine
Adding an engine let users defining when and how many instances of the program they want.
In the provided example, a single monitoring job is spawning at the same
time as the worker thread which could be composed of several worker
threads.
A stonewall barrier is used to define which jobs must run together
(monitoring / benchmark).

The engine has two parameters :
- program: name of the program to run
- arguments: arguments to pass to the program
- grace_time: duration between SIGTERM and SIGKILL
- std_redirect: redirect std{err|out} to dedicated files

Arguments can have special variables to be expanded before the execution:
- %r will be replaced by the job duration in seconds
- %n will be replaced by the job name

During the program execution, the std{out|err} are redirected to files if std_redirect option is set (default).
- stdout: <job_name>.stdout
- stderr: <job_name>.stderr

If the executed program has a nice stdout output, after the fio
execution, the stdout file can be parsed by other tools like CI jobs or graphing tools.

A sample job is provided here to show how this can be used.
It runs twice the CPU engine with two different CPU modes (noop vs qsort).
For each benchmark, the output of turbostat is saved for later analysis.
After the fio run, it is possible to compare the impact of the two modes
on the CPU frequency and power consumption.

This can be easily extended to any other usage that needs to analysis
the behavior of the host during some jobs.

About the implementation, the exec engine forks :
- the child doing an execvp() of the program.
- the parent, fio, will monitor the time passed into the job

Once the time is over, the program is SIGTERM followed by a SIGKILL to
ensure it will not run _after_ the job is completed.
This mechanism is required as :
- not all programs can be controlled properly
- that's last resort protection if the program gets crazy
The delay is controlled by grace_time option, default is 1 sec.

If the program can be limited in its duration, using the %r variable in
the arguments can be used to request the program to stop _before_ the
job finished like :
        program=/usr/bin/mytool.sh
        arguments=--duration %r

Signed-off-by: Erwan Velu <e.velu@criteo.com>
2 years agozbd: ensure that global max open zones limit is respected
Niklas Cassel [Thu, 24 Jun 2021 17:23:08 +0000 (17:23 +0000)]
zbd: ensure that global max open zones limit is respected

Commit 219c662d3b12 ("zbd: introduce per job maximum open zones limit")
Introduced a global max open zones limit stored in zbd_info->max_open_zones.

This commit also changed checks against td->o.max_open_zones in zbd_open_zone()
with checks against zbd_info->max_open_zones.

It is obvious that zbd_info->max_open_zones was intended to replace
td->o.max_open_zones in all code that is executed after zbd_setup_files().

The commit itself was needed since zbd_info is shared over different jobs,
so it is important that the global limit of max open zones is the same,
for different jobs targeting the same device.

The problem with this commit is that in zbd_convert_to_open_zone(),
instead of replacing td->o.max_open_zones with zbd_info->max_open_zones,
it incorrectly just removed the references to td->o.max_open_zones.

This caused commit 00ca8df5468e ("zbd: Fix max_open_zones checks")
(written by another author) to incorrectly re-add the removed
td->o.max_open_zones checks in zbd_convert_to_open_zone().
The proper fix here should have been to add checks against
zbd_info->max_open_zones instead of td->o.max_open_zones,
just like the original author did for zbd_open_zone().

Replace all td->o.max_open_zones uses past zbd_setup_files() with
zbd_info->max_open_zones, and force set td->o.max_open_zones to
zbd_info->max_open_zones in zbd_setup_files(), so that even if checks are
introduced against the wrong limit, fio will still respect the global limit.

Fixes: 00ca8df5468e ("zbd: Fix max_open_zones checks")
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: allow an unlimited global max open zones limit
Niklas Cassel [Thu, 24 Jun 2021 17:23:07 +0000 (17:23 +0000)]
zbd: allow an unlimited global max open zones limit

Commit 219c662d3b12 ("zbd: introduce per job maximum open zones limit")
Introduced a global max open zones limit stored in zbd_info->max_open_zones.

This commit also removed the following check from zbd_open_zone():

if (!td->o.max_open_zones)
        return true;

Before the commit in question, if td->o.max_open_zones == 0, zbd_open_zone()
would not track the zone as open in the zbd_info->open_zones array.

After the commit in question, zbd_open_zone() would always track the zone
as open in the zbd_info->open_zones array, regardless if a --max_open_zones
limit was set or not.

Change the initialization of zbd_info->max_open_zones to yet again allow
unlimited max open zones. If zbd_info->max_open_zones is unlimited,
we do not track the open zones in the zbd_info->open zone array.

Not tracking open zones reduces fio overhead for testing the performance of
zoned block devices that do not have a limit on the maximum number of open
zones.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: create a local zbdi variable for f->zbd_info
Niklas Cassel [Thu, 24 Jun 2021 17:23:07 +0000 (17:23 +0000)]
zbd: create a local zbdi variable for f->zbd_info

Create a local zbdi variable for f->zbd_info for the following functions:
zbd_open_zone(), zbd_convert_to_open_zone(), and zbd_adjust_block().

This avoids unnecessary indirections.

No functional change intended.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'evelu-fiog' of https://github.com/ErwanAliasr1/fio
Jens Axboe [Tue, 29 Jun 2021 13:38:33 +0000 (07:38 -0600)]
Merge branch 'evelu-fiog' of https://github.com/ErwanAliasr1/fio

* 'evelu-fiog' of https://github.com/ErwanAliasr1/fio:
  examples: Avoid duplicated items
  tools: Adding fiograph

2 years agoexamples: Avoid duplicated items
Erwan Velu [Sun, 27 Jun 2021 21:06:03 +0000 (23:06 +0200)]
examples: Avoid duplicated items

Some jobs were defining variable twice,
some jobs were defined twice.

This commit ensure that examples are items are named only once.

Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
2 years agotools: Adding fiograph
Erwan Velu [Wed, 16 Jun 2021 13:16:25 +0000 (15:16 +0200)]
tools: Adding fiograph

This tool generates graphviz graphs of any fio job file.

Reading a fio file can be sometimes tricky when :
  - you have lots of jobs
  - jobs override some options
  - jobs have dependencies

Understanding which jobs are running at the same time, which one waits
for which is sometimes difficult and could easily lead to mistakes.
It's pretty common to find jobs where people think jobs are sequential
while some run in parallel.

For ease the understanding of the scheduling and what's the
configuration status (local + global variables), this tool will use some
graphical helpers to enlighten things.

The configuration file can be used to adjust the rendering but by default :
  - jobs are defined in a blue rounded box
  - jobs running at the same time are inside the same gray background
  - time & size variables are shown as a self arrow
  - dependencies between jobs are shown by up->down black arrows
  - specific engines options are written in blue (top of the job box)
  - standard options are printed in green (bottom of the job box)
  - pre/post actions are printed in red (head/tail of the job box)
  - numjobs is replaced by a 'x' multiplicator on the job name

Several output formats can be defined via --format : list can be found
here https://graphviz.org/docs/outputs/

if --view option is used, the rendered file will be immediately shown.

if --keep is used, the grapvhiz file will be kept.

This commit also adds the rendering of the examples jobs.
If a newcomer gets into the repository, they can immediately better
understand what the jobs do.

Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
2 years agoMerge branch 'pkg_config_1' of https://github.com/kusumi/fio
Jens Axboe [Sun, 20 Jun 2021 16:44:49 +0000 (10:44 -0600)]
Merge branch 'pkg_config_1' of https://github.com/kusumi/fio

* 'pkg_config_1' of https://github.com/kusumi/fio:
  configure: silence "pkg-config: not found"

2 years agofilehash: ignore hashed file with fd == -1
Jens Axboe [Thu, 17 Jun 2021 16:55:20 +0000 (10:55 -0600)]
filehash: ignore hashed file with fd == -1

This can happen sporadically during setup, and it need not be a
failure condition.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agot/zbd: update test case 42
Niklas Cassel [Mon, 14 Jun 2021 13:49:05 +0000 (13:49 +0000)]
t/zbd: update test case 42

Update test case 42 to grep for the new string printed by fio when
--zonesize=0 is supplied.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: change some f->zbd_info conditionals to asserts
Niklas Cassel [Mon, 14 Jun 2021 13:49:05 +0000 (13:49 +0000)]
zbd: change some f->zbd_info conditionals to asserts

Unfortunately, generic fio code calls some zbd_* functions unconditionally.
These functions will be called regardless if zonemode == ZONE_MODE_NONE,
ZONE_MODE_STRIDED or ZONE_MODE_ZBD, and cannot be optimized.

However, some functions are only called when zonemode == ZONE_MODE_ZBD.
Since f->zbd_info will always be non-NULL for a job with zonemode=zbd,
these functions can be optimized to not check if f->zbd_info is set.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: remove zbd_zoned_model ZBD_IGNORE
Niklas Cassel [Mon, 14 Jun 2021 13:49:04 +0000 (13:49 +0000)]
zbd: remove zbd_zoned_model ZBD_IGNORE

For a job with zonemode=zbd, we do not want any file to be ignored.
Each file's file type in that job should be supported by either zbd.c
or the ioengine. If not, we should return an error.
This way, ZBD_IGNORE becomes redundant and can be removed.

By removing ZBD_IGNORE, we know that all files belonging to a job that
has zonemode=zbd set, will either be a zoned block device, or emulate
a zoned block device.

This means that for jobs that have zonemode=zbd, f->zbd_info will always
be non-NULL. This will make the zbd code slightly easier to reason about
and to maintain.

When removing zbd_zoned_model ZBD_IGNORE, define the new first enum value
as 0x1, so that we avoid potential ABI problems with existing binaries.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: allow zonemode=zbd with regular files by emulating zones
Niklas Cassel [Mon, 14 Jun 2021 13:49:04 +0000 (13:49 +0000)]
zbd: allow zonemode=zbd with regular files by emulating zones

Currently when using zonemode=zbd and running against a regular file,
fio will fail with:
fio: file hash not empty on exit

Treat regular files just like how we treat regular (non-zoned) block
devices: return ZBD_NONE and let zbd.c emulate zones inside the regular
file/block device.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: disallow pipes for zonemode=zbd
Niklas Cassel [Mon, 14 Jun 2021 13:49:03 +0000 (13:49 +0000)]
zbd: disallow pipes for zonemode=zbd

zoned block device support in fio cannot handle pipes,
so simply reject them and give a clear error message.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoio_uring: drop redundant IO_MODE_OFFLOAD check
Stefan Hajnoczi [Thu, 10 Jun 2021 15:55:39 +0000 (16:55 +0100)]
io_uring: drop redundant IO_MODE_OFFLOAD check

check_engine_ops() already returns an error if io_submit_mode is
IO_MODE_OFFLOAD and the engine is marked FIO_NO_OFFLOAD.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agot/zbd: Fix write target zones counting in test case #31
Shin'ichiro Kawasaki [Fri, 4 Jun 2021 11:32:52 +0000 (20:32 +0900)]
t/zbd: Fix write target zones counting in test case #31

The test case #31 in t/zbd/test-zbd-support writes 128KB data to
sequential write required zones as the preparation for the following
random read test. The data write leaves the target zones in open status.
The test case refers the variable 'nz', which has max_open_zones value,
to decide how many zones to write the data. However, the end condition
of the write target zone loop has a bug. The disk end offset is used as
the loop end condition, which does not match the last target zone when
number of sequential write required zones divided by nz has remainder.
This results in write to more zones than nz=max_open_zones limit and the
test case failure. To fix the bug and to simplify the script, avoid the
loop and utilize zonemode strided to achieve the same data write
pattern. Also specify size and io_size using nz to reliably count the
write target zones.

Even with the fix above, still the number of open zones may exceed
max_open_zones since other test cases executed before the test case 31
may leave open zones on the test target device. To avoid this failure,
reset all zones before the data write.

The failures were observed with libzbc I/O engine after the commit
e8267436fd7a ("engines/libzbc: add support for the get_max_open_zones io
op"), which changed the max_open_zones value fio refers.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agot/zbd: Add ignore_zone_limit option to test with special max_open_zones
Shin'ichiro Kawasaki [Fri, 4 Jun 2021 11:32:51 +0000 (20:32 +0900)]
t/zbd: Add ignore_zone_limit option to test with special max_open_zones

Recent commit d2f442bc0bd5 ("ioengines: add get_max_open_zones zoned
block device operation") modified fio to compare --max_open_zones option
value and max_open_zones reported by the device. When the option
--max_open_zones is larger than the device limit, fio exits with an
error. However, sometimes it is useful to run fio with --max_open_zones
larger than the device limit to check performance impact of implicit
zone open and close by the zoned block devices. The test script
t/zbd/test-zbd-support has an option -o so that users can specify such
larger max_open_zones value. After the commit, such test runs fail with
the fio error.

To avoid the failure, modify the test script to specify another option
--ignore_zone_limits to fio command, which was added by the commit
575686bb85fa (zbd: add a new --ignore_zone_limits option). This option
is added to fio command only when users specify -o option and special
max_open_zones value to the test script. This change does not affect
default test conditions.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agot/zbd: Use max_open_zones that fio fetched from device
Shin'ichiro Kawasaki [Fri, 4 Jun 2021 11:32:50 +0000 (20:32 +0900)]
t/zbd: Use max_open_zones that fio fetched from device

Recent commit d2f442bc0bd5 ("ioengines: add get_max_open_zones zoned
block device operation") modified fio to compare --max_open_zones option
value and max_open_zones reported by the device. The device limit is
fetched through sysfs or through an ioengine specific implementation.

The test script currently try to fetch the max open zones limit using
libzbc tools or sg_inq. If either of these fail, default value 128 is
supplied. This default value can be too high when the test script is
run for certain zoned block devices, and can therefore result in fio
error and test case failure.

To avoid the failure, modify the default value used in the test script
from 128 to 0. With this, --max_open_zones=0 is passed to fio, and it
makes fio use the max_open_zones reported by the device. Also add
comments to describe why the test script gets max_open_zones with tools.

Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoconfigure: silence "pkg-config: not found"
Tomohiro Kusumi [Tue, 8 Jun 2021 17:14:34 +0000 (02:14 +0900)]
configure: silence "pkg-config: not found"

Do what check_min_lib_version() does to not print the error message
when pkg-config doesn't exist.

--
DAOS File System (dfs) Engine no
./configure: pkg-config: not found
NFS engine                    no

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
2 years agoMerge branch 'fix/928' of https://github.com/larsks/fio
Jens Axboe [Thu, 3 Jun 2021 15:01:52 +0000 (09:01 -0600)]
Merge branch 'fix/928' of https://github.com/larsks/fio

* 'fix/928' of https://github.com/larsks/fio:
  fix fio2gnuplot to work with new logging format

2 years agoMerge branch 'evelu-test' of https://github.com/ErwanAliasr1/fio
Jens Axboe [Thu, 3 Jun 2021 13:45:22 +0000 (07:45 -0600)]
Merge branch 'evelu-test' of https://github.com/ErwanAliasr1/fio

* 'evelu-test' of https://github.com/ErwanAliasr1/fio:
  Makefile: Avoid using built-in stpcpy during clang build
  ci: Reporting installed msys2 packages
  ci: Installing missing toolchain

2 years agoMakefile: Avoid using built-in stpcpy during clang build
Erwan Velu [Wed, 2 Jun 2021 14:15:59 +0000 (16:15 +0200)]
Makefile: Avoid using built-in stpcpy during clang build

Since clang 12, during the clang build, noticed by the CI, the linking
fails as clang optimize some string functions to stpcpy.

  LINK fio
lld-link: error: undefined symbol: stpcpy
>>> referenced by C:\projects\fio\options.c:5305
>>>               options.o:(fio_options_parse)

Two possible implementations :
- Adding stpcpy in fio as the kernel did : https://lore.kernel.org/lkml/20200815002417.1512973-1-ndesaulniers@google.com/T/
- Disable the implicit stpcpy

To avoid adding code into fio, the latter option was used.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
2 years agoci: Reporting installed msys2 packages
Erwan Velu [Wed, 2 Jun 2021 13:52:06 +0000 (15:52 +0200)]
ci: Reporting installed msys2 packages

When reproducing a build locally, it's important to be on the same
release as the CI.

So let's listi the installed packages so we can compare the two builds more easily.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
2 years agoci: Installing missing toolchain
Erwan Velu [Wed, 2 Jun 2021 13:05:17 +0000 (15:05 +0200)]
ci: Installing missing toolchain

When trying to rebuild a failed build on a real windows system,
the toolchain is missing.

Let's add the toolchain here so we can reuse the script locally too.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
2 years agozbd: add a new --ignore_zone_limits option
Niklas Cassel [Thu, 27 May 2021 11:12:32 +0000 (11:12 +0000)]
zbd: add a new --ignore_zone_limits option

In commit d2f442bc0bd5 ("ioengines: add get_max_open_zones zoned block
device operation") we added a check that verifies that the specified
--max_open_zones value is lower than the max value reported by the device.

For ZNS devices there is a max open zones and a max active zones limit.
For ZAC/ZBC devices there is only a max open zones limit.

On ZAC/ZBC, there is thus no limit on the amount of zones that can be
in zone state closed.
When doing a write to an empty or closed zone, a ZAC/ZBC drive will
close an arbitrary implicit open zone in order to handle the write.

The ZNS specification has no requirement on closing a zone in order to
handle a write to an empty or closed zone. The drive is free to return
an error.

Even on ZAC/ZBC, you do not want to exceed the max open zones limit,
since it will lead to additional implicit close zone and implicit open
zone operations, which may degrade performance.
However, it seems that this is sometimes done on purpose, in order to
measure the overhead of these additional operations. Therefore, add
an option that allows the user to ignore the reported device limits.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: add missing client/server support for option max_open_zones
Niklas Cassel [Thu, 27 May 2021 11:12:31 +0000 (11:12 +0000)]
zbd: add missing client/server support for option max_open_zones

Ensure that we convert the max_open_zones option for client/server.

Use __cpu_to_le32()/__le32_to_cpu() rather than
cpu_to_le32()/le32_to_cpu(), since max_open_zones is defined
as int rather than unsigned int in thread_options.h.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'fix-libpmem' of https://github.com/lukaszstolarczuk/fio
Jens Axboe [Thu, 27 May 2021 22:04:16 +0000 (16:04 -0600)]
Merge branch 'fix-libpmem' of https://github.com/lukaszstolarczuk/fio

* 'fix-libpmem' of https://github.com/lukaszstolarczuk/fio:
  engines/libpmem: do not call drain on close
  engines/libpmem: cleanup a little code, comments and example
  engines/libpmem: set file open/create mode always to RW

2 years agoFio 3.27 fio-3.27
Jens Axboe [Wed, 26 May 2021 16:10:32 +0000 (10:10 -0600)]
Fio 3.27

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'master' of https://github.com/DevriesL/fio
Jens Axboe [Tue, 25 May 2021 22:54:13 +0000 (16:54 -0600)]
Merge branch 'master' of https://github.com/DevriesL/fio

* 'master' of https://github.com/DevriesL/fio:
  android: add support for NDK sharedmem

2 years agoandroid: add support for NDK sharedmem
DevriesL [Tue, 25 May 2021 15:45:11 +0000 (23:45 +0800)]
android: add support for NDK sharedmem

Android add support for NDK sharedmem since API level 26 and prohibit
the directly use of ashmem since API level 29, so we can use sharedmem
if targeting API level is higher than 26.

Signed-off-by: DevriesL <therkduan@gmail.com>
2 years agoMerge branch 'taras/nfs-upstream' of https://github.com/tarasglek/fio-1
Jens Axboe [Tue, 18 May 2021 23:34:38 +0000 (17:34 -0600)]
Merge branch 'taras/nfs-upstream' of https://github.com/tarasglek/fio-1

* 'taras/nfs-upstream' of https://github.com/tarasglek/fio-1:
  clean up nfs example
  skip skeleton comments
  single line bodies
  C-style comments
  NFS configure fixes
  NFS engine

2 years agoMerge branch '2021-05-13/stat-fix-integer-overflow' of https://github.com/flx42/fio
Jens Axboe [Fri, 14 May 2021 15:36:59 +0000 (09:36 -0600)]
Merge branch '2021-05-13/stat-fix-integer-overflow' of https://github.com/flx42/fio

* '2021-05-13/stat-fix-integer-overflow' of https://github.com/flx42/fio:
  stat: fix integer overflow in convert_agg_kbytes_percent

2 years agoengines/libzbc: add support for the get_max_open_zones io op
Niklas Cassel [Fri, 14 May 2021 12:53:15 +0000 (12:53 +0000)]
engines/libzbc: add support for the get_max_open_zones io op

Add support for the new .get_max_open_zones io operation.

zbc.c will only ever call this callback for host-managed devices.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoioengines: add get_max_open_zones zoned block device operation
Niklas Cassel [Fri, 14 May 2021 12:53:14 +0000 (12:53 +0000)]
ioengines: add get_max_open_zones zoned block device operation

Define a new IO engine operation to get the maximum number of open zones.
Like the existing IO engine operations: .get_zoned_model, .report_zones,
and .reset_wp, this new IO engine operation is only valid for zoned block
devices.

Similarly to the other zbd IO engine operations, also provide a default
implementation inside oslib/linux-blkzoned.c that will be used if the
ioengine does not override it.

The default Linux oslib implementation is implemented similarly to
blkzoned_get_zoned_model(), i.e. it will return a successful error code
even when the sysfs attribute does not exist.
This is because the sysfs max_open_zones attribute was introduced first
in Linux v5.9.
All error handling is still there, so an ioengine that provides its own
implementation will still have its error code respected properly.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agooslib/linux-blkzoned: move sysfs reading into its own function
Niklas Cassel [Fri, 14 May 2021 12:52:51 +0000 (12:52 +0000)]
oslib/linux-blkzoned: move sysfs reading into its own function

Move the sysfs reading into its own function so that it can be reused.
This new function will be reused in a following patch.

No functional change intended.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agozbd: only put an upper limit on max open zones once
Niklas Cassel [Fri, 14 May 2021 12:52:51 +0000 (12:52 +0000)]
zbd: only put an upper limit on max open zones once

There is an upper limit that is checked for each td, and for each file,
even though a file has a pointer to a zoned_block_device_info that has
already been created. Multiple files, from the same or from another td
can point to the same zoned_block_device_info.
All zoned_block_device_info:s have already been created earlier in the
call chain.

Simplify this by only checking the upper limit on max open zones when a
zoned_block_device_info is created.

This way, max_open_zones is handled from a single location, instead of
potentially being reassigned from a completely different location.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agostat: fix integer overflow in convert_agg_kbytes_percent
Felix Abecassis [Fri, 14 May 2021 00:02:40 +0000 (17:02 -0700)]
stat: fix integer overflow in convert_agg_kbytes_percent

Assuming that "int" is 32-bit, for high bandwidth values (> 21.5 GB/s)
the expression "mean * 100" will cause an integer overflow before the
conversion to "double" happens.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2 years agofix fio2gnuplot to work with new logging format
Lars Kellogg-Stedman [Wed, 12 May 2021 22:41:43 +0000 (18:41 -0400)]
fix fio2gnuplot to work with new logging format

The logging format updates documented in 1a953d97 were never
propagated to fio2gnuplot, which since then has been failing with a
ValueError exception.

This commit explicits limits fio2gnuplot to only reading the first
4 columns in the log file.

Closes #928

2 years agoos: define EDQUOT to EIO if the OS doesn't provide it
Jens Axboe [Tue, 11 May 2021 13:58:03 +0000 (07:58 -0600)]
os: define EDQUOT to EIO if the OS doesn't provide it

Fixes: 418f53993b07 ("Make fill_device to stop writing on EDQUOT")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMake fill_device to stop writing on EDQUOT
Martin Bukatovic [Tue, 11 May 2021 07:38:55 +0000 (09:38 +0200)]
Make fill_device to stop writing on EDQUOT

Option fill_device stops writing when we run out of quota as well.

Signed-off-by: Martin Bukatovic <martin.bukatovic@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoMerge branch 'z_unit_docs' of https://github.com/ahribeng/fio
Jens Axboe [Tue, 11 May 2021 03:16:58 +0000 (21:16 -0600)]
Merge branch 'z_unit_docs' of https://github.com/ahribeng/fio

* 'z_unit_docs' of https://github.com/ahribeng/fio:
  Add Documentation for z unit

2 years agooslib/linux-blkzoned: make sure that we always support zone capacity
Niklas Cassel [Thu, 6 May 2021 13:18:45 +0000 (13:18 +0000)]
oslib/linux-blkzoned: make sure that we always support zone capacity

A common problem is that users upgrade their kernel to support NVMe ZNS
devices, however, they still use the kernel uapi headers provided by their
distro.

This means that even if the kernel will populate the zone capacity fields
for each zone in the zone report returned by the ioctl, fio will not know
how to interpret that data.

This leads to fio writing past the zone capacity, which will lead to
I/O errors.

It is not trivial for a user to realize that the kernel uapi headers
provided by their distro is the reason for these I/O errors.

In order to make it easier for these users, provide a copy of the current
zoned block device kernel uapi structs.

If the kernel uapi headers installed on the system are too old to support
zone capacity, use the locally defined structs instead.
If the installed headers are new enough to support zone capacity, use the
installed headers.

This way, fio will always be able to handle zone capacity (if the kernel
supports it). At the same time, we will not redefine any structs from the
installed headers if they are newer than our locally defined structs.

Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agodon't access dlclose'd dynamic ioengine object after close
Eric Sandeen [Fri, 7 May 2021 21:13:05 +0000 (16:13 -0500)]
don't access dlclose'd dynamic ioengine object after close

Alexey reported this bug when using dynamically loaded IO engines;
a segfault on the line where we set the dlhandle to NULL after
the dlclose.

I think this is because ops points to the thing we obtained from dlsym:

ops = dlsym(dlhandle, engine_lib);

and after the final dlclose, the object no longer exists and efforts
to set the handle within it will fail for obvious reasons.
I'm not sure why I hadn't seen this before.

Fixes-RH-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1956963
Reported-by: Alexey Dobriyan <adobriyan@gmail.com>
Fixes: f6931a1 ("fio: move dynamic library handle to io_ops structure")
Tested-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoAdd Documentation for z unit
Gonzalez [Thu, 6 May 2021 18:15:41 +0000 (11:15 -0700)]
Add Documentation for z unit

2 years agoconfigure: fix check_min_lib_version() eval
Stefan Hajnoczi [Thu, 6 May 2021 16:23:31 +0000 (17:23 +0100)]
configure: fix check_min_lib_version() eval

The following shell statement:

  if eval "echo \$$_feature" = "yes" ; then

executes:

  echo $... = "yes"

It does not actually compare the variable named by $_feature to the
string "yes".

Add the missing "test" call so the comparison happens as intended and
wrap the eval so it doesn't include the = "yes".

Fixes: 3e48f7c9de61 ("configure: fix syntax error with NetBSD")
Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoclean up nfs example
Taras Glek [Wed, 5 May 2021 16:11:06 +0000 (09:11 -0700)]
clean up nfs example

2 years agoskip skeleton comments
Taras Glek [Wed, 5 May 2021 16:04:56 +0000 (09:04 -0700)]
skip skeleton comments

2 years agosingle line bodies
Taras Glek [Wed, 5 May 2021 16:02:20 +0000 (09:02 -0700)]
single line bodies

2 years agoC-style comments
Taras Glek [Wed, 5 May 2021 16:00:13 +0000 (09:00 -0700)]
C-style comments

2 years agoioengines: don't call zbd_put_io_u() for engines not implementing commit
Niklas Cassel [Tue, 27 Apr 2021 17:41:14 +0000 (17:41 +0000)]
ioengines: don't call zbd_put_io_u() for engines not implementing commit

Commit d9ed3e63e528 ("zbd: Fix zone locking for async I/O engines") added
a call to zbd_put_io_u() in the case where td->io_ops->commit callback
is not implemented on an ioengine.

The commit in question fails to mention why this zbd_put_io_u() call was
added for ioengines not implementing the commit callback.

The code in td_io_queue() looks like this:

ret = td->io_ops->queue(td, io_u);
zbd_queue_io_u(td, io_u, ret);

if (!td->io_ops->commit) {
io_u_mark_submit(td, 1);
io_u_mark_complete(td, 1);
zbd_put_io_u(td, io_u);
}

SYNC I/O engine case (e.g. psync):
The zone will be locked by zbd_adjust_block(), td->io_ops->queue(td, io_u),
which for a sync I/O engine will return FIO_Q_COMPLETED.

This return value will be send in to zbd_queue_io_u(), which at the end
of the function, unlocks the zone if the return value from ->queue()
differs from FIO_Q_QUEUED. For a sync I/O engine, the zone will be
unlocked here, and io_u->zbd_put_io function pointer will be set to NULL.

psync does not implement the ->commit() callback, so it will call
zbd_put_io_u(), which will do nothing, because the io_u->zbd_put_io
pointer is NULL.

ASYNC I/O engine case (e.g. io_uring):
The zone will be locked by zbd_adjust_block(), td->io_ops->queue(td, io_u),
which for an async I/O engine will return FIO_Q_QUEUED.

This return value will be send in to zbd_queue_io_u(), which at the end
of the function, unlocks the zone if the return value from ->queue()
differs from FIO_Q_QUEUED. For an async I/O engine, the zone will not be
unlocked here, so the io_u->zbd_put_io function pointer will still be set.

io_uring does implement the ->commit() callback, so it will not call
zbd_put_io_u() here at all.

Instead zbd_put_io_u() will be called by do_io() -> wait_for_completions()
-> io_u_queued_complete() -> ios_completed() -> put_io_u() -> zbd_put_io_u(),
which will unlock the zone and will set the io_u->zbd_put_io function pointer
to NULL.

In conclusion, the zbd_put_io_u() should never had been added in the case
where the ->commit() callback wasn't implemented in the first place,
and removing it shouldn't affect ioengines psync or io_uring.

Commit d9ed3e63e528 ("zbd: Fix zone locking for async I/O engines")
probably made the assumption that an async I/O engine == the ->commit()
callback is implemented, however, this is not true, there are async
I/O engines in tree (and out of tree), that does not implement the
->commit() callback. Instead, an async I/O engine is recognized by
the ->queue() callback returning FIO_Q_QUEUED.

Removing the invalid zbd_put_io_u() call will ensure that a zone is not
prematurely unlocked for async I/O engines that do not implement the
->commit() callback. Unlocking a zone prematurely leads to I/O errors.

Fixes: d9ed3e63e528 ("zbd: Fix zone locking for async I/O engines")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agoThe GPL isn't a EULA: remove it and introduce WixUI_Minimal_NoEULA
Rebecca Cran [Thu, 22 Apr 2021 02:32:25 +0000 (20:32 -0600)]
The GPL isn't a EULA: remove it and introduce WixUI_Minimal_NoEULA

The GPL shouldn't be used as a EULA in an installer.
Remove it, and since the WixUI_Minimal dialog set requires a EULA
create a custom WixUI_Minimal_NoEULA set.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge branch 'pthread_getaffinity_1' of https://github.com/kusumi/fio
Jens Axboe [Sun, 25 Apr 2021 16:23:34 +0000 (10:23 -0600)]
Merge branch 'pthread_getaffinity_1' of https://github.com/kusumi/fio

* 'pthread_getaffinity_1' of https://github.com/kusumi/fio:
  gettime: Fix compilation on non-Linux with pthread_getaffinity_np()

3 years agogettime: Fix compilation on non-Linux with pthread_getaffinity_np()
Tomohiro Kusumi [Sun, 25 Apr 2021 15:10:40 +0000 (00:10 +0900)]
gettime: Fix compilation on non-Linux with pthread_getaffinity_np()

874d55e50c("os/os-linux: add pthread CPU affinity helper") and a few
commits after that broke compilation on non-Linux platforms which support
pthread_getaffinity_np().

Define fio_get_thread_affinity() on non-Linux platforms, and make gettime
test FIO_HAVE_GET_THREAD_AFFINITY which may or may not depend on pthread.
FIO_HAVE_GET_THREAD_AFFINITY is currently not defined on Windows.

Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
3 years agoMerge branch 'gpspm-add-optional-use-rpma_conn_completion_wait-function' of https...
Jens Axboe [Fri, 23 Apr 2021 14:39:21 +0000 (08:39 -0600)]
Merge branch 'gpspm-add-optional-use-rpma_conn_completion_wait-function' of https://github.com/ldorau/fio

* 'gpspm-add-optional-use-rpma_conn_completion_wait-function' of https://github.com/ldorau/fio:
  rpma: gpspm: introduce the busy_wait_polling toggle

3 years agorpma: gpspm: introduce the busy_wait_polling toggle
Oksana Salyk [Fri, 23 Apr 2021 06:09:44 +0000 (08:09 +0200)]
rpma: gpspm: introduce the busy_wait_polling toggle

The performance of the librpma_gpspm engine depends heavily
on how much CPU power it can use to its work.
One can want either to take all available CPU power
and see what the maximum possible performance is
or configure it less aggressively and collect the results
when the CPU is not solely dedicated to doing this one task.

The librpma_gpspm engine allows toggling between one and another
by either waiting for incoming requests in the kernel
using rpma_conn_completion_wait() (busy_wait_polling=0)
or trying to collect the completion as soon as it appears
by polling all the time using rpma_conn_completion_get()
(busy_wait_polling=1).

Signed-off-by: Oksana Salyk <oksana.salyk@intel.com>