fio.git
11 months agoFio 3.35 fio-3.35
Jens Axboe [Tue, 23 May 2023 18:33:03 +0000 (12:33 -0600)]
Fio 3.35

Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 months agoMerge branch 'master' of https://github.com/bvanassche/fio
Vincent Fu [Tue, 23 May 2023 12:42:56 +0000 (08:42 -0400)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  zbd: Report the zone capacity
  zbd: Make an error message more detailed

11 months agozbd: Report the zone capacity
Bart Van Assche [Wed, 22 Feb 2023 21:54:18 +0000 (13:54 -0800)]
zbd: Report the zone capacity

The zone capacity is important information. Hence report the zone
capacity if it is identical for all zones and if ZBD debugging is enabled.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
11 months agoio_ur: make sure that sync errors are noticed upfront
Jens Axboe [Sat, 20 May 2023 01:30:38 +0000 (19:30 -0600)]
io_ur: make sure that sync errors are noticed upfront

This could probably be cleaner in the error handling, but jump to
the normal error handling case for ddir_sync() as well.

Fixes: https://github.com/axboe/fio/issues/1577
Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 months agozbd: Make an error message more detailed
Bart Van Assche [Fri, 19 May 2023 16:38:56 +0000 (09:38 -0700)]
zbd: Make an error message more detailed

Knowing which part of a zone report is invalid is useful when debugging
firmware of zoned devices. Hence report the number of zones that have
been parsed successfully when reporting a report zones error.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
11 months agoMerge branch 'master' of https://github.com/huajingyun01/fio
Jens Axboe [Fri, 19 May 2023 14:21:04 +0000 (08:21 -0600)]
Merge branch 'master' of https://github.com/huajingyun01/fio

* 'master' of https://github.com/huajingyun01/fio:
  Add LoongArch64 support

11 months agoAdd LoongArch64 support
Jingyun Hua [Fri, 19 May 2023 09:14:32 +0000 (17:14 +0800)]
Add LoongArch64 support

Signed-off-by: Jingyun Hua <huajingyun@loongson.cn>
11 months agoci: fix ups for 32-bit GitHub Actions Linux builds
Vincent Fu [Thu, 18 May 2023 17:25:07 +0000 (13:25 -0400)]
ci: fix ups for 32-bit GitHub Actions Linux builds

Fix the dependency install problem for 32-bit builds by explicitly
installing libc6:i386 and libgcc-s1:i386 as mentioned in the link below.

https://github.com/actions/runner-images/issues/4589#issuecomment-1552409942

Deleting microsoft-prod.list and adding --allow-downgrades were not
needed for our use case.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agoRevert "ci: stop testing Linux 32-bit builds"
Vincent Fu [Thu, 18 May 2023 17:23:49 +0000 (13:23 -0400)]
Revert "ci: stop testing Linux 32-bit builds"

This reverts commit 83b2d4b78374055c3a2261136eedf03b5fbfc335.

There now seems to be a solution to the 32-bit GitHub Actions Ubuntu
breakage.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agodocs: document no_completion_thread
Vincent Fu [Wed, 17 May 2023 14:44:49 +0000 (14:44 +0000)]
docs: document no_completion_thread

Describe in the HOWTO and man page the windowsaio ioengine
no_completion_thread option.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agodocs: move experimental_verify description
Vincent Fu [Wed, 17 May 2023 14:25:02 +0000 (14:25 +0000)]
docs: move experimental_verify description

Move the description for experimental_verify next to the other
verify-related options.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agodocs: move rate_cycle description
Vincent Fu [Wed, 17 May 2023 14:21:59 +0000 (14:21 +0000)]
docs: move rate_cycle description

Move the description for rate_cycle from the I/O latency section to the
I/O rate section.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agoengines/io_uring: fix coverity issue
Ankit Kumar [Tue, 16 May 2023 12:17:17 +0000 (17:47 +0530)]
engines/io_uring: fix coverity issue

*** CID 455020:  Integer handling issues  (BAD_SHIFT)
/engines/io_uring.c: 1201 in fio_ioring_cmd_open_file()

In expression "1 << data->lba_shift", left shifting by more than 31 bits
has undefined behavior.  The shift amount, "data->lba_shift", is 4294967295

Fixes: 345fa8f ("engines/io_uring_cmd: add extended LBA support")

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20230516121717.28508-2-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 months agoci: stop testing Linux 32-bit builds
Vincent Fu [Mon, 15 May 2023 12:51:27 +0000 (08:51 -0400)]
ci: stop testing Linux 32-bit builds

The GitHub Actions image has had a longstanding problem with the
dependencies required for 32-bit builds. The current work around no
longer fixes the issue. Stop testing 32-bit builds to avoid false
positive failures with our CI testing.

We can re-enable 32-bit builds when this issue is fixed upstream.

Details: https://github.com/actions/runner-images/issues/4589

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agoengines/io_uring_cmd: add extended LBA support
Ankit Kumar [Mon, 15 May 2023 11:03:40 +0000 (16:33 +0530)]
engines/io_uring_cmd: add extended LBA support

The io_uring_cmd ioengine assumes that logical block size is always
power of 2. But with namespace formats where metadata is transferred at
the end of logical block i.e. an extended logical block this is not
true.

This patch calculates the correct extended logical block size and uses
division operation for start and number of logical block calculation.
The existing calculation for power of 2 logical block size will remain
same.

This also add checks to verify that block sizes are multiple of LBA
size.

This current implementation however doesn't support protection info and
metadata transferred as separate buffer. Return error for those.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
[Vincent: edited commit message]

11 months agoengines/nvme: support for 64 LBA formats
Ankit Kumar [Mon, 15 May 2023 11:03:39 +0000 (16:33 +0530)]
engines/nvme: support for 64 LBA formats

The NVM command set specification 1.0c supports 64 LBA formats.
The 0-based nlbaf field specifies the number of LBA formats.
The flbas field is used to calculate the current LBA format, in which
bit 0-3 indicates lsb and bit 5-6 indicates msb of the format index.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agodocs: expand description for interval-based bw and iops statistics
Vincent Fu [Thu, 11 May 2023 00:10:56 +0000 (20:10 -0400)]
docs: expand description for interval-based bw and iops statistics

Update HOWTO.rst and fio.1 to provide more details about the descriptive
statistics interval-based bw and iops measurements.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agot/run-fio-test: fix comment
Vincent Fu [Wed, 10 May 2023 21:29:02 +0000 (17:29 -0400)]
t/run-fio-test: fix comment

The test job that measures rates is actually t0011.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
11 months agoengines/rdma: remove dead code
Jens Axboe [Wed, 10 May 2023 15:16:55 +0000 (09:16 -0600)]
engines/rdma: remove dead code

We can never reach this branch.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 months agot/read-to-pipe-async: remove dead code
Jens Axboe [Wed, 10 May 2023 15:16:01 +0000 (09:16 -0600)]
t/read-to-pipe-async: remove dead code

'work' will be overwritten shortly, no point in clearing it to NULL.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 months agoREADME: remove reference to the bsdio installer
Jens Axboe [Wed, 10 May 2023 14:04:40 +0000 (08:04 -0600)]
README: remove reference to the bsdio installer

These are no longer being updated, and we do have images on the
github page. Remove the reference.

Suggested-by: Rebecca Cran <rebecca@bsdio.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoMerge branch 'master' of https://github.com/bvanassche/fio
Jens Axboe [Thu, 27 Apr 2023 23:08:41 +0000 (17:08 -0600)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  ci: Also test the Android recovery environment
  Detect ASharedMemory_create() support

12 months agoci: Also test the Android recovery environment
Bart Van Assche [Thu, 27 Apr 2023 19:57:00 +0000 (12:57 -0700)]
ci: Also test the Android recovery environment

The android library is not available in the Android recovery
environment. Add a CI test for building and linking fio without the
android library.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
12 months agoDetect ASharedMemory_create() support
Bart Van Assche [Thu, 27 Apr 2023 19:57:00 +0000 (12:57 -0700)]
Detect ASharedMemory_create() support

Make linking with the android library optional.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
12 months agot/io_uring: avoid null-ptr dereference in case setup_ring fails
Anuj Gupta [Thu, 27 Apr 2023 19:44:15 +0000 (01:14 +0530)]
t/io_uring: avoid null-ptr dereference in case setup_ring fails

s->sq_ring.ring_entries and s->cq_ring.ring_entries will be NULL,
incase setup_ring fails. This will cause a segmentation fault. Avoid
dereferencing them in such a scenario.

Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Link: https://lore.kernel.org/r/20230427194415.1160701-1-anuj20.g@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoci: work around for GitHub Actions Cygwin sed issue
Vincent Fu [Wed, 26 Apr 2023 22:04:34 +0000 (22:04 +0000)]
ci: work around for GitHub Actions Cygwin sed issue

gcc and other compilers create dependency files that are included in
the Makefile for builds subsequent to the first build after a clean
checkout.

Dependency files produced by gcc look like this:

parse.o: parse.c config-host.h compiler/compiler.h parse.h flist.h \
 debug.h lib/types.h log.h lib/output_buffer.h options.h optgroup.h \
 minmax.h lib/ieee754.h lib/pow2.h lib/types.h

The Makefile rule for .o files manipulates the gcc dependencies file to
look like this:

parse.o: parse.c config-host.h compiler/compiler.h parse.h flist.h \
 debug.h lib/types.h log.h lib/output_buffer.h options.h optgroup.h \
 minmax.h lib/ieee754.h lib/pow2.h lib/types.h
parse.c:
config-host.h:
compiler/compiler.h:
parse.h:
flist.h:
debug.h:
lib/types.h:
log.h:
lib/output_buffer.h:
options.h:
optgroup.h:
minmax.h:
lib/ieee754.h:
lib/pow2.h:
lib/types.h:

For some reason the GitHub Actions Windows Cygwin sed does not execute
-e 's/\\$$//' properly to remove the backslashes at the end of each
line. On this platform the dependencies file after processing looks
like:

parse.o: parse.c config-host.h compiler/compiler.h parse.h flist.h \
 debug.h lib/types.h log.h lib/output_buffer.h options.h optgroup.h \
 minmax.h lib/ieee754.h lib/pow2.h lib/types.h
parse.c:
config-host.h:
compiler/compiler.h:
parse.h:
flist.h:
\:
debug.h:
lib/types.h:
log.h:
lib/output_buffer.h:
options.h:
optgroup.h:
\:
minmax.h:
lib/ieee754.h:
lib/pow2.h:
lib/types.h:

Once these dependency files are created subsequent invocations of make
(i.e., 'make test') produce Makefile parsing errors like:

parse.d:9: *** missing separator.  Stop.

All of this works fine on GitHub Actions msys2 and AppVeyor's Cygwin and
msys2.

Work around this problem by deleting the dependencies files before
running the tests.

For more details describing the processing of dependency files see
https://scottmcpeak.com/autodepend/autodepend.html

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoci: add Windows Cygwin and msys2 builds to GitHub Actions
Vincent Fu [Fri, 21 Apr 2023 18:56:59 +0000 (18:56 +0000)]
ci: add Windows Cygwin and msys2 builds to GitHub Actions

AppVeyor will only run builds one at a time whereas GitHub Actions will
run all builds in parallel.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agot/io_uring: make submitter_init() return < 0 on error
Jens Axboe [Thu, 27 Apr 2023 13:20:53 +0000 (07:20 -0600)]
t/io_uring: make submitter_init() return < 0 on error

Rather than fudge around with setting some finish variables, have
it error it directly and have the callers actually check for that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoRevert "zbd: Report the zone capacity"
Niklas Cassel [Thu, 27 Apr 2023 09:24:23 +0000 (11:24 +0200)]
Revert "zbd: Report the zone capacity"

This reverts commit 067c18eb3700373d029a9f2795d662453fc09cf4.

In the Linux zoned block devices API (blkzoned.h) (and in the NVMe Zoned
Namespace Command Set Specification), the zone capacity can be different
for each zone (unlike zone size, which has to be the same for all zones).

In order to not mislead the user to think that the zone capacity has to
be the same for all zones, remove the zone capacity for zone0 from the
per device print.

The zone capacity can be printed in prints that are related to a specific
zone, e.g. when encountering an error when performing I/O to a zone.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20230427092423.605250-1-nks@flawful.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agofilesetup: better handle non-uniform distributions
Vincent Fu [Thu, 20 Apr 2023 15:12:22 +0000 (15:12 +0000)]
filesetup: better handle non-uniform distributions

When we have a random workload with multiple files, randrepeat=0, and a
non-uniform random distribution, the offsets touched will follow the
same sequence for all files:

$ ./fio --name=test --nrfiles=2 --randrepeat=0 --filesize=16k \
--debug=io --rw=randread --norandommap \
--random_distribution=normal:50 | grep complete:

io       23042 complete: io_u 0x55bd982f6000: off=0x2000,len=0x1000,ddir=0,file=test.0.0
io       23042 complete: io_u 0x55bd982f6000: off=0x2000,len=0x1000,ddir=0,file=test.0.1
io       23042 complete: io_u 0x55bd982f6000: off=0x3000,len=0x1000,ddir=0,file=test.0.0
io       23042 complete: io_u 0x55bd982f6000: off=0x3000,len=0x1000,ddir=0,file=test.0.1
io       23042 complete: io_u 0x55bd982f6000: off=0x2000,len=0x1000,ddir=0,file=test.0.0
io       23042 complete: io_u 0x55bd982f6000: off=0x2000,len=0x1000,ddir=0,file=test.0.1
io       23042 complete: io_u 0x55bd982f6000: off=0x3000,len=0x1000,ddir=0,file=test.0.0
io       23042 complete: io_u 0x55bd982f6000: off=0x3000,len=0x1000,ddir=0,file=test.0.1

Notice that the blocks touched for test.0.0 and test.0.1 follow the same
sequence.

This patch allows the sequence of offsets touched to differ between
files by always involving the filename in the seed used for each file.
The randrepeat setting will still be respected as it is involved in
determining the value for td->rand_seeds[FIO_RAND_BLOCK_OFF].

With the patch applied the above invocation produces output like:

io       23022 complete: io_u 0x55ed2cd2c000: off=0x2000,len=0x1000,ddir=0,file=test.0.0
io       23022 complete: io_u 0x55ed2cd2c000: off=0x2000,len=0x1000,ddir=0,file=test.0.1
io       23022 complete: io_u 0x55ed2cd2c000: off=0x3000,len=0x1000,ddir=0,file=test.0.0
io       23022 complete: io_u 0x55ed2cd2c000: off=0x2000,len=0x1000,ddir=0,file=test.0.1
io       23022 complete: io_u 0x55ed2cd2c000: off=0x2000,len=0x1000,ddir=0,file=test.0.0
io       23022 complete: io_u 0x55ed2cd2c000: off=0x3000,len=0x1000,ddir=0,file=test.0.1
io       23022 complete: io_u 0x55ed2cd2c000: off=0x1000,len=0x1000,ddir=0,file=test.0.0
io       23022 complete: io_u 0x55ed2cd2c000: off=0x2000,len=0x1000,ddir=0,file=test.0.1

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agofio: replace malloc+memset with calloc
Vincent Fu [Sat, 15 Apr 2023 00:52:47 +0000 (00:52 +0000)]
fio: replace malloc+memset with calloc

Clean up the code base by replacing malloc+memset with calloc. This
patch was generated from the Coccinelle script below.

The script below is inspired by similar scripts used elsewhere:
https://lore.kernel.org/linux-btrfs/cover.1443546000.git.silvio.fricke@gmail.com/
https://github.com/coccinelle/coccinellery/blob/master/simple_kzalloc/simple_kzalloc1.cocci

@@
expression x,y;
statement s;
type T;
@@

-x = malloc(y * sizeof(T));
+x = calloc(y, sizeof(T));
(
if (!x) s
|
if (x == NULL) s
|
)
-memset(x, 0, y * sizeof(T));

@@
expression x,y,z;
statement s;
@@

-x = malloc(y * sizeof(z));
+x = calloc(y, sizeof(z));
(
if (!x) s
|
if (x == NULL) s
|
)
-memset(x, 0, y * sizeof(z));

@@
expression e,x;
statement s;
@@

-x = malloc(e);
+x = calloc(1, e);
(
if (!x) s
|
if (x == NULL) s
|
)
-memset(x, 0, e);

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoengines: separate declaration and assignment
Vincent Fu [Sat, 15 Apr 2023 00:51:44 +0000 (00:51 +0000)]
engines: separate declaration and assignment

Separate the declaraction and assignment for some variables.

This is a prep patch for a Coccinelle script that converts
mallloc+memset(,0,) to calloc.

Part of this patch was created using the Coccinelle script below.

@@
identifier x;
expression y;
statement s;
type T;
@@

-T x = malloc(y);
+T x;
+x = malloc(y);
(
if (!x) s
|
if (x == NULL) s
|
)
memset(x, 0, y);

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoengines: cleanup casts and move memset
Vincent Fu [Sat, 15 Apr 2023 00:50:58 +0000 (00:50 +0000)]
engines: cleanup casts and move memset

Drop type casting of malloc's return value. Move a memset call closer to
its corresponding malloc call.

This is a prep patch for a Coccinelle script that converts
malloc+memset(,0,) to calloc.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoci: disable __thread support for Windows msys2 build
Vincent Fu [Wed, 19 Apr 2023 14:40:07 +0000 (10:40 -0400)]
ci: disable __thread support for Windows msys2 build

Our Windows msys2 build is now broken after AppVeyor's recent image
update from clang/lld 15.0.7-3 to 16.0.0-1.

Here is the error:

    CC unittests/oslib/strcasestr.o
    CC unittests/oslib/strsep.o
  LINK fio
ld.lld: error: undefined symbol: static_tv_valid
>>> referenced by gettime.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Rishabh Shukla investigated and found that clang + ld builds
successfully. So the problem seems to be with lld 16.0.0-1.

Until we find the root cause let's just disable __thread support on
AppVeyor msys2 builds.

Link: https://github.com/axboe/fio/issues/1559
Suggested-by: Rishabh Shukla <rishabh.sh@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agodocs: update documentation for randrepeat and allrandrepeat
Vincent Fu [Fri, 24 Mar 2023 18:46:07 +0000 (18:46 +0000)]
docs: update documentation for randrepeat and allrandrepeat

Note that allrandrepeat is an alias for randrepeat and that randrepeat
actually sets random seeds for all of fio's main random number
generators.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agotest: improve evaluation of t0020.fio and t0021.fio
Vincent Fu [Fri, 24 Mar 2023 14:16:14 +0000 (14:16 +0000)]
test: improve evaluation of t0020.fio and t0021.fio

We previously used an arbirtrary test based on a count of consecutive
offsets to decide whether the offsets from t0020.fio and t0021.fio were
random or not. Replace this with a Wald-Wolfowitz runs test. This new
test calculates a statistic based on whether each offset is in the first
or second half of the LBA space. So it is not particularly powerful
although it has a more sound statistical justification than what we
originally had.

Recent changes to fio's default random number seeds produced false
positives with t0020.fio and prompted this change.

Consider calculating the test statistic directly instead of relying on
the statsmodel import in order to reduce the dependencies required.

References:
https://www.statology.org/runs-test-python/
https://www.geeksforgeeks.org/runs-test-of-randomness-in-python/
https://www.investopedia.com/terms/r/runs_test.asp
https://www.statsmodels.org/stable/generated/statsmodels.sandbox.stats.runs.runstest_1samp.html

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agot/random_seed: python script to test random seed options
Vincent Fu [Thu, 23 Feb 2023 22:53:34 +0000 (22:53 +0000)]
t/random_seed: python script to test random seed options

This new script tests combinations of randrepeat, allrandrepeat, and
randseed.

Also add this script to t/run-fio-tests.py.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoinit: clean up random seed options
Vincent Fu [Fri, 24 Mar 2023 18:16:29 +0000 (18:16 +0000)]
init: clean up random seed options

- make allrandrepeat a synonym of randrepeat. allrandrepeat is
  superfluous because the seeds set by randrepeat already encompass
  random number generators beyond the one used for random offsets.
- allow randseed to override [all]randrepeat: this is what the
  documentation implies but was not previously the case

This is a breaking change for users relying on the values of fio's
default random seeds.

Link: https://github.com/axboe/fio/pull/1546
Fixes: https://github.com/axboe/fio/issues/1502
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoinit: get rid of td_fill_rand_seeds_internal
Vincent Fu [Fri, 24 Mar 2023 18:08:25 +0000 (18:08 +0000)]
init: get rid of td_fill_rand_seeds_internal

Do all the work of td_fill_rand_seeds_internal in td_fill_rand_seeds
since td_fill_rand_seeds was basically emptied by the previous patch.

No functional change.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agoinit: refactor random seed setting
Vincent Fu [Fri, 24 Mar 2023 17:47:14 +0000 (17:47 +0000)]
init: refactor random seed setting

td->rand_seed was modified in three different places. Put all this code
in setup_random_seeds() to make it easier to understand and more
maintanable. Also put setup_random_seeds() next to the other
random-seed-related functions in init.c.

init_rand_seed() was called in three different places for fio's main random
number generators. Also put these three sets of invocations in the same
place.

Always initialize all of fio's main set of random states instead of
skipping some for sequential workloads. This makes debugging easier.

No functional change.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agorand: print out random seeds for debugging
Vincent Fu [Tue, 21 Feb 2023 22:53:00 +0000 (22:53 +0000)]
rand: print out random seeds for debugging

In order to debug how we handle random seeds let's print out the random
seeds we use in the FD_RANDOM debug output.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
12 months agot/io_uring: fix max_blocks calculation in nvme passthrough mode
Xiaoguang Wang [Thu, 13 Apr 2023 10:47:14 +0000 (18:47 +0800)]
t/io_uring: fix max_blocks calculation in nvme passthrough mode

nvme_id_ns's nsze has already been counted in logical blocks, so
there is no need to divide by bs.

Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230413104714.57703-1-xiaoguang.wang@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoMerge branch 'libaio-hang' of https://github.com/lrumancik/fio
Jens Axboe [Mon, 10 Apr 2023 21:40:45 +0000 (15:40 -0600)]
Merge branch 'libaio-hang' of https://github.com/lrumancik/fio

* 'libaio-hang' of https://github.com/lrumancik/fio:
  engines/io_uring: update getevents max to reflect previously seen events

12 months agoengines/io_uring: update getevents max to reflect previously seen events
Leah Rumancik [Mon, 10 Apr 2023 18:57:15 +0000 (11:57 -0700)]
engines/io_uring: update getevents max to reflect previously seen events

To ensure we don't return more than the requested number of events,
update the max events variable after reaping events before subsequent
calls to io_getevents system call.

Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
12 months agoMerge branch 'libaio-hang' of https://github.com/lrumancik/fio
Jens Axboe [Fri, 7 Apr 2023 22:42:07 +0000 (16:42 -0600)]
Merge branch 'libaio-hang' of https://github.com/lrumancik/fio

* 'libaio-hang' of https://github.com/lrumancik/fio:
  engines/libaio: fix io_getevents min/max events arguments

12 months agoengines/libaio: fix io_getevents min/max events arguments
Leah Rumancik [Fri, 7 Apr 2023 20:41:03 +0000 (13:41 -0700)]
engines/libaio: fix io_getevents min/max events arguments

If the io_getevents system call is interrupted, it can succeed while
returning less than the min_nr requested events. If this occurs during
the final reaping of events, libaio will call io_getevents again wtih
the same minimum events argument. Since some of the events have already
been reaped, this results in a hang. To fix this, update the arguments
for io_getevents based on the previously seen events.

Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
12 months agoio_u: fix bad style
Jens Axboe [Tue, 4 Apr 2023 15:49:19 +0000 (09:49 -0600)]
io_u: fix bad style

Fixes: 4ef1562a0135 ("io_u: Fix bad interaction with --openfiles and non-sequential file selection policy")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoengines/nfs: fix the most egregious style violations
Jens Axboe [Tue, 4 Apr 2023 15:11:19 +0000 (09:11 -0600)]
engines/nfs: fix the most egregious style violations

Not sure how this got past review...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoengines/nvme: cache errno value
Jens Axboe [Tue, 4 Apr 2023 14:51:31 +0000 (08:51 -0600)]
engines/nvme: cache errno value

It's pretty pointless to do a bunch of things in between getting
a -1/errno value, and then expect errno to still be what you want.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agoMerge branch 'master' of https://github.com/SuhoSon/fio
Jens Axboe [Tue, 4 Apr 2023 13:37:37 +0000 (07:37 -0600)]
Merge branch 'master' of https://github.com/SuhoSon/fio

* 'master' of https://github.com/SuhoSon/fio:
  thinktime: Fix missing re-init thinktime when using ramptime

12 months agoOnly expose fadvise_hint=noreuse if supported
Jens Axboe [Fri, 31 Mar 2023 18:52:01 +0000 (12:52 -0600)]
Only expose fadvise_hint=noreuse if supported

At least OSX doesn't have this option or define, just make it
available if it's there on the platform we're building on.

Fixes: eb314e7072a0 ("fio: add support for POSIX_FADV_NOREUSE")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agodocs: add noreuse fadvise_hint option
Yuanchu Xie [Fri, 31 Mar 2023 18:37:03 +0000 (11:37 -0700)]
docs: add noreuse fadvise_hint option

noreuse was added as an fadvise_hint option to apply POSIX_FADV_NOREUSE,
so we add it to the docs as well.

Signed-off-by: Yuanchu Xie <yuanchu@google.com>
Link: https://lore.kernel.org/r/20230331183703.3145788-1-yuanchu@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agofio: add support for POSIX_FADV_NOREUSE
Yuanchu Xie [Fri, 31 Mar 2023 18:37:02 +0000 (11:37 -0700)]
fio: add support for POSIX_FADV_NOREUSE

As of Linux kernel commit 17e810229cb3 ("mm: support
POSIX_FADV_NOREUSE"), POSIX_FADV_NOREUSE hints at the LRU algorithm to
ignore accesses to mapped files with this flag. Previously, it was a
no-op.

Add it in fio as an fadvise_hint option to test the new behavior.

Signed-off-by: Yuanchu Xie <yuanchu@google.com>
Link: https://lore.kernel.org/r/20230331183703.3145788-1-yuanchu@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
12 months agothinktime: Fix missing re-init thinktime when using ramptime
suho.son [Fri, 31 Mar 2023 07:10:09 +0000 (16:10 +0900)]
thinktime: Fix missing re-init thinktime when using ramptime

Prevent I/O bursts after ramptime due to thinktime.

Each thread generates a certain amount of I/O requests,
configured by thinktime_blocks.
When ramptime ends, thinktime_blocks can't control I/O.
Because thinktime_blocks are not reinitialized after ramptime.
I fixed it by reinitializing last_thinktime and last_thinktime_blocks
when ramptime ended.

Signed-off by: Suho Son <suho.son@samsung.com>

13 months agoMerge branch 'trim-support' of https://github.com/ankit-sam/fio
Jens Axboe [Mon, 27 Mar 2023 19:21:25 +0000 (13:21 -0600)]
Merge branch 'trim-support' of https://github.com/ankit-sam/fio

* 'trim-support' of https://github.com/ankit-sam/fio:
  io_uring_cmd: suppport for trim operation
  fdp: drop expensive modulo operation

13 months agoio_uring_cmd: suppport for trim operation
Ankit Kumar [Tue, 7 Mar 2023 14:21:06 +0000 (19:51 +0530)]
io_uring_cmd: suppport for trim operation

Add support for trim operation to the io_uring_cmd
ioengine.
Print ZBD zone reset stats for trim operation.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
13 months agofdp: drop expensive modulo operation
Ankit Kumar [Tue, 14 Mar 2023 09:26:26 +0000 (14:56 +0530)]
fdp: drop expensive modulo operation

Remove the usage of expensive modulo operation as the same can be easily
achieved with addition and wrapping around avilable reclaim unit handles.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
13 months agoengines/nvme: cast __u64 to unsigned long long for printing
Jens Axboe [Tue, 21 Mar 2023 14:40:14 +0000 (08:40 -0600)]
engines/nvme: cast __u64 to unsigned long long for printing

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agoengines/io_uring: use correct type for fio_nvme_get_info()
Jens Axboe [Tue, 21 Mar 2023 14:38:32 +0000 (08:38 -0600)]
engines/io_uring: use correct type for fio_nvme_get_info()

powerpc64 compiles complain about casting unsigned long long to __u64,
just use the right type to begin with.

Fixes: b3d5e3fd80e3 ("nvme: add nvme opcodes, structures and helper functions")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agodocs: clean up steadystate options
Vincent Fu [Mon, 20 Mar 2023 17:45:09 +0000 (13:45 -0400)]
docs: clean up steadystate options

Synchronize HOWTO.rst and fio.1, make a minor edit, and improve the
formatting.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agosteadystate: add some TODO items
Vincent Fu [Mon, 20 Mar 2023 15:52:22 +0000 (11:52 -0400)]
steadystate: add some TODO items

We need a better test script that includes test cases for the new
check_interval option. With the new test script we can be more
comfortable doing cleanups.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agosteadystate: fix slope calculation for variable check intervals
Vincent Fu [Mon, 20 Mar 2023 15:45:31 +0000 (11:45 -0400)]
steadystate: fix slope calculation for variable check intervals

There were several more spots where the calculations dependend on the
assumption that measurements were taken once every second. Fix those.

Fixes: 95a2f70c20c28f417f605974ab3b90c032c10024 ("fio: steadystate:
allow for custom check interval")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agofio: steadystate: allow for custom check interval
Christian Loehle [Tue, 7 Feb 2023 15:06:16 +0000 (16:06 +0100)]
fio: steadystate: allow for custom check interval

Allow for a different steady state check interval than 1s with
a new --ss_interval parameter.

Steady state is reached when the steady state condition (like slope) is
true when comparing the last windows (set with --ss_dur).
The actual values for this comparison is currently calculated for a 1s
interval during the window.
This is especially problematic for slow random devices, where the values do
not converge for such a fine granularity.
Letting the user set this solves this problem, although requires them figuring
out an appropriate value themselves.

--ss=iops:5% --ss_dur=120s should reproduce this for many (slower) devices.
Then adding like --ss_interval=20s may let it converge.

Signed-off-by: Christian Loehle <cloehle@posteo.de>
13 months agostat: Fix ioprio print
Damien Le Moal [Fri, 10 Mar 2023 01:28:39 +0000 (10:28 +0900)]
stat: Fix ioprio print

When using per-priority statistics for workloads using multiple
different priority values, the statistics output displays the priority
class and value (level) for each set of statistics. However, this is
done using linux priority values coding, that is, assuming that the
priority level is at most 7 (lower 3-bits). However, this is not always
the case for all OSes. E.g. dragonfly allows IO priorities up to a
value of 10.

Introduce the OS dependent ioprio_class() and ioprio() macros to extract
the fields from an ioprio value according to the OS capabilities. A
generic definition (always returning 0) for these macros in os/os.h is
added and used for all OSes that do not define these macros.

The functions show_ddir_status() and add_ddir_status_json() are modified
to use these new macros to fix per priority statistics output. The
modification includes changes to the loops over the clat_prio array to
reduce indentation levels, making the code a little cleaner.

Fixes: 692dec0cfb4b ("stat: report clat stats on a per priority granularity")
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agot/io_uring: abstract out init_new_io() helper
Jens Axboe [Tue, 14 Mar 2023 20:03:32 +0000 (14:03 -0600)]
t/io_uring: abstract out init_new_io() helper

We do this in 4 different spots, put it in a helper.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agot/io_uring: use the get_offset() code to retrieve pass-through offset
Jens Axboe [Tue, 14 Mar 2023 19:59:32 +0000 (13:59 -0600)]
t/io_uring: use the get_offset() code to retrieve pass-through offset

No point in duplicating this code, use the helper.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agot/io_uring: avoid truncation of offset on 32-bit builds
Jens Axboe [Tue, 14 Mar 2023 19:58:13 +0000 (13:58 -0600)]
t/io_uring: avoid truncation of offset on 32-bit builds

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agoFio 3.34 fio-3.34
Jens Axboe [Tue, 14 Mar 2023 12:44:41 +0000 (06:44 -0600)]
Fio 3.34

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agot/zbd: fix minimum write size to sequential write required zones
Shin'ichiro Kawasaki [Mon, 6 Mar 2023 05:58:40 +0000 (14:58 +0900)]
t/zbd: fix minimum write size to sequential write required zones

ZBC and ZAC require that writes to sequential write required zones shall
be aligned to physical block size. However, the t/zbd/test-zbd-support
script uses logical block size as the minimum write size. When SMR
drives have the physical block size larger than the logical block size,
writes with the logical block size causes unaligned write command error.

To fix it, use correct value as the minimum write size. As for zoned
block devices, introduce a helper function min_seq_write_size(), which
checks sysfs attributes and returns the correct size. Refer the
attribute zone_write_granularity when it is available, which provides the
minimum write size regardless of the device type. If the attribute is
not available, refer the attribute physical_block_size for SMR devices,
and the logical_block_size attribute for other devices. As for SG node
device, refer physical block size that zbc_info command reports.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agot/zbd: rename logical_block_size to min_seq_write_size
Shin'ichiro Kawasaki [Mon, 6 Mar 2023 05:58:39 +0000 (14:58 +0900)]
t/zbd: rename logical_block_size to min_seq_write_size

The test script t/zbd/test-zbd-support assumes that the logical block
size is the minimum size unit to write to sequential write required
zones, then it uses a variable named 'logical_block_size' to keep the
minimum size. The assumption is true for ZNS devices but not for ZBC/ZAC
devices. Rename the variable from 'logical_block_size' to
'min_seq_write_size' to not imply the wrong assumption.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agoMerge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio
Jens Axboe [Fri, 3 Mar 2023 17:46:26 +0000 (10:46 -0700)]
Merge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio

* 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio:
  Refactor for_each_td() to catch inappropriate td ptr reuse

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agoMerge branch 'Fix_calc_thread_status_ramp_time_check' of https://github.com/horshack...
Jens Axboe [Fri, 3 Mar 2023 17:43:05 +0000 (10:43 -0700)]
Merge branch 'Fix_calc_thread_status_ramp_time_check' of https://github.com/horshack-dpreview/fio

* 'Fix_calc_thread_status_ramp_time_check' of https://github.com/horshack-dpreview/fio:
  Fix --bandwidth-log segmentation fault when numjobs even multiple of 8

13 months agoRefactor for_each_td() to catch inappropriate td ptr reuse
Horshack [Thu, 2 Mar 2023 20:12:54 +0000 (15:12 -0500)]
Refactor for_each_td() to catch inappropriate td ptr reuse

I recently introduced a bug caused by reusing a struct thread_data *td
after the end of a for_each_td() loop construct.

Link: https://github.com/axboe/fio/pull/1521#issuecomment-1448591102
To prevent others from making this same mistake, this commit refactors
for_each_td() so that both the struct thread_data * and the loop index
variable are placed inside their own scope for the loop. This will cause
any reference to those variables outside the for_each_td() to produce an
undeclared identifier error, provided the outer scope doesn't already
reuse those same variable names for other code within the routine (which
is fine because the scopes are separate).

Because C/C++ doesn't let you declare two different variable types
within the scope of a for() loop initializer, creating a scope for both
struct thread_data * and the loop index required explicitly declaring a
scope with a curly brace. This means for_each_td() includes an opening
curly brace to create the scope, which means all uses of for_each_td()
must now end with an invocation of a new macro named end_for_each()
to emit an ending curly brace to match the scope brace created by
for_each_td():

for_each_td(td) {
while (td->runstate < TD_EXITED)
sleep(1);
} end_for_each();

The alternative is to end every for_each_td() construct with an inline
curly brace, which is off-putting since the implementation of an extra
opening curly brace is abstracted in for_each_td():

for_each_td(td) {
while (td->runstate < TD_EXITED)
sleep(1);
}}

Most fio logic only declares "struct thread_data *td" and "int i" for use in
for_each_td(), which means those declarations will now cause -Wunused-variable
warnings since they're not used outside the scope of the refactored
for_each_td(). Those declarations have been removed.

Implementing this change caught a latent bug in eta.c::calc_thread_status()
that accesses the ending value of struct thread_data *td after the end
of for_each_td(), now manifesting as a compile error, so working as
designed :)

Signed-off-by: Adam Horshack (horshack@live.com)
13 months agoFix --bandwidth-log segmentation fault when numjobs even multiple of 8
Horshack [Fri, 3 Mar 2023 13:14:53 +0000 (08:14 -0500)]
Fix --bandwidth-log segmentation fault when numjobs even multiple of 8

Segmentation fault occurs when aggregate bandwidth logging is enabled
(--bandwidth-log) and numjobs is an even multiple of 8. Fault occurs
because logic is using the terminating value of struct thread_data *td
from the most recent for_each_td(). This bug was caught by the
refactoring of for_each_td().

Link: https://github.com/axboe/fio/issues/1534
Signed-off-by: Adam Horshack (horshack@live.com)
13 months agoMerge branch 'fiologparser-fix' of https://github.com/patrakov/fio
Vincent Fu [Fri, 3 Mar 2023 00:57:17 +0000 (19:57 -0500)]
Merge branch 'fiologparser-fix' of https://github.com/patrakov/fio

* 'fiologparser-fix' of https://github.com/patrakov/fio:
  fix fiologparser.py to work with new logging format

13 months agoexamples: add fiograph diagram for uring-cmd-fdp.fio
Vincent Fu [Tue, 28 Feb 2023 18:58:58 +0000 (13:58 -0500)]
examples: add fiograph diagram for uring-cmd-fdp.fio

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agofdp: change the order of includes to fix Windows build error
Vincent Fu [Tue, 28 Feb 2023 18:01:32 +0000 (13:01 -0500)]
fdp: change the order of includes to fix Windows build error

On Windows fio.h includes some definitions needed by file.h.
fio.h actually includes file.h already but we can retain the file.h
include in fdp.c since it refers to some declarations that were added
there.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agoMerge branch 'doc-Clarify_Runtime_Param' of https://github.com/horshack-dpreview/fio
Jens Axboe [Tue, 28 Feb 2023 16:08:13 +0000 (09:08 -0700)]
Merge branch 'doc-Clarify_Runtime_Param' of https://github.com/horshack-dpreview/fio

* 'doc-Clarify_Runtime_Param' of https://github.com/horshack-dpreview/fio:
  Clarify documentation for runtime parameter

13 months agoClarify documentation for runtime parameter
Horshack [Fri, 10 Feb 2023 19:00:11 +0000 (14:00 -0500)]
Clarify documentation for runtime parameter

I realize this is highly subjective but I think the description of the
runtime parameter could be made a bit more precise. I misinterpreted its
meaning after reading the doc and only learned of my mistake by trial and
error using fio.  Either I'm just slow or the description could use
just a little more precision :)

Signed-off-by: Adam Horshack (horshack@live.com)
13 months agoRevert "ioengines.c:346: td_io_queue: Assertion `res == 0' failed"
Jens Axboe [Tue, 28 Feb 2023 15:54:36 +0000 (08:54 -0700)]
Revert "ioengines.c:346: td_io_queue: Assertion `res == 0' failed"

This reverts commit d5a47449ce79001ba233fe6d0499627d0438cb69.

The change to rate-submit.c is clearly bogus, as it's referencing
'td' outside of the actual 'td' loop. It's not valid at that
point.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agofdp: cleanup init
Jens Axboe [Tue, 28 Feb 2023 15:28:51 +0000 (08:28 -0700)]
fdp: cleanup init

I don't believe we can have a NULL ->io_ops here, but let's just
add an error check and make the static checkers happy as they don't
like the non-NULL check and then a later deref in the other branch.

Add missing braces while at it.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agofio: add fdp support for io_uring_cmd nvme engine
Keith Busch [Mon, 27 Feb 2023 15:51:34 +0000 (07:51 -0800)]
fio: add fdp support for io_uring_cmd nvme engine

Add support for NVMe TP4146 Flexible Data Placemen, allowing placement
identifiers in write commands. The user can enabled this with the new
"fdp=1" parameter for fio's io_uring_cmd ioengine. By default, the fio
jobs will cycle through all the namespace's available placement
identifiers for write commands. The user can limit which placement
identifiers can be used with additional parameter, "fdp_pli=<list,>",
which can be used to separate write intensive jobs from less intensive
ones.

Setting up your namespace for FDP is outside the scope of 'fio', so this
assumes the namespace is already properly configured for the mode.

Link: https://lore.kernel.org/fio/CAKi7+wfX-eaUD5pky5cJ824uCzsQ4sPYMZdp3AuCUZOA1TQrYw@mail.gmail.com/T/#m056018eb07229bed00d4e589f9760b2a2aa009fc
Based-on-a-patch-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
[Vincent: fold in sfree fix from Ankit]
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
13 months agoMerge branch 'Fix_Assert_TdIoQueue_Serialize_Overlap_Offload' of https://github.com...
Jens Axboe [Tue, 28 Feb 2023 13:39:58 +0000 (06:39 -0700)]
Merge branch 'Fix_Assert_TdIoQueue_Serialize_Overlap_Offload' of https://github.com/horshack-dpreview/fio

* 'Fix_Assert_TdIoQueue_Serialize_Overlap_Offload' of https://github.com/horshack-dpreview/fio:
  ioengines.c:346: td_io_queue: Assertion `res == 0' failed

Signed-off-by: Jens Axboe <axboe@kernel.dk>
13 months agoMerge branch 'Fix_Bad_Hdr_Rand_Seed_For_Requeued_IO' of https://github.com/horshack...
Jens Axboe [Tue, 28 Feb 2023 13:38:50 +0000 (06:38 -0700)]
Merge branch 'Fix_Bad_Hdr_Rand_Seed_For_Requeued_IO' of https://github.com/horshack-dpreview/fio

* 'Fix_Bad_Hdr_Rand_Seed_For_Requeued_IO' of https://github.com/horshack-dpreview/fio:
  Fix "verify bad_hdr rand_seed" for requeued I/Os

13 months agoMerge branch 'master' of https://github.com/Cuelive/fio
Jens Axboe [Tue, 28 Feb 2023 12:55:55 +0000 (05:55 -0700)]
Merge branch 'master' of https://github.com/Cuelive/fio

* 'master' of https://github.com/Cuelive/fio:
  blktrace: fix compilation error on the uos system

13 months agoblktrace: fix compilation error on the uos system
Cuelive [Tue, 28 Feb 2023 02:03:21 +0000 (10:03 +0800)]
blktrace: fix compilation error on the uos system

When compiling on uos, it fails with an undefined reference to 'major'. Fix
this by including the correct header for it.

liuyafei <liuyafei@uniontech.com>

13 months agoFix "verify bad_hdr rand_seed" for requeued I/Os
Horshack [Sun, 26 Feb 2023 15:12:05 +0000 (10:12 -0500)]
Fix "verify bad_hdr rand_seed" for requeued I/Os

On configurations that can cause I/Os to be internally requeued from
FIO_Q_BUSY such as '--iodepth_batch_complete_max', and the workload has
verify enabled, the subsequent verification of the data fails with a bad
verify rand_seed because the pattern for the I/O is generated twice for
the same I/O, causing the seed to become out of sync when the verify is
later performed. The seed is generate twice because do_io() handles the
I/O twice, first when it originates the I/O and again when it later gets
the same I/O back from get_io_u() after it's is pulled from the requeue
list, which is where the first submission landed due to the workload
reaching '--iodepth_batch_complete_max'.

The fix is for do_io() to track when it has generated the verify pattern
for an I/O via a new io_u flag 'IO_U_F_PATTERN_DONE', avoiding a second
call to populate_verify_io_u() when that flag is detected.

Link: https://github.com/axboe/fio/issues/1526
Signed-off-by: Adam Horshack (horshack@live.com)
14 months agoMerge branch 'master' of https://github.com/bvanassche/fio
Vincent Fu [Fri, 24 Feb 2023 01:17:31 +0000 (20:17 -0500)]
Merge branch 'master' of https://github.com/bvanassche/fio

* 'master' of https://github.com/bvanassche/fio:
  zbd: Make an error message more detailed
  zbd: Report the zone capacity
  io_u: Add a debug message in fill_io_u()

14 months agozbd: Make an error message more detailed
Bart Van Assche [Fri, 13 Jan 2023 22:36:26 +0000 (14:36 -0800)]
zbd: Make an error message more detailed

If zone data is invalid, report in detail why it is invalid.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
14 months agozbd: Report the zone capacity
Bart Van Assche [Wed, 22 Feb 2023 21:54:18 +0000 (13:54 -0800)]
zbd: Report the zone capacity

The zone capacity is important information. Hence report the zone
capacity if ZBD debugging is enabled.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
14 months agoio_u: Add a debug message in fill_io_u()
Bart Van Assche [Wed, 22 Feb 2023 21:40:30 +0000 (13:40 -0800)]
io_u: Add a debug message in fill_io_u()

A debug message is logged before each 'return io_u_eof' statement in
fill_io_u() except one. Hence add a debug message in front of that one
return statement.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
14 months agofix fiologparser.py to work with new logging format
Alexander Patrakov [Wed, 22 Feb 2023 08:35:59 +0000 (16:35 +0800)]
fix fiologparser.py to work with new logging format

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

This commit explicitly limits fiologparser.py to only reading the first
2 columns in the log file, because they are the only columns used.

This is similar to issue #928.

Signed-off-by: Alexander Patrakov <patrakov@gmail.com>
14 months agoMerge branch 'Verify_Bad_Hdr_Rand_Seed_Mult_Workload_Iterations_Non_Repeating_Seed...
Jens Axboe [Tue, 21 Feb 2023 16:37:09 +0000 (09:37 -0700)]
Merge branch 'Verify_Bad_Hdr_Rand_Seed_Mult_Workload_Iterations_Non_Repeating_Seed' of https://github.com/horshack-dpreview/fio

* 'Verify_Bad_Hdr_Rand_Seed_Mult_Workload_Iterations_Non_Repeating_Seed' of https://github.com/horshack-dpreview/fio:
  Bad header rand_seed with time_based or loops with randrepeat=0 verify

14 months agoconfigure: restore dev-dax and libpmem
Vincent Fu [Mon, 20 Feb 2023 13:28:15 +0000 (08:28 -0500)]
configure: restore dev-dax and libpmem

The commit removing pmemblk inadvertently removed dev-dax and
libpmem ioengines as well.

Tested-by: Yi Zhang yi.zhang@redhat.com
Fixes: 04c1cdc4c108c6537681ab7c50daaed6d2fb4c93 ("pmemblk: remove
pmemblk engine")
Fixes: https://github.com/axboe/fio/issues/1523
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
14 months agoBad header rand_seed with time_based or loops with randrepeat=0 verify
Horshack [Sat, 18 Feb 2023 20:22:54 +0000 (15:22 -0500)]
Bad header rand_seed with time_based or loops with randrepeat=0 verify

Verify fails with "bad header rand_seed" when multiple iterations of
do_io() execute (time_based=1 or loops>0), with verify enabled
and randrepeat=0

The root cause is do_verify() resetting the verify seed back to the
job-init value, which works for verification of the first iteration of
do_io() but fails for subsequent iterations because the seed is left in
its post-do_io() state after the first do_verify(), which means
different rand values for the second iteration of do_io() yet the second
iteration of do_verify() will revert back again to the job-init seed
value.

The fix is to revert the verify seed for randrepeat=0 back to ts state
when do_io() last ran rather than to its job-init value. That will allow
do_verify() to use the correct seed for each iteration while still
retaining a per-iteration unique verify seed.

Link: https://github.com/axboe/fio/issues/1517#issuecomment-1430282533
Signed-off-by: Adam Horshack (horshack@live.com)
14 months agoioengines.c:346: td_io_queue: Assertion `res == 0' failed
Horshack [Sat, 18 Feb 2023 18:07:09 +0000 (13:07 -0500)]
ioengines.c:346: td_io_queue: Assertion `res == 0' failed

Assertion in ioengines.c::td_io_queue() fails for pthread_mutex_unlock()
on overlap_check mutex when serialize_overlap=1, io_submit_mode=offload,
and verify=<any> are used together.

backend.c::fio_io_sync() invokes td_io_queue(), which expects the caller
to have ownership of the overlap_check mutex when serialize_overlap
and offloading are configured, as part of the overlap-check interlock
with IO_U_F_FLIGHT. The mutex is not acquired for this path because it's
not an I/O requiring an overlap check.

The fix is to refine the conditional that triggers td_io_queue() to
release the overlap_check mutex. Rather than using broad config options,
the conditional now uses a new io_u flag named IO_U_F_OVERLAP_LOCK, which
is only set for the offload worker thread path that acquires the mutex.

Link: https://github.com/axboe/fio/issues/1520
Signed-off-by: Adam Horshack (horshack@live.com)
14 months agobackend: fix runtime when used with thinktime
Ankit Kumar [Fri, 17 Feb 2023 07:03:22 +0000 (12:33 +0530)]
backend: fix runtime when used with thinktime

Runtime for fio jobs when used in conjuction with thinktime,
thinktime_iotime and thinktime_spin were sometimes more than
what is specified. Add a fix so that fio doesn't spin or sleep
for any duration beyond runtime.

For the first cycle fio starts by doing I/O for
thinktime + thinktime_iotime, which should just be for
thinktime_iotime. Add a fix for that.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20230217070322.14163-2-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
14 months agoMerge branch 'remove_pmemblk_engine' of github.com:osalyk/fio
Vincent Fu [Fri, 17 Feb 2023 19:55:31 +0000 (14:55 -0500)]
Merge branch 'remove_pmemblk_engine' of github.com:osalyk/fio

* 'remove_pmemblk_engine' of github.com:osalyk/fio:
  pmemblk: remove pmemblk engine

14 months agofilesetup: don't skip flags for trim workloads
Vincent Fu [Fri, 17 Feb 2023 18:22:10 +0000 (13:22 -0500)]
filesetup: don't skip flags for trim workloads

Fio has not been setting O_DIRECT, O_SYNC, O_DSYNC, and O_CREAT for
workloads that include trim commands. Stop doing this and actually set
these flags when requested for workloads that include trim commands.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
14 months agoGet rid of O_ATOMIC
Jens Axboe [Fri, 17 Feb 2023 18:14:47 +0000 (11:14 -0700)]
Get rid of O_ATOMIC

This feature never went upstream on the Linux kernel side, let's just
get rid of it.

The option is left for now, but we can deprecate that or even probably
remove it as it will never had had any effect.

Signed-off-by: Jens Axboe <axboe@kernel.dk>