fio.git
3 months agot/fiotestlib: display stderr size when it is not empty but should be
Vincent Fu [Wed, 5 Feb 2025 01:44:31 +0000 (01:44 +0000)]
t/fiotestlib: display stderr size when it is not empty but should be

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/fiotestlib: improve JSON decoding
Vincent Fu [Tue, 4 Feb 2025 19:52:28 +0000 (19:52 +0000)]
t/fiotestlib: improve JSON decoding

Sometimes error/informational messages appear at the end of the JSON
data. Try to parse as JSON only the text between the first { and the
last }.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/fiotestcommon: do not require nvmecdev argument for Requirements
Vincent Fu [Wed, 29 Jan 2025 22:29:23 +0000 (22:29 +0000)]
t/fiotestcommon: do not require nvmecdev argument for Requirements

Enable Requirements checking for test suites that do not have an
nvmecdev argument. macOS does not support NUMA placement so we need to
skip some tests on that platform when the test suite does not have an
nvmecdev argument. This will be used in an upcoming patch for a set of
verify tests.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoverify: adjust fio_offset_overlap_risk to include randommap
Ankit Kumar [Thu, 30 Jan 2025 14:57:12 +0000 (20:27 +0530)]
verify: adjust fio_offset_overlap_risk to include randommap

Currently we are using a list to log I/O history if:
 * randommap is enabled and fio manages to allocate memory for it.
 * there are no offset modfiers with any jobs.
For any different scenario we use an RB tree to handle offset overlaps,
which disables header seed checks for them.

This commit expands fio_offset_overlap_risk() such that it covers
file_randommap() cases.
For random workload with this change these are the possible scenarios

 -----------------------------------------------------------------------
|                 |         norandommap=0              |  norandommap=1 |
|-----------------------------------------------------------------------|
| softrandommap=0 |        list (No change)            |    RB tree     |
|                 | (fio was able to allocate memory)  |  (No change)   |
|-----------------|------------------------------------|----------------|
|                 |      RB tree (Now always)          |    RB tree     |
| softrandommap=1 |Even if fio was able to allocate mem|  (No Change)   |
 -----------------------------------------------------------------------

With randommap enabled and softrandommap=1 we now always use an RB tree,
even when fio is able to allocate memory for random map. In this case
verify header seed check will be disabled. If users want to check header
seed they can either disable softrandommap or explicilty enable
verify_header_seed.

Effectively this changes randommap from being a per-file property to
per-job property.

This also fixes rand seed mismatch isues, that have been observed when
multiple files are used, such as for the below mentioned configuration.

[global]
do_verify=1
verify=md5
direct=1
[multi_file]
rw=readwrite
directory=.
nrfiles=2
size=32K

Here is the truncated log with debug=verify flag, and an extra log when
the seed gets generated as well as the mismatch.

verify   368109 file ./multi_file.0.1 seed 46386204153304124 offset=0, length=4096
verify   368109 file ./multi_file.0.0 seed 9852480210356360750 offset=0, length=4096
verify   368109 file ./multi_file.0.1 seed 4726550845720924880 offset=4096, length=4096
verify: bad header rand_seed 9852480210356360750, wanted 46386204153304124 at file ./multi_file.0.0 offset 0, length 4096 (requested block: offset=0, length=4096)

Earlier the I/O entries were getting logged in an RB tree, as we were
relying on file_randommap(), which was false for sequential workloads.
In RB tree, files are prioritized first and then the offset. Thus during
the verify phase the I/O entries are removed from tree in order of file
and then offset which is not how it was originally written. With the new
checks, for sequential workload we now store the entries in the list
instead of RB tree.
Even for sequential workload if the user fortuitously specified
norandommap or softrandommap, then I/Os will be stored in an RB tree.
However in this case header seed checks will be disabled.

fixes #740
fixes #746
fixes #844
fixes #1538

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: fix verify issue with offest modifiers
Ankit Kumar [Fri, 14 Feb 2025 19:48:34 +0000 (01:18 +0530)]
verify: fix verify issue with offest modifiers

Offset modifiers such as rw=readwrite:8 or rw=write:4K can create
overlaps. For these cases use RB tree instead of list to log the I/O
entries.

Add a helper function fio_offset_overlap_risk() to decide whether to log
the I/O entry in an RB tree or a list.

Disable header seed verification if there are offset modifiers, unless
its explicitly enabled.

fixes #1503

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoinit: fixup verify_offset option
Ankit Kumar [Tue, 28 Jan 2025 14:46:14 +0000 (20:16 +0530)]
init: fixup verify_offset option

Verify offset should swap verification header within the verify interval.
If this is not the case return error. Update the doc. accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agobackend: fix verify issue during readwrite
Ankit Kumar [Tue, 28 Jan 2025 19:41:36 +0000 (01:11 +0530)]
backend: fix verify issue during readwrite

In readwrite mode if specified io_size > size, offsets can overlap.
This will result in verify errors. Add check to handle this case.

Fixes: d782b76f ("Don break too early in readwrite mode")

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: disable write sequence checks with norandommap and iodepth > 1
Ankit Kumar [Wed, 29 Jan 2025 18:34:58 +0000 (00:04 +0530)]
verify: disable write sequence checks with norandommap and iodepth > 1

With norandommap for async I/O engines specifying I/O depth > 1, it is
possible that two or more writes with the same offset are queued at once.
When fio tries to verify the block, it may find a numberio mismatch
because the writes did not land on the media in the order that they were
queued. Avoid these spurious failures by disabling sequence number
checking. Users will still be able to enable sequence number checking
if they explicitly set the verify_header_sequence option.

fio -name=verify -ioengine=libaio -rw=randwrite -verify=sha512 -direct=1 \
-iodepth=32 -filesize=16M -bs=512 -norandommap=1 -debug=io,verify

Below is the truncated log for the above command demonstrating the issue.
This includes extra log entries when write sequence number is saved and
retrieved.

set: io_u->numberio=28489, off=0x5f2400
queue: io_u 0x5b8039e30d40: off=0x5f2400,len=0x200,ddir=1,file=verify.0.0
set: io_u->numberio=28574, off=0x5f2400
iolog: overlap 6235136/512, 6235136/512
queue: io_u 0x5b8039e75500: off=0x5f2400,len=0x200,ddir=1,file=verify.0.0
complete: io_u 0x5b8039e75500: off=0x5f2400,len=0x200,ddir=1,file=verify.0.0
complete: io_u 0x5b8039e30d40: off=0x5f2400,len=0x200,ddir=1,file=verify.0.0

retrieve: io_u->numberio=28574, off=0x5f2400
queue: io_u 0x5b8039e1db40: off=0x5f2400,len=0x200,ddir=0,file=verify.0.0

bad header numberio 28489, wanted 28574 at file verify.0.0 offset 6235136, length 512 (requested block: offset=6235136, length=512)

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: fix verify issues with norandommap
Ankit Kumar [Wed, 29 Jan 2025 18:00:24 +0000 (23:30 +0530)]
verify: fix verify issues with norandommap

When norandommap is enabled, fio logs the I/O entries in a RB tree. This
is to account for offset overlaps and overwrites. Then during verify
phase, the I/O entries are picked from the top and in this case the
smallest offset is verified first and so on. This creates a mismatch
during the header verification as the seed generated at the time of read
differs from what was logged during write. Skip seed verification in
this scenario.

fixes #1756

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: header seed check for read only workloads
Ankit Kumar [Fri, 14 Feb 2025 18:35:11 +0000 (00:05 +0530)]
verify: header seed check for read only workloads

For read jobs, users should have the option to verify header seeds at a
later point of time. Currently for read jobs header seeds are not
generated

Consider the below mentioned write followed by read workloads. Here fio
should allow header seed verification.

fio --name=test --filesize=16k --rw=randwrite --verify=md5
fio --name=test --filesize=16k --rw=randread --verify=md5 --verify_header_seed=1

However there are other scenarios where header seed verification will
fail. These include:
 * randrepeat is set to false, leading to different seed across runs.
 * randseed is different across write and read workloads.
 * Read workload is changed from sequential to random or vice versa
   across runs.
 * Read workloads run in the same invocation as write, i.e. a write job
   followed by a stonewall read job. Header seed verification will fail
   because random seeds vary between jobs. Refer t/jobs/t0029.fio

If verify_header_seed is explicitly enabled, fio will verify header seed
for the workload.

This reverts part of commit mentioned below
Fixes: def41e55 ("verify: decouple seed generation from buffer fill")

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: disable header seed check for verify_only jobs
Ankit Kumar [Fri, 14 Feb 2025 18:08:03 +0000 (23:38 +0530)]
verify: disable header seed check for verify_only jobs

For the invoked verify_only job, header seed can match only if it
exactly matches the original write job. This means either randrepeat
should be true, or we must use the same randseed which was used with the
original write job. After write the verify_only workload shouldn't be
changed from sequential to random or vice versa.

Considering these constraints disable verify_header_seed for verify_only
jobs. Users will still be able to enable header seed checking if they
explicitly set the verify_header_sequence option.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: enable header seed check for 100% write jobs
Ankit Kumar [Thu, 13 Feb 2025 01:14:37 +0000 (06:44 +0530)]
verify: enable header seed check for 100% write jobs

There are 3 modes where verify can be performed. write, read and
readwrite. The existing readwrite condition prohibits header seed check
for write or read workloads. For write workloads, there shouldn't be any
extra limitation that triggers header seed mismatch which cannot be
triggered with readwrite workloads. Hence modify this condition to only
disable verify header seed checks for read workload.

The subsequent patches fixes header seed mismatch issues.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: disable header seed checking instead of overwriting it
Ankit Kumar [Fri, 7 Feb 2025 17:53:13 +0000 (23:23 +0530)]
verify: disable header seed checking instead of overwriting it

The existing header seed is overwritten if zone reset frequency is set or
if verify backlog is enabled. Disable verify header seed check for these
scenarios, unless there is an explicit request to enable it.

Note: There is no fio behavior change intended by this patch.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agofio: add verify_header_seed option
Ankit Kumar [Fri, 7 Feb 2025 17:44:15 +0000 (23:14 +0530)]
fio: add verify_header_seed option

Add a new option to disable the verify header seed check. The header
seed check is enabled by default.
There have been numerous issues observed with header seed mismatch. Hence
this allows end user to disable this check, and proceed with the checksum
verification. This is similar to option verify_write_sequence, which
allows the capability to disable write sequence number check.

Update the documentation accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoinit: write sequence behavior change for verify_only mode
Ankit Kumar [Fri, 14 Feb 2025 17:21:00 +0000 (22:51 +0530)]
init: write sequence behavior change for verify_only mode

Change the behavior for verify_only mode to not disable
verify_write_sequence unless its explicitly enabled.

Update the fio doc. accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoverify: add missing client/server support for verify_write_sequence
Ankit Kumar [Fri, 14 Feb 2025 16:53:00 +0000 (22:23 +0530)]
verify: add missing client/server support for verify_write_sequence

Ensure that we convert verify_write_sequence option for client/server.

Fixes: 2dd80ee4 ("fio: Support verify_write_sequence")

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agofilesetup: remove unnecessary check
Ankit Kumar [Wed, 22 Jan 2025 21:15:47 +0000 (02:45 +0530)]
filesetup: remove unnecessary check

If read_iolog_file is set, the goto statement moves it beyond this
point. So remove this redundant check.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
3 months agoMerge branch 'update-docs-for-compare' of https://github.com/minwooim/fio
Vincent Fu [Wed, 5 Mar 2025 17:05:52 +0000 (12:05 -0500)]
Merge branch 'update-docs-for-compare' of https://github.com/minwooim/fio

* 'update-docs-for-compare' of https://github.com/minwooim/fio:
  docs: update docs for verify_mode=compare of io_uring_cmd

3 months agodocs: update docs for verify_mode=compare of io_uring_cmd
Minwoo Im [Sat, 1 Mar 2025 23:47:33 +0000 (08:47 +0900)]
docs: update docs for verify_mode=compare of io_uring_cmd

Add missing limitation of verify_mode=compare in io_uring_cmd
ioengine.  Data verification with NVMe COMPARE command has been
introduced in Commit 6170d92a61da ("io_uring: Support Compare command
for verification") and this should have documented COMPARE command only
supports in case of data pattern verification.

The two more options should be with --verify_mode=compare.
verify_mode=compare
verify=pattern
verify_pattern=<pattern>

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
3 months agoRe-introduce RWF_DONTCACHE
Jens Axboe [Thu, 20 Feb 2025 20:07:41 +0000 (13:07 -0700)]
Re-introduce RWF_DONTCACHE

This used to be called RWF_UNCACHED, and it never made it upstream. But
as of the 6.14 kernel, RWF_DONTCACHE exists, and provides the same
guarantees that the older RWF_UNCACHED did - it's applied to buffered
IO, and any page cache instantiated for this read or write will be
dropped on IO completion. Any data already in cache will remain in cache
and will not cause IO to be issued.

This adds support for the io_uring and sync IO engines.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoMerge branch 'fix-DNDEBUG' of https://github.com/dandedrick/fio
Jens Axboe [Thu, 20 Feb 2025 16:48:22 +0000 (09:48 -0700)]
Merge branch 'fix-DNDEBUG' of https://github.com/dandedrick/fio

* 'fix-DNDEBUG' of https://github.com/dandedrick/fio:
  t/read-to-pipe-async: fix -DNDEBUG support

3 months agot/read-to-pipe-async: fix -DNDEBUG support
Dan Dedrick [Thu, 20 Feb 2025 15:51:12 +0000 (10:51 -0500)]
t/read-to-pipe-async: fix -DNDEBUG support

When NDEBUG is defined this was trying to call log_err but it didn't
include the header file or link against the relevant .o file. This will
now fully build with -DNDEBUG.

Signed-off-by: Dan Dedrick <dan.dedrick@gmail.com>
3 months agoFio 3.39 fio-3.39
Jens Axboe [Tue, 18 Feb 2025 15:36:57 +0000 (08:36 -0700)]
Fio 3.39

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agocrc/sha512: fix missing finalize part of sha512 hash
Jens Axboe [Mon, 17 Feb 2025 23:30:07 +0000 (16:30 -0700)]
crc/sha512: fix missing finalize part of sha512 hash

The sha512 implementation was broken, make an attempt at actually
making it work...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agolibaio: Add vectored io support
Ritesh Harjani (IBM) [Sat, 15 Feb 2025 08:41:30 +0000 (14:11 +0530)]
libaio: Add vectored io support

This adds support for doing vectored I/O to libaio.
Instead of using pread/pwrite calls, this allows libaio to use
preadv/pwritev calls which uses iovecs.
option: libaio_vectored=1

Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/f0d66512e3df3d2142910e996c42389c21232d12.1739608655.git.ritesh.list@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoMerge branch 't0036-0037' of https://github.com/kawasaki/fio
Vincent Fu [Fri, 14 Feb 2025 14:26:48 +0000 (09:26 -0500)]
Merge branch 't0036-0037' of https://github.com/kawasaki/fio

* 't0036-0037' of https://github.com/kawasaki/fio:
  t/jobs/t0036,0037: add tests for verify_state_save/load options

3 months agot/jobs/t0036,0037: add tests for verify_state_save/load options
Shin'ichiro Kawasaki [Fri, 14 Feb 2025 01:22:37 +0000 (10:22 +0900)]
t/jobs/t0036,0037: add tests for verify_state_save/load options

Add tests to exercise the options verify_state_save and
verify_state_load. The test case t0036 does it for psync I/O engine and
single file, and t0037 does it for libaio I/O engine and multiple files.
The test cases confirm no regression by the recent commits relevant to
the options.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
3 months agot/io_uring: fix passthrough fixed buffer support
Jens Axboe [Thu, 13 Feb 2025 15:58:17 +0000 (08:58 -0700)]
t/io_uring: fix passthrough fixed buffer support

A previous commit changed t/io_uring to register a single region for
all of the registered buffers, and while it updated non-passthrough IO
for that change, the passthrough path still sets a specific buffer
index. This makes passthrough with fixed buffers fail for any buffer
but the first one, as it's asking for a buffer that doesn't exist rather
than index the first one. That causes -EFAULT completions.

Ensure the buf_index is set to 0 for passthrough as well.

Fixes: 21f461f8c2b9 ("t/io_uring: register single buffer for whole IO region")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agot/verify-state.c: adjust to verify state format change
Shin'ichiro Kawasaki [Thu, 13 Feb 2025 05:25:10 +0000 (14:25 +0900)]
t/verify-state.c: adjust to verify state format change

The previous commit modified the format of verify state files. To adjust
to the change, add support of the new field "max_no_comps_per_file" and
pass it to __thread_io_list_sz(). Also check the version number against
the new version 4.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20250213052510.1474423-4-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoverify: double number of writes to save completions
Shin'ichiro Kawasaki [Thu, 13 Feb 2025 05:25:09 +0000 (14:25 +0900)]
verify: double number of writes to save completions

When asynchronous write workloads have the verify option and the
verify_state_save option enabled, fio saves the last write completions
in the verify state file. The number of writes saved in the verify state
file is equal to the I/O depth specified by the iodepth option. Let N
represent the iodepth. Subsequent verify workloads with the
verify_state_load option read the saved verify state file. As to the
last N verify I/Os, fio checks if they have corresponding write
completions saved by the write workloads. If not, fio does not perform
the verify I/Os since the verify data was not written. This approach
prevents the false-positive verify failures. Refer to the following two
commits for the detail:

 ca09be4b1a8e ("Add support for verify triggers and verify state saving")
 94a6e1bb4e7d ("Fix verify state for multiple files")

However, when the write workloads are asynchronous, the completion order
of writes can differ from their issue order. In such cases, a write
named "W_before_last_N", issued before the last N writes, may complete
slowly, fall within the last N completions, and be saved in the verify
state file. Conversely, one of the last issued N writes, named
"W_in_last_N", may complete early, and not be saved in the verify state
file. When the subsequent verify workload reads the verify state file
and runs, fio prepares the I/O for the "W_in_last_N" at some point. Fio
tries to find its offset in the verify state file, but that is not
found. Then fio stops the verify workload. This unexpected verify stop
confuses users.

To reduce the chance of the unexpected verify stop due to fluctuations
in the write completion order, increase the number of write completions
saved in the verify state file. Since this issue only occurs with
asynchronous writes, increase the number only for asynchronous
workloads. Add a new field "last_write_comp_depth" to struct thread_data
to store the number. To adjust the size of the verify state file, add a
new field "max_no_comps_per_file" to struct thread_io_list. This field
reflects the number of writes to be saved for each file and allows to
calculate the state file size. These changes affect the verify state
file format, then bump up the verify state header version from 3 to 4.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20250213052510.1474423-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoverify: print message when verify_state_should_stop() returns false
Shin'ichiro Kawasaki [Thu, 13 Feb 2025 05:25:08 +0000 (14:25 +0900)]
verify: print message when verify_state_should_stop() returns false

When verify workloads with the verify_state_load option target an offset
that is not saved in the verify state file, verify_state_should_stop()
function returns false and it stops the verify workloads. This workloads
stop is made without providing a message to users, making it difficult
for them to understand why they stopped. Print a message to inform users
why the verify workloads stopped.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20250213052510.1474423-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 months agot/run-fio-tests: add client/server test script
Vincent Fu [Thu, 23 Jan 2025 16:03:18 +0000 (11:03 -0500)]
t/run-fio-tests: add client/server test script

Add the client/server test script to the global test harness.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agot/client-server: basic client/server test script
Vincent Fu [Mon, 13 Jan 2025 23:51:50 +0000 (23:51 +0000)]
t/client-server: basic client/server test script

Currently there are only two sets of test cases:

- check that fio correctly handles the global options dictionary in the
  JSON output with one or more servers with job files with and without
  global sections.
- check that the [s,c]lat_percentiles options work for the "All clients"
  summary data.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agoci: install kill binary for Debian platforms
Vincent Fu [Thu, 23 Jan 2025 15:55:39 +0000 (10:55 -0500)]
ci: install kill binary for Debian platforms

kill is a bash built-in and the binary is not installed by default on
Debian. Install the binary because we need to use Python's subprocess
to run the kill command to stop the fio servers for the client/server
test script.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agot/fiotestlib: improve JSON decoding
Vincent Fu [Tue, 14 Jan 2025 18:27:55 +0000 (18:27 +0000)]
t/fiotestlib: improve JSON decoding

Instead of skipping up to a fixed number of lines when trying to decode
JSON output, just skip everything until the first opening {.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agoclient: separate global options from multiple servers
Vincent Fu [Tue, 7 Jan 2025 21:29:36 +0000 (21:29 +0000)]
client: separate global options from multiple servers

In a single client invocation, currently all global options from all
servers accumulate in a single global options dictionary. This is fine
if the invocation creates only a single server session, but when a
client connects to multiple servers, this is a mess because there is no
way to assign different global options to different jobs.

This patch instead creates a global options array when a client creates
multiple server sessions. Each array element contains the global options
for a different server session and is identified by the hostname and
port. When the client connects to only a single server, the global
options object remains a dictionary in order to maintain backward
compatibility.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agojson: allow empty string values
Vincent Fu [Tue, 7 Jan 2025 20:56:19 +0000 (20:56 +0000)]
json: allow empty string values

The JSON standard permits empty strings. Currently fio's JSON module
returns an error when it encounters an empty string. Change this to
allow empty strings.

https://www.json.org/ is the reference I used for the JSON standard.

This is needed for upcoming patches to support FIO_OPT_STR_SET job
options (norandommap, time_based, etc) that are enabled when the option
is included without specifying a value for it. The value for these
options is best represented by an empty string. Disallowing empty string
values would prevent these options from appearing in job option
dictionaries in the JSON output.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agoclient: rename job_opt_object to global_opt_object
Vincent Fu [Fri, 3 Jan 2025 19:33:37 +0000 (19:33 +0000)]
client: rename job_opt_object to global_opt_object

This structure contains only options from the global section of a job
file, so make the name reflect this in order to make the code clearer.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
4 months agot/zbd: add test case to confirm no max_open_zones limit check
Shin'ichiro Kawasaki [Wed, 22 Jan 2025 01:38:35 +0000 (10:38 +0900)]
t/zbd: add test case to confirm no max_open_zones limit check

The previous commit fixed the max_open_zones limit check for non-write
jobs. Add a test case to confirm the fix.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20250122013835.1223725-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincentfu@gmail.com>
4 months agozbd: do not check open zones status and limits when jobs do not write
Shin'ichiro Kawasaki [Wed, 22 Jan 2025 01:38:34 +0000 (10:38 +0900)]
zbd: do not check open zones status and limits when jobs do not write

Currently, fio checks the conditions of each zone within the IO range at
the job start. If a zone is in an open condition, it is added to the
write target zone array. If the number of write target zones exceeds the
max_open_zones or job_max_open_zones limit, fio terminates with the
error message "Number of open zones exceeds max_open_zones limit". This
check for zone condition and the resulting termination occur even when
the job does not perform a write operation, leading to confusion among
users.

To avoid the confusion, skip the check when jobs do not perform write
operations. Additionally, print the message to inform that the
job_max_open_zones limit does not work for non-write jobs.

Fixes: 954217b90191 ("zbd: Initialize open zones list referring zone status at fio start")
Fixes: 8ac768899d63 ("zbd: do not reset extra zones in open conditions")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20250122013835.1223725-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincentfu@gmail.com>
4 months agoMerge branch 'pre_success' of https://github.com/kawasaki/fio
Vincent Fu [Tue, 21 Jan 2025 16:38:18 +0000 (11:38 -0500)]
Merge branch 'pre_success' of https://github.com/kawasaki/fio

* 'pre_success' of https://github.com/kawasaki/fio:
  t/run-fio-tests: remove redundant pre_success lines

4 months agot/run-fio-tests: remove redundant pre_success lines
Shin'ichiro Kawasaki [Fri, 17 Jan 2025 13:01:39 +0000 (22:01 +0900)]
t/run-fio-tests: remove redundant pre_success lines

Recently, three test case definitions were added to t/run-fio-tests. The
added definitions have redundant pre_success lines. Remove them.

Fixes: 8b0018e93eac ("t/jobs/t0033: add test for the log file format")
Fixes: 20d0ba84d3b7 ("t/jobs/t0034: add test for the log_issue_time option")
Fixes: a189fc720a4d ("t/jobs/t0035: add test for the file operations IO engine")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
5 months agoMerge branch 'master' of https://github.com/termim/fio
Vincent Fu [Mon, 16 Dec 2024 18:23:58 +0000 (13:23 -0500)]
Merge branch 'master' of https://github.com/termim/fio

* 'master' of https://github.com/termim/fio:
  Add .readthedocs.yaml file.

5 months agoAdd .readthedocs.yaml file.
Mikhail Terekhov [Sun, 17 Dec 2023 20:59:52 +0000 (15:59 -0500)]
Add .readthedocs.yaml file.

Now to create documentation on readthedocs.org the project must have
a configuration file.

Signed-off-by: Mikhail Terekhov <termim@gmail.com>
6 months agonfs: add support for new libnfs API
Ronnie Sahlberg [Mon, 9 Dec 2024 05:47:58 +0000 (15:47 +1000)]
nfs: add support for new libnfs API

New update of libnfs will have a new API that changes some signatures,
primarily in order to make nfs_[p]read[_async] calls
zero-copy in the sense that (almost) no data copy is done in the library
and READ3/READ4 payloads are read straigth from the socket into the
application buffer.

In-library zero-copy only works for !krb5 and !tls sessions but can provide
significant boost for read-intensive workloads when can be used.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Link: https://lore.kernel.org/r/20241209054758.3269700-1-ronniesahlberg@gmail.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 months agostat: fix unified_rw_reporting=both BW and IOPS
Vincent Fu [Wed, 4 Dec 2024 19:00:53 +0000 (19:00 +0000)]
stat: fix unified_rw_reporting=both BW and IOPS

When unified_rw_reporting=both, the value for the significant_figures
option is not populated in the struct thread_stat containing the mixed
r/w/t data. Thus, when bandwidth and IOPS numerical values are converted
to strings, they are converted to "0".

This patch populates the significant figures member of struct
thread_stat for the mixed r/w/t data.

Fixes: https://github.com/axboe/fio/issues/1844
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 months agodocs: explain type of memory allocated by md_per_io_size
Vincent Fu [Fri, 22 Nov 2024 18:57:56 +0000 (18:57 +0000)]
docs: explain type of memory allocated by md_per_io_size

Note that md_per_io_size always uses malloc for io_uring_cmd.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 months agoengines/io_uring_cmd: disable iomem=malloc check for metadata
Vincent Fu [Fri, 22 Nov 2024 16:29:05 +0000 (16:29 +0000)]
engines/io_uring_cmd: disable iomem=malloc check for metadata

Before this patch, the io_uring_cmd ioengine would check that
iomem=malloc (the default) before allocating memory for metadata
buffers. If the user had selected a different option, fio would abort
the job with an error message.

This patch removes this check. We do not need to restrict users to
iomem=malloc for io_uring_cmd workloads involving protection
information. Users may wish to use huge pages for LBA data in order to
submit larger IOs. Since metadata buffers will be smaller they can still
use regular pages.

Reported-by: 전규범 <gyubeom.jeon@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 months agot/io_uring: fix size confusion in allocate_mem()
Jens Axboe [Tue, 5 Nov 2024 14:57:41 +0000 (07:57 -0700)]
t/io_uring: fix size confusion in allocate_mem()

It should always be using the size passed in as to what amount of memory
should be allocated, not the individual IO size. This didn't matter
previously, as each buffer was allocated independently, but it matters
now where a single region will cover all IO buffers.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoMerge branch 'io_uring-depth'
Jens Axboe [Tue, 5 Nov 2024 14:51:05 +0000 (07:51 -0700)]
Merge branch 'io_uring-depth'

* io_uring-depth:
  engines/io_uring: don't mess with non power-of-2 queue depth

7 months agot/io_uring: add symbolic defines for NOP flags
Jens Axboe [Mon, 4 Nov 2024 17:27:06 +0000 (10:27 -0700)]
t/io_uring: add symbolic defines for NOP flags

Add them to io_uring.h and use them in t/io_uring.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agot/io_uring: enable registered file/buffer testing with NOP
Jens Axboe [Mon, 4 Nov 2024 17:23:47 +0000 (10:23 -0700)]
t/io_uring: enable registered file/buffer testing with NOP

Enable the -N NOP mode to use registered files and buffers, handy for
testing the kernel side.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agot/io_uring: register single buffer for whole IO region
Jens Axboe [Mon, 4 Nov 2024 17:20:56 +0000 (10:20 -0700)]
t/io_uring: register single buffer for whole IO region

Rather than register N buffers for depth of N, just allocate a single
contig region and register that as a single buffer. That's more
efficient on the kernel side, as only a single resource need to be
managed.

Should have no functional changes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 months agoengines/io_uring_cmd: do not send data buffer for write zeroes
Vincent Fu [Fri, 11 Oct 2024 22:01:26 +0000 (22:01 +0000)]
engines/io_uring_cmd: do not send data buffer for write zeroes

For write zeroes commands, do not send a data bufffer address. If we do
send an address, the driver will try to carry out DMA mapping and
encounter driver mdts limitations which do not apply to write zeroes
commands. This lets us send large write zeroes commands to deallocate
the device with the deac=1.

This is only done for the non-vectored IO case. For the vectored IO
case, the driver requires data buffer addresses to be sent. Regardless
it does not make sense to use vectored IO for write zeroes.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 months agoengines/io_uring_cmd: add option to set DEAC bit for write zeroes
Vincent Fu [Thu, 10 Oct 2024 17:31:51 +0000 (17:31 +0000)]
engines/io_uring_cmd: add option to set DEAC bit for write zeroes

Add an option for fio to set the DEAC bit for write zeroes commands.
This instructs the device to also deallocate the specified logical
blocks in the course of completing the write zeroes operation. This only
has an effect when write_mode=zeroes is specified.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 months agoci: always update apt cache before installing pkgs
Vincent Fu [Tue, 15 Oct 2024 15:21:49 +0000 (11:21 -0400)]
ci: always update apt cache before installing pkgs

For all of our custom local actions make sure we update the apt cache
before trying to install packages. This will prevent errors when the
runner is started with a stale apt cache.

Example: https://github.com/vincentkfu/fio/actions/runs/11339008514/job/31533113877

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 months agoengines/io_uring: don't mess with non power-of-2 queue depth io_uring-depth
Jens Axboe [Mon, 14 Oct 2024 16:00:36 +0000 (10:00 -0600)]
engines/io_uring: don't mess with non power-of-2 queue depth

io_uring needs the rings to be a power-of-2 in sizing, but it does not
need to be messing with the queue depth driven to the device. Rather
than round everything up, only round up the API parts.

Reported-by: Riley Thomasson <riley@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agodocs: mention unsupported configuration
Vincent Fu [Thu, 3 Oct 2024 20:00:12 +0000 (20:00 +0000)]
docs: mention unsupported configuration

It does not make sense when group_reporting is used for the constituent
jobs to have different values for options like unified_rw_reporting,
?lat_percentiles, etc. Mention that configurations with different values
for these parameters are unsupported.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoclient/server: enable "All clients" latency percentiles
Vincent Fu [Thu, 3 Oct 2024 19:25:33 +0000 (19:25 +0000)]
client/server: enable "All clients" latency percentiles

The ?lat_percentile toggles and list of percentiles to report from the
thread_stat payload have not been propagated to the overall summary
report. Enable "All clients" latency percentile reporting by arbitrarily
using the toggles and percentile list from the first thread_stat
payload sent from the server.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agodocs: addtions to client/server section
Vincent Fu [Wed, 2 Oct 2024 18:47:09 +0000 (14:47 -0400)]
docs: addtions to client/server section

Mention the unique_filename option in the client/server section and also
note that fio will produce aggregate summary output for all jobs when
running jobs on multiple servers.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoci/qemu: use a tarball to xfer source code to guest
Vincent Fu [Fri, 27 Sep 2024 20:37:31 +0000 (20:37 +0000)]
ci/qemu: use a tarball to xfer source code to guest

Instead of faking a GitHub Actions runner environment, just create a
source code tarball and transfer it to the guest VM. This is simpler and
does not depend on the continued existence of the action used
previously.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoFio 3.38 fio-3.38
Jens Axboe [Wed, 2 Oct 2024 18:53:13 +0000 (12:53 -0600)]
Fio 3.38

Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoengines/io_uring: add support for async TRIM
Jens Axboe [Mon, 30 Sep 2024 15:42:22 +0000 (09:42 -0600)]
engines/io_uring: add support for async TRIM

6.12 kernels and newer support async trim, which means the non-cmd path
no longer needs to quiesce the queue and issue a sync trim for a workload
that includes trim/discard requests.

The engine will assume the support is there, and if it gets -EINVAL when
trying an async trim, then it'll punt back to the using the sync trim
again.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agot/io_uring: only load tail once per reap loop
Jens Axboe [Mon, 30 Sep 2024 15:21:17 +0000 (09:21 -0600)]
t/io_uring: only load tail once per reap loop

It'll never change with the settings that t/io_uring uses to setup the
ring - and even if it could, it's still cheaper to just read the tail
once per reap.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoci/qemu: change the name of this workflow
Vincent Fu [Fri, 27 Sep 2024 19:27:28 +0000 (19:27 +0000)]
ci/qemu: change the name of this workflow

Reduce confusion by giving the guest VM workflow a name different from
our run-fio-tests.py workflow.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoci: allow GitHub Actions workflows to be manually triggered
Vincent Fu [Fri, 27 Sep 2024 19:24:08 +0000 (19:24 +0000)]
ci: allow GitHub Actions workflows to be manually triggered

This patch adds a 'workflow_dispatch' trigger to our three GitHub
Actions workflows. This allows us to trigger each workflow by navigating
to the repository's Actions tab, selecting the desired workflow, and
clicking on th 'Run workflow' button.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoengines/io_uring: Fix negative errno in io_u->error
Minwoo Im [Fri, 27 Sep 2024 03:08:57 +0000 (12:08 +0900)]
engines/io_uring: Fix negative errno in io_u->error

io_u->error can have either negative errno value or device-specific
error status as a positive value.  fio always tries to parse the errno
with strerrno() and it expects the value to be a positive one.

Commit ebe67b667f25 ("io_uring: Add IO_U_F_DEVICE_ERRROR to identify
error types") tried to abs(io_u->error) to convert it first.  And it
caused the following build warning:

  engines/io_uring.c:553:16: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
          io_u->error = abs(io_u->error);
                        ^
  engines/io_uring.c:553:16: note: remove the call to 'abs' since unsigned values cannot be negative
          io_u->error = abs(io_u->error);
                        ^~~

Commit 9eaa8e7c8e0b ("engines/io_uring: don't use abs() on an unsigned
value") tried to remove the warning by removing abs() on io_u->error,
but if so, negative errno (e.g., -EINVAL) can't be parsed properly like:

  fio: io_u error on file /dev/ng0n1: Unknown error -22: write offset=429916160, buflen=1048576

This patch fixed this fixed to convert to positive value properly by
casting it first to int and then do abs() on it.

Fixes: 9eaa8e7c8e0b ("engines/io_uring: don't use abs() on an unsigned value")

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Link: https://lore.kernel.org/r/20240927030857.17001-1-minwoo.im.dev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoHOWTO: update 'verify_mode' for io_uring_cmd
Minwoo Im [Thu, 26 Sep 2024 22:54:11 +0000 (07:54 +0900)]
HOWTO: update 'verify_mode' for io_uring_cmd

'verify_mode' option has been added by Commit 6170d92a61da
("io_uring: Support Compare command for verification").  Added
description for this option.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Link: https://lore.kernel.org/r/20240926225411.13754-1-minwoo.im.dev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoengines/io_uring: don't use abs() on an unsigned value
Jens Axboe [Thu, 26 Sep 2024 21:04:35 +0000 (15:04 -0600)]
engines/io_uring: don't use abs() on an unsigned value

It doesn't make any sense, for obvious reasons.

Fixes: ebe67b667f25 ("io_uring: Add IO_U_F_DEVICE_ERROR to identify error types")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoMerge branch 'master' of https://github.com/HuangShumin/fio
Vincent Fu [Thu, 26 Sep 2024 18:47:45 +0000 (14:47 -0400)]
Merge branch 'master' of https://github.com/HuangShumin/fio

* 'master' of https://github.com/HuangShumin/fio:
  Fix configure with --build-static which enables static RDMA in #1801

8 months agoci/cifuzz: update to upload-artifacts@v4
Vincent Fu [Thu, 26 Sep 2024 18:43:48 +0000 (14:43 -0400)]
ci/cifuzz: update to upload-artifacts@v4

upload-artifacts v1 is now deprecated. Switch to a maintained version.

We may also consider just getting rid of this workflow as it's not clear
that it has ever found any issue or if anyone looks at the output.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoio_uring: Support Compare command for verification
Minwoo Im [Thu, 26 Sep 2024 01:08:02 +0000 (10:08 +0900)]
io_uring: Support Compare command for verification

Added 'verify_mode' option to io_uring_cmd with --cmd_type=nvme to
support data compare verification with Compare commands rather than Read
commands.  This patch newly added IO_U_F_VER_IN_DEV io_u flag to
represent that verification should be done in device side, not the host
side to skip the actual verification phase in verify_io_u().

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Link: https://lore.kernel.org/r/20240926010802.27131-1-minwoo.im.dev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoio_uring: Add IO_U_F_DEVICE_ERROR to identify error types
Minwoo Im [Thu, 26 Sep 2024 00:41:34 +0000 (09:41 +0900)]
io_uring: Add IO_U_F_DEVICE_ERROR to identify error types

__io_u_log_error expects a positive value of io_u->error parsing it with
strerror() expecting it to be an errno.  io_uring_cmd (cmd_type=nvme),
for example, has returned errno value as a positive value and
device-specific CQE status type and code as well.

Commit 78831c6b35c5 ("io_uring: Fix the flip to negative of CQE status")
has put the abs() to the cqe->res, and it caused confusions between the
actual CQE stauts and the system error value (errno).  Now we have
Commit 2a13699a89dc ("io_uring: Add .errdetails to parse CQ status"),
meaning that io_uring_cmd ioengines will parse the actual value of
io_u->error value as CQE status value, so we should know if the value is
for CQE status or errno.

This patch added a flag IO_U_F_DEVICE_ERROR to io_u to represent if
io_u->error has device-specific error value, otherwise it's errno.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Link: https://lore.kernel.org/r/20240926004134.26004-1-minwoo.im.dev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoci: build and run a QEMU guest VM for testing
Vincent Fu [Fri, 6 Sep 2024 18:52:01 +0000 (18:52 +0000)]
ci: build and run a QEMU guest VM for testing

Since GitHub Actions' free runners now support nested virtualization,
let's create a guest VM image and use it to run some tests that cannot
be run directly via a GitHub Actions runner (because these runners do
not allow insertion of kernel modules).

This patch adds a workflow that runs nightly and:
- creates a Debian guest VM image using libguestfs
- builds QEMU
- starts the VM
- clones/builds fio on the VM
- runs the test

Separate instances of the job are spawned to run the following tests:
- basic io_uring_cmd
- NVMe protection information w/16-bit Guard PI
- NVMe PI 4096+16 w/64-bit Guard PI
- NVMe PI 4096+64 w/64-bit Guard PI
- FDP
- t/zbd/run-tests-against-nullb

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoci: handle sudo in actions-install.sh
Vincent Fu [Mon, 23 Sep 2024 16:41:35 +0000 (16:41 +0000)]
ci: handle sudo in actions-install.sh

We run our tests as root in containers and VMs. Those platforms do not
have sudo. Use a small bash function to eliminate the need to install
sudo at the very beginning of the dependency installation script.

This function just checks for the existence of sudo and uses it when
installed but does nothing when it is not installed. With this function
we can just add sudo to the list of packages to install like all the
other packages. We may still need sudo in one of our test scripts.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoci: only remove libunwind-14-dev if installed
Vincent Fu [Mon, 23 Sep 2024 16:50:31 +0000 (16:50 +0000)]
ci: only remove libunwind-14-dev if installed

Some containers no longer have libunwind-14-dev in their repositories.
Remove this package only if it is installed.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoci: remove unneeded packages
Vincent Fu [Fri, 20 Sep 2024 21:57:57 +0000 (21:57 +0000)]
ci: remove unneeded packages

We no longer need unzip, cmake, and wget because we no longer build
librpma. Stop installing these three packages.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
8 months agoFix configure with --build-static which enables static RDMA in #1801
HuangShumin [Tue, 24 Sep 2024 00:54:22 +0000 (08:54 +0800)]
Fix configure with --build-static which enables static RDMA in #1801

Fix configure with --build-static option which enables static RDMA in Issue #1801

This pull request to probe static libibverbs/librdmacm library. It's neccessary to enable static RDMA engine build with netlink libnl-3 and libnl-route-3.

Signed-off-by: Huang Shumin longway68@qq.com
8 months agoMerge branch 'atomic-writes'
Jens Axboe [Tue, 17 Sep 2024 02:23:06 +0000 (20:23 -0600)]
Merge branch 'atomic-writes'

Merge the atomc write support.

* atomic-writes:
  examples: Add example for atomic write verify
  fio: Support verify_write_sequence
  doc: Document atomic command
  tools/fiograph: Update for atomic support
  io_uring: Support RWF_ATOMIC
  libaio: Support RWF_ATOMIC
  pvsync2: Support RWF_ATOMIC
  os: Reintroduce atomic write support
  os-linux: Define RWF_ATOMIC

8 months agoexamples: Add example for atomic write verify atomic-writes
John Garry [Mon, 16 Sep 2024 16:53:47 +0000 (16:53 +0000)]
examples: Add example for atomic write verify

Add an example for verifying atomic writes.

Until now, atomic writes are only supported on Linux for block devices, so
only give instructions on for that.

Currently support is being worked on for XFS and EXT4, and instructions can
be updated in due course.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-10-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agofio: Support verify_write_sequence
John Garry [Mon, 16 Sep 2024 16:53:46 +0000 (16:53 +0000)]
fio: Support verify_write_sequence

Add an option to disable verifying the write sequence number. By default,
it is enabled. However disable for verify_only mode.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-9-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agodoc: Document atomic command
John Garry [Mon, 16 Sep 2024 16:53:45 +0000 (16:53 +0000)]
doc: Document atomic command

Now that the atomic command is formally supported, document it.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-8-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agotools/fiograph: Update for atomic support
John Garry [Mon, 16 Sep 2024 16:53:44 +0000 (16:53 +0000)]
tools/fiograph: Update for atomic support

Add atomic support for the specific engines which support this option.

This just means that "atomic" will show up as a special iongeine config
option (if fio 'atomic' option is specified).

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-7-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoio_uring: Support RWF_ATOMIC
John Garry [Mon, 16 Sep 2024 16:53:43 +0000 (16:53 +0000)]
io_uring: Support RWF_ATOMIC

Set RWF_ATOMIC for writes and oatomic==1.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-6-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agolibaio: Support RWF_ATOMIC
John Garry [Mon, 16 Sep 2024 16:53:42 +0000 (16:53 +0000)]
libaio: Support RWF_ATOMIC

Set RWF_ATOMIC for writes and oatomic==1.

Guard setting RWF_ATOMIC by FIO_HAVE_RWF_ATOMIC, as only linux supports
RWF_ATOMIC.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-5-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agopvsync2: Support RWF_ATOMIC
Alan Adamson [Mon, 16 Sep 2024 16:53:41 +0000 (16:53 +0000)]
pvsync2: Support RWF_ATOMIC

Set RWF_ATOMIC for writes and atomic==1.

Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
jpg: Set FIO_ATOMICWRITES for pvsync2
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoos: Reintroduce atomic write support
John Garry [Mon, 16 Sep 2024 16:53:40 +0000 (16:53 +0000)]
os: Reintroduce atomic write support

Previously O_ATOMIC support was added in commit d01612f3ae25 ("Add support
for O_ATOMIC"). But support was removed in commit a25ba6c64fe1 ("Get rid of
O_ATOMIC"), as support was never added in the Linux kernel.

Linux kernel 6.11 will add support for RWF_ATOMIC, which can be supported
for various ioengines. See latest man pages for details.

The plumbing was left in place for thread option oatomic, so that will be
reused.

Add a flag to say whether an engine supports atomic writes, and reject
when oatomic is set for an engine which does not support atomic writes.

This is a change in behaviour, as since commit a25ba6c64fe1 ("Get rid of
O_ATOMIC"), this oatomic has been ignored. However, it is better to tell
the user that their ioengine of choice does not support atomic writes.

Today RWF_ATOMIC is only supported for direct-IO. In future it may be
supported for buffered IO. As such, do not auto-set odirect=1 when
oatomic==1.

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-3-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 months agoos-linux: Define RWF_ATOMIC
John Garry [Mon, 16 Sep 2024 16:53:39 +0000 (16:53 +0000)]
os-linux: Define RWF_ATOMIC

Add a definition of RWF_ATOMIC when not available from uapi headers.

RWF_ATOMIC is going to be part of Linux v6.11

Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20240916165347.2226763-2-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
9 months agoUpdate mailing list details in README.rst
Rebecca Cran [Fri, 6 Sep 2024 21:19:40 +0000 (15:19 -0600)]
Update mailing list details in README.rst

Majordomo commands are no longer used, so update README.rst with the new
method of subscribing to the mailing list.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Link: https://lore.kernel.org/r/20240906211941.850156-1-rebecca@bsdio.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
9 months agot/jobs/t0035: add test for the file operations IO engine
Shin'ichiro Kawasaki [Fri, 6 Sep 2024 02:37:17 +0000 (11:37 +0900)]
t/jobs/t0035: add test for the file operations IO engine

The previous commit fixed the NULL pointer dereference which happened
when the write_lat_log option is specified for the file operations IO
engine. Add a new test case to confirm the fix. This test case also
covers the basic use cases of the file operations IO engine.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240906023717.1464031-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
9 months agostat: fix the null io_u dereference in add_clat_sample()
Shin'ichiro Kawasaki [Fri, 6 Sep 2024 02:37:16 +0000 (11:37 +0900)]
stat: fix the null io_u dereference in add_clat_sample()

As recorded in the Link, NULL pointer dereference happens when the
write_lat_log option is specified for the file operations IO engine.
This failure was caused by the commit 14d3134a5fc0 ("introduce the
log_issue_time option") which added the new field 'issue_time' to the
struct log_sample. To calculate the issue time, add_clat_sample() was
modified to refer to io_u->issue_time. However, the file operations IO
engine passes NULL as the io_u pointer. Hence the failure.

Fix this by skipping the io_u->issue_time reference when io_u is NULL.
Instead, set 0 as the issue time.

Link: https://lore.kernel.org/fio/0e2c84c9-f9e4-4073-a075-016393ca7bde@gmail.com/
Fixes: 14d3134a5fc0 ("introduce the log_issue_time option")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240906023717.1464031-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
9 months agoiolog: add va_end on error
Vincent Fu [Thu, 5 Sep 2024 18:35:30 +0000 (14:35 -0400)]
iolog: add va_end on error

Call va_end when we encounter an error trying to print sample fields.

This was reported by Coverity:

** CID 509197:  API usage errors  (VARARGS)
/iolog.c: 1025 in print_sample_fields()
________________________________________________________________________________________________________
*** CID 509197:  API usage errors  (VARARGS)
/iolog.c: 1025 in print_sample_fields()
1019      int ret;
1020
1021      va_start(ap, fmt);
1022      ret = vsnprintf(*p, *left, fmt, ap);
1023      if (ret < 0 || ret >= *left) {
1024      log_err("sample file write failed: %d\n", ret);
>>>     CID 509197:  API usage errors  (VARARGS)
>>>     "va_end" was not called for "ap".
1025      return -1;
1026      }
1027      va_end(ap);
1028
1029      *p += ret;
1030      *left -= ret;

Fixes: 3ec6b6da ("iolog: refactor flush_samples()")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agot/jobs/t0034: add test for the log_issue_time option
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:26 +0000 (17:58 +0900)]
t/jobs/t0034: add test for the log_issue_time option

Add a test to check the newly added option 'log_issue_time'. Generate
log files using the option and check that lines in the log files have
the format described in the "Log File Format" section in HOWTO.rst.

This test case has the logic same as t0033 except the log file names and
matching patterns. Factor out the logic to the new class
FioJobFileTest_LogFileFormat.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-10-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agot/jobs/t0033: add test for the log file format
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:25 +0000 (17:58 +0900)]
t/jobs/t0033: add test for the log file format

Add a test to check the log file format which is described in the "Log
File Format" section in HOWTO.rst. Generate log files using combination
of options relevant to log files, and check that lines in log files have
the format expected. This test helps to confirm that the changes in the
log file related functions do not cause regressions.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-9-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agodoc: describe the log_issue_time option
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:24 +0000 (17:58 +0900)]
doc: describe the log_issue_time option

The recent commit introduced the new option log_issue_time. Describe its
feature and restrictions.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-8-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agodoc: fix the descriptions of the log_prio option
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:23 +0000 (17:58 +0900)]
doc: fix the descriptions of the log_prio option

Commit 03ec570f6e57 ("fio: Introduce the log_prio option") added the
description of the log_prio option to fio.1. However, the description
was wrong. It mentioned that the log_prio option would change the number
of fields in the Log File Format, but actually it does not do so. Fix
the description.

Also, the commit did not update HOWTO.rst for the log_prio option. To
keep HOWTO.rst same as fio.1, add the missing descriptions to HOWTO.rst.

Fixes: 03ec570f6e57 ("fio: Introduce the log_prio option")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-7-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agointroduce the log_issue_time option
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:22 +0000 (17:58 +0900)]
introduce the log_issue_time option

When write_lat_log option is set, fio outputs the 'clat' completion
latency log file. This clat log can be used to analyze IO latency. This
file can also be considered as an IO trace file as each IO entry can
fully describe an IO when the --log_offset and --log_prio options are
also used.

However, using the clat log file as an IO trace is inaccuate due to two
reasons. Firstly, the time field of each entry uses millisecond units,
which is too coarse for fast IOs (e.g. when using SSDs). Secondly, the
time field value is recorded not at command completion, but at log
sample recording. The time field value is slightly different from the IO
completion time. It can be used only as an approximated completion time.

To analyze IO issue time and IO completion time accurately using the
clat log, introduce the new option 'log_issue_time'. When this option is
set, add another field to the log file entries and put the IO issue time
in nanosecond to the field. The IO completion time can be calculated by
adding the completion latency to the IO issue time.

The IO issue time field is added to 'slat' submit latency log file also.
This helps to calculate IO start time by subtracting the submission
latency from the IO issue time.

The log_issue_time option can be used for IO trace when the
write_lat_log option and the log_offset options are set together. When
the log_issue_time option is set but the write_lat_log option or the
log_offset option is not set, fio errors out. When the log_issue_time
option and the write_lat_log option are set together with other
write_X_log options, the IO issue time field is added to all log files.
As for the other log files than clat and slat log, the IO issue time
does not have meaning then '0' is set to the field. When log_avg_msec
option is set, average of the log values of the specified duration is
logged. The IO issue time does not have meaning in this case either and
'0' is set to the field.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-6-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agoiolog: drop struct io_sample_offset
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:21 +0000 (17:58 +0900)]
iolog: drop struct io_sample_offset

Fio uses the struct io_sample to log attributes of each IO. When the
log_offset option is set, fio uses the struct io_sample_offset instead
which has the additional field dedicated to the offset data. Fio chooses
one of these two structs by the log_offset option to minimize memory
usage for IO sampling. However, the dedicated struct io_sample_offset is
not flexible and makes it difficult to add new sampling items.

To allow adding new sampling items, drop the struct io_sample_offset.
Instead, introduce the variable length array "uint64_t aux[]" at the
end of the struct io_sample which holds any auxiliary sampling data.
At this moment, it holds only one item "offset" as the first array
element. The following patch will add a new item.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-5-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agoiolog: refactor flush_samples()
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:20 +0000 (17:58 +0900)]
iolog: refactor flush_samples()

flush_samples() controls the log file format depending on the options
log_avg_msec, log_window_value, log_offset and log_prio. It has deeply
nested branches to check the options. These nested branches make it
difficult to add more fields to the log file format. For ease of the log
file format improvements, refactor the function. Instead of checking all
conditions at once, check each condition one by one, generate small
strings for each field and add them to the final string to output. For
this purpose, introduce the new function print_sample_fields() which
generates each field string.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-4-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
9 months agostat: reduce arguments of add_log_sample()
Shin'ichiro Kawasaki [Thu, 29 Aug 2024 08:58:19 +0000 (17:58 +0900)]
stat: reduce arguments of add_log_sample()

The number of arguments of add_log_sample() has increased as fields get
added to the log file format. Five parameters of them (data, ddir, bs,
offset and priority) are passed to __add_log_sample(). This makes the
function look more complicated and log field addition harder. To
simplify the function, pack the five arguments into the new struct
log_sample.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240829085826.999859-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>