fio.git
3 days agoengines/io_uring: eliminate FDP memory corruption risk master
Vincent Fu [Fri, 7 Jun 2024 13:37:49 +0000 (09:37 -0400)]
engines/io_uring: eliminate FDP memory corruption risk

We only allocate FDP_MAX_RUHS reclaim unit handle status descriptors. It
is possible that the device will have more than this many descriptors.
Make sure we do not run over the end of the buffer we have allocated
when this happens.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 days agoRevert "smalloc: smalloc() already clears memory, scalloc() need not do it again"
Vincent Fu [Thu, 6 Jun 2024 17:57:47 +0000 (13:57 -0400)]
Revert "smalloc: smalloc() already clears memory, scalloc() need not do it again"

Originally:
smalloc cleared the buffer
scalloc did not need to clear the differ

Later: 9c3e13e3314da394698ca32f21cc46d46b7cfe47
smalloc was changed to not clear the buffer
scalloc was not updated to clear the buffer when the above smalloc
change was made

Originally smalloc always cleared the buffer. So it wasn't necessary for
scalloc to clear it again. But later on smalloc was changed to no longer
clear the buffer but scalloc was not changed back to clear the buffer.

Reverting this commit makes scalloc clear the buffer again.

This reverts commit a640ed36829f3be6d9dd8c7974dba41b9b59e6a5.

Fixes: https://github.com/axboe/fio/issues/1772
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
5 days agodataplacement: increase max data placement IDs to 128
Vincent Fu [Wed, 5 Jun 2024 15:19:51 +0000 (15:19 +0000)]
dataplacement: increase max data placement IDs to 128

Some users have requested the ability to test a larger number of
placement IDs in a single job. Bump the max placement IDs to 128.
Change the type to 16 bits to reduce the amount of space these
additional IDs will consume.

Also bump the server version for this change.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 days agodocs: update and clarify plids option
Vincent Fu [Mon, 3 Jun 2024 18:05:24 +0000 (18:05 +0000)]
docs: update and clarify plids option

Make it clearer that for FDP the values specified by the plids option
are indices referencing the list of placement identifiers available to
the namespace.

Also note that it now accepts ranges.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 days agot/nvmept_fdp: add tests for plid ranges
Vincent Fu [Mon, 3 Jun 2024 19:04:43 +0000 (19:04 +0000)]
t/nvmept_fdp: add tests for plid ranges

Add a few tests to make sure that parsing of ranges for placement ID
indices works.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 days agooptions: support ranges for FDP plids option
Vincent Fu [Thu, 30 May 2024 18:53:34 +0000 (18:53 +0000)]
options: support ranges for FDP plids option

Instead of forcing users to list every single placement ID, allow users
to specify a list of ranges (1-3, 4-6, 7, 8) for placement IDs.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 days agodocs: fix operations misspellings
Vincent Fu [Tue, 4 Jun 2024 12:53:07 +0000 (08:53 -0400)]
docs: fix operations misspellings

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 days agoMerge branch 'io_uring_cmd/support-write-family' of https://github.com/samsungds/fio
Vincent Fu [Mon, 3 Jun 2024 14:17:38 +0000 (10:17 -0400)]
Merge branch 'io_uring_cmd/support-write-family' of https://github.com/samsungds/fio

* 'io_uring_cmd/support-write-family' of https://github.com/samsungds/fio:
  io_uring: Add 'write_mode' option for optional cmds

9 days agoio_uring: Add 'write_mode' option for optional cmds
Minwoo Im [Tue, 28 May 2024 08:02:22 +0000 (17:02 +0900)]
io_uring: Add 'write_mode' option for optional cmds

Add a new option 'write_mode' to support additional optional Write
command family such as Write Uncorrectable and Write Zeroes in NVMe.
Since we have io_uring_cmd ioengine where we can define the actual
opcode of the command, this option will be used to test NVMe device with
various combination of Write command types.

'write_mode' option can be given either 'write', 'uncor', 'zeroes' or
'verify'.  'write' is for normal Write command which is by default,
'uncor' is for Write Uncorrectable, 'zeroes' for Write Zeroes and 'verify'
for Verify command  This should be used with DDIR_WRITE ddir.

This patch updates command's opcode in fio_ioring_init() to avoid
branches in the I/O hottest path giving opcode value to the
fio_nvme_uring_cmd_prep() as an argument.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
10 days agoMerge branch 'fix-coverity-scan-defect' of https://github.com/parkvibes/fio
Vincent Fu [Fri, 31 May 2024 13:46:59 +0000 (09:46 -0400)]
Merge branch 'fix-coverity-scan-defect' of https://github.com/parkvibes/fio

* 'fix-coverity-scan-defect' of https://github.com/parkvibes/fio:
  iolog: fix Error handling issues (NEGATIVE_RETURNS)
  iolog: fix Null pointer dereferences (FORWARD_NULL)

10 days agoiolog: fix Error handling issues (NEGATIVE_RETURNS)
Hyunwoo Park [Thu, 30 May 2024 02:48:57 +0000 (02:48 +0000)]
iolog: fix Error handling issues (NEGATIVE_RETURNS)

CID 494151: Error handling issues (NEGATIVE_RETURNS) @ io_u.c:1877 in get_io_u()
This patch removes negative returns from dp_init() to ensure
its value can be properly consumed by td_verror()

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
10 days agoiolog: fix Null pointer dereferences (FORWARD_NULL)
Hyunwoo Park [Thu, 30 May 2024 02:15:05 +0000 (02:15 +0000)]
iolog: fix Null pointer dereferences (FORWARD_NULL)

CID 494150: Null pointer dereferences (FORWARD_NULL) @ iolog.c:148 in ipo_special()
This patch removes the possibility of null pointer dereferencing(io_u->file)
throughout the call stack of get_io_u() → read_iolog_get() → dp_fill_dspec_data()

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
12 days agoMerge branch 'enable-dataplacement-while-replaying-io' of https://github.com/parkvibe...
Vincent Fu [Tue, 28 May 2024 18:19:19 +0000 (14:19 -0400)]
Merge branch 'enable-dataplacement-while-replaying-io' of https://github.com/parkvibes/fio

* 'enable-dataplacement-while-replaying-io' of https://github.com/parkvibes/fio:
  t/nvmept_fdp: add a test(402)
  fio: enable dataplacement(fdp) while replaying I/Os

13 days agoMerge branch 'io_uring/fix-negative-cqe-status' of https://github.com/minwooim/fio
Jens Axboe [Tue, 28 May 2024 15:57:04 +0000 (09:57 -0600)]
Merge branch 'io_uring/fix-negative-cqe-status' of https://github.com/minwooim/fio

* 'io_uring/fix-negative-cqe-status' of https://github.com/minwooim/fio:
  options: Add support hex value to ignore_error
  io_uring: Fix the flip to negative of CQE status

2 weeks agot/nvmept_fdp: add a test(402)
Hyunwoo Park [Mon, 27 May 2024 05:37:41 +0000 (05:37 +0000)]
t/nvmept_fdp: add a test(402)

A test(402) checks whether dataplacement(fdp) works fine while replaying iologs

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
2 weeks agofio: enable dataplacement(fdp) while replaying I/Os
Hyunwoo Park [Thu, 23 May 2024 07:30:36 +0000 (07:30 +0000)]
fio: enable dataplacement(fdp) while replaying I/Os

Add initialization and dataplacement logic to enable
dataplacement(fdp) while fio replays I/Os with read_iolog.

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
2 weeks agoMerge branch 'nvme/support-sync-fua-for-iouring-v2' of https://github.com/minwooim/fio
Vincent Fu [Fri, 24 May 2024 16:44:44 +0000 (12:44 -0400)]
Merge branch 'nvme/support-sync-fua-for-iouring-v2' of https://github.com/minwooim/fio

* 'nvme/support-sync-fua-for-iouring-v2' of https://github.com/minwooim/fio:
  io_uring: Add 'readfua' and 'writefua' options

2 weeks agoio_uring: Add 'readfua' and 'writefua' options
Minwoo Im [Tue, 14 May 2024 05:21:09 +0000 (14:21 +0900)]
io_uring: Add 'readfua' and 'writefua' options

Provide options to set the FUA flag in CDW12 in the NVMe command.  FUA
affects the internal operation of the NVMe controller and is used for
testing.  In this patchset we expand readfua and writefua options to
directly control FUA flag in io_uring_cmd engine.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
2 weeks agoMerge branch 'enable-dataplacement-scheme' of https://github.com/parkvibes/fio
Vincent Fu [Tue, 21 May 2024 18:06:32 +0000 (14:06 -0400)]
Merge branch 'enable-dataplacement-scheme' of https://github.com/parkvibes/fio

* 'enable-dataplacement-scheme' of https://github.com/parkvibes/fio:
  t/nvmept_fdp: add tests(302,303,400,401) for fdp scheme
  fdp: support scheme placement id (index) selection

2 weeks agot/nvmept_fdp: add tests(302,303,400,401) for fdp scheme
Hyunwoo Park [Thu, 9 May 2024 04:16:37 +0000 (04:16 +0000)]
t/nvmept_fdp: add tests(302,303,400,401) for fdp scheme

- 302/303: invalid options tests
- 400/401: check whether fdp scheme works properly

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
2 weeks agofdp: support scheme placement id (index) selection
Hyunwoo Park [Tue, 30 Apr 2024 06:58:12 +0000 (06:58 +0000)]
fdp: support scheme placement id (index) selection

Add a new placement id selection method called scheme. It allows
users to assign a placement ID (index) depending on the offset range.
The strategy of the scheme is specified in the file by user and
is applicable using the option dp_scheme.

Signed-off-by: Hyunwoo Park <dshw.park@samsung.com>
3 weeks agooptions: Add support hex value to ignore_error
Minwoo Im [Wed, 15 May 2024 05:46:04 +0000 (14:46 +0900)]
options: Add support hex value to ignore_error

The 'ignore_error=str' option expects either the name or the numeric
value of the errno in string format.  With recent additions like
io_uring_cmd ioengine, it's been possible to check not only errno values
but also the actual status values provided by the storage device.

Given that most status codes in NVMe specs are represented in
hexadecimal, specifying error values in hexadecimal is also useful to
ignore some errors.

For example, DULBE (Deallocated or Unwritten Logical Block Error) status
code can be ignored:

ignore_error=0x287

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
3 weeks agoio_uring: Fix the flip to negative of CQE status
Minwoo Im [Wed, 15 May 2024 05:36:40 +0000 (14:36 +0900)]
io_uring: Fix the flip to negative of CQE status

Since cqe->res is expected to be a negative value of errno, it's been
flipped to a positive value before passing it to io_u.c.  However, in
case of io_uring_cmd with cmd_type=nvme, cqe->res might represent a NVMe
completion status type and code along with control fields such as DNR
since nvme_uring_cmd_end_io() in the NVMe driver sets the completion
status value and passes it up to io_uring.

For example, If a DULBE(Deallocated or Unwritten Logical Block Error)
is coming up from the device, cqe->res here would be 0x4287 which is a
DULBE error code of media error type.

This patch unified the error code to a positive value regardless of the
error type.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
5 weeks agot/zbd: avoid test case 31 failure with small devices
Shin'ichiro Kawasaki [Tue, 30 Apr 2024 10:30:22 +0000 (19:30 +0900)]
t/zbd: avoid test case 31 failure with small devices

The test case assumed that the test target devices have 128 or more
sequential write required zones and uses 128 as the minimum number of
zones to write. This caused failure when the devices had a smaller
number of sequential write required zones. To avoid the failure, count
the actual number of sequential write required zones and use it if it is
smaller than 128.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240430103022.4136039-4-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
5 weeks agot/zbd: add test case to confirm verify_backlog=1 options
Shin'ichiro Kawasaki [Tue, 30 Apr 2024 10:30:21 +0000 (19:30 +0900)]
t/zbd: add test case to confirm verify_backlog=1 options

The previous commit fixed the verify failure due to the zone reset with
the verify_backlog option. Add a test to confirm the fix.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240430103022.4136039-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
5 weeks agozbd: remove unnecessary verify_backlog check in zbd_file_reset()
Shin'ichiro Kawasaki [Tue, 30 Apr 2024 10:30:20 +0000 (19:30 +0900)]
zbd: remove unnecessary verify_backlog check in zbd_file_reset()

The commit c5c8b92be5a2 ("zbd: fix zone reset condition for verify")
improved zbd_file_reset() to not reset zones when data to verify is
left. To check the left verify data, it tried to do the same as
check_get_verify() including the check for the modulo operation
"td->io_hist_len % td->o.verify_backlog". This check is required in
check_get_verify() to know when to do the verify backlog operation.
However, this check is not required in zbd_file_reset() since zone reset
is not related to the verify backlog timing. The unnecessary check for
"td->io_hist_len % td->o.verify_backlog" allows to reset zones even when
td->io_hist_len is non-zero and the data to verify is left. It erases
the data to verify and causes verify errors. Fix this by removing the
unnecessary check.

Fixes: c5c8b92be5a2 ("zbd: fix zone reset condition for verify")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240430103022.4136039-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/nvmept_trim: increase transfer size for some tests
Vincent Fu [Thu, 25 Apr 2024 17:00:54 +0000 (13:00 -0400)]
t/nvmept_trim: increase transfer size for some tests

The final sequence of tests uses a block size of 4096 bytes. This can be
slow enough on some platforms to trigger a 10-minute timeout. Increase
the block size to 256K to reduce the run time.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agodocs: update for new data placement options
Vincent Fu [Wed, 17 Jan 2024 18:52:48 +0000 (18:52 +0000)]
docs: update for new data placement options

Update the HOWTO and man page for the unified data placement options
that cover both FDP and Streams.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/nvmept_streams: test NVMe streams support
Vincent Fu [Fri, 5 Jan 2024 18:04:10 +0000 (18:04 +0000)]
t/nvmept_streams: test NVMe streams support

This test script uses the io_uring pass-through ioengine to test NVMe
streams support.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agodataplacement: add a debug print for IOs
Vincent Fu [Thu, 4 Apr 2024 18:11:42 +0000 (18:11 +0000)]
dataplacement: add a debug print for IOs

This is useful for testing.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agooptions: parse placement IDs as unsigned values
Vincent Fu [Thu, 4 Apr 2024 16:46:21 +0000 (16:46 +0000)]
options: parse placement IDs as unsigned values

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agooptions: reject placement IDs larger than the max
Vincent Fu [Thu, 4 Apr 2024 16:40:03 +0000 (16:40 +0000)]
options: reject placement IDs larger than the max

Placement IDs are a 16-bit value. So we should notify users if the
provided placement IDs are too large.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agofio: support NVMe streams
Vincent Fu [Wed, 17 Jan 2024 15:19:07 +0000 (15:19 +0000)]
fio: support NVMe streams

Make small adjustments to the code supporting FDP to accommodate NVMe
streams.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agot/nvmept_fdp.py: test script for FDP
Vincent Fu [Tue, 9 Jan 2024 04:14:19 +0000 (04:14 +0000)]
t/nvmept_fdp.py: test script for FDP

This test script uses the io_uring pass-through ioengine to test fio's
FDP support. This uses both the orignal and the new fdp-related options.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agofio: create over-arching data placement option
Vincent Fu [Wed, 3 Jan 2024 20:16:19 +0000 (20:16 +0000)]
fio: create over-arching data placement option

Since FDP and streams are similar, we should have an over-arching data
placement option that encompasses both of these frameworks instead of
having separate sets of similar options for FDP and streams.

With a common set of options, users will be able to select the data
placement strategy (fdp or streams), the placement identifiers to use,
and the algorithm for selecting from the list of placement identifiers.

The original set of FDP options is retained for backward compatibility.

No functional change.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
6 weeks agofio: rename fdp.[c,h] to dataplacement.[c,h]
Vincent Fu [Thu, 18 Apr 2024 17:55:27 +0000 (17:55 +0000)]
fio: rename fdp.[c,h] to dataplacement.[c,h]

We can use code in the files to support NVMe streams.  Streams also
falls under the umbrella of data placement, so it seems reasonable to
put streams and FDP code in the same source files.

Also change the prefix of some functions from fdp_ to dp_ to indicate
that they are not specific to FDP but apply more generally to the two
data placement features.

No functional change.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agoMerge branch 'master' of https://github.com/celestinechen/fio
Jens Axboe [Fri, 19 Apr 2024 19:51:05 +0000 (13:51 -0600)]
Merge branch 'master' of https://github.com/celestinechen/fio

* 'master' of https://github.com/celestinechen/fio:
  FIO with fsync option issues more DDIR_SYNC commands than expected

7 weeks agoFIO with fsync option issues more DDIR_SYNC commands than expected
celestinechen [Fri, 19 Apr 2024 06:22:15 +0000 (06:22 +0000)]
FIO with fsync option issues more DDIR_SYNC commands than expected

Issue and root cause:
When fsync option is used, the number of flush (or DDIR_SYNC) commands
issued is more than the expected number of flush commands.
To elaborate:
- In the fio config file, consider fsync=1
1. FIO issues 1 write command
2. After write completes, FIO sets last_was_sync variable to false
3. FIO issues 1 flush command
4. FIO keeps issuing flush commands since last_was_sync is still false
and this causes more flush commands to be issued than expected
5. last_was_sync is set to true after the flush command completes
- The above steps repeats until the workload is completed.
Fix:
Instead of setting last_was_sync to true after flush command is completed
and setting last_was_sync to false after write command is completed,
set last_was_sync to true after flush command is issued and set
last_was_sync to false after write command is issued.

Signed-off-by: Celestine Chen celestinechen@google.com
7 weeks agofio: ioengine flag cleanup
Vincent Fu [Wed, 17 Apr 2024 17:51:30 +0000 (17:51 +0000)]
fio: ioengine flag cleanup

Convert how we define ioengine flags to use the same construction used
for thread flags. This allows us to count the number of ioengine flags
and write an assertion to ensure that thread flags and ioengine flags
fit inside td->flags.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agofio: remove compile time assertion
Vincent Fu [Wed, 17 Apr 2024 17:45:05 +0000 (17:45 +0000)]
fio: remove compile time assertion

TD_NR is the number of fio run states. It's not related to the number of
bits we need to shift ioengine flags in order to store them in
td->flags. Testing this assertion doesn't make sense.

Fixes: 9b87f09b ("fio: inherit IO engine flags to 'td'")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agofio: use thread flag count for ioengine flag shift
Vincent Fu [Wed, 17 Apr 2024 15:37:24 +0000 (15:37 +0000)]
fio: use thread flag count for ioengine flag shift

We store the thread and ioengine flags in the same unsigned long long
with the ioengine flags bit shifted by the number of thread flags. In
the macros related to the bit shift, just use the count of the number of
thread flags. This way any time we change the number of thread flags the
required shift will be automatically updated.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agotest: add test for readwrite issue
Chana-Zaks-wdc [Thu, 18 Apr 2024 09:22:23 +0000 (12:22 +0300)]
test: add test for readwrite issue

test the previous commit: Don’t break too early in readwrite mode

In rw mode if io_size > size An early reset of the addresses occurred.
Make sure all addresses are done correctly.

Signed-off-by: Chana-Zaks-wdc <chana.zaks@wdc.com>
Link: https://lore.kernel.org/r/20240418092222.20543-3-chana.zaks@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 weeks agoDon break too early in readwrite mode
Chana-Zaks-wdc [Thu, 18 Apr 2024 09:22:22 +0000 (12:22 +0300)]
Don break too early in readwrite mode

In readwrite mode, when io-size > size, we break too early and start
looping the addresses too soon. Instead of reset the address when
reaching size, we start looping after size/2, e.g. in a 50/50 rw. This
wrong behavior is demonstrated in the example below.

Before the fix:
size is 0x140000, io-size is 0x280000, max-address = 0xa0000 = size / 2.

./fio --debug=io --name=global --filename=/dev/mmcblk0p3 --size=1280K
--io_size=2560k --bs=128K --offset=0   --name=test1 --rw=rw| grep "complete: io_u"

io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x0,     len=0x20000, ddir=1, file=/dev/mmcblk0p3
Io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 5646 complete: io_u 0x560337a20840: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3

After the fix max-address = 0x120000 = size – len:

io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x40000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x60000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x80000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x40000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x60000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xa0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x80000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xc0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xa0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xe0000, len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x100000,len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x120000,len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xc0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0xe0000, len=0x20000, ddir=1, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x0,     len=0x20000, ddir=0, file=/dev/mmcblk0p3
io 32594 complete: io_u 0x70fc000980: off=0x20000, len=0x20000, ddir=0, file=/dev/mmcblk0p3

Fixes: ac002339c382 (Fix bug with rw sequence offset and io_limit)
Signed-off-by: Chana-Zaks-wdc <chana.zaks@wdc.com>
Link: https://lore.kernel.org/r/20240418092222.20543-2-chana.zaks@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 weeks agot/io_uring: only calculate per-file depth if we have files
Jens Axboe [Wed, 17 Apr 2024 22:33:28 +0000 (16:33 -0600)]
t/io_uring: only calculate per-file depth if we have files

If NOPs are used, then no files exist, and hence the app will throw
a floating point error when trying to divide by zero.

Fixes: 6067863c7016 ("t/io_uring: pre-calculate per-file depth")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
7 weeks agogithub: add reminders to PR template
Vincent Fu [Wed, 17 Apr 2024 19:28:31 +0000 (15:28 -0400)]
github: add reminders to PR template

Remind contributors to bump the server version and ioengine ops version
when appropriate.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
7 weeks agoMerge branch 'ioops_ver' of https://github.com/ankit-sam/fio
Jens Axboe [Wed, 17 Apr 2024 16:04:10 +0000 (10:04 -0600)]
Merge branch 'ioops_ver' of https://github.com/ankit-sam/fio

* 'ioops_ver' of https://github.com/ankit-sam/fio:
  ioengines: bump up FIO_IOOPS_VERSION

7 weeks agoioengines: bump up FIO_IOOPS_VERSION
Ankit Kumar [Wed, 17 Apr 2024 23:44:33 +0000 (05:14 +0530)]
ioengines: bump up FIO_IOOPS_VERSION

This was left out when multi range trim support was added.
Fixes: commit b3251e31 (trim: add support for multiple ranges)

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
7 weeks agoMerge branch 'directory-operation' of https://github.com/friendy-su/fio
Vincent Fu [Tue, 16 Apr 2024 15:04:58 +0000 (11:04 -0400)]
Merge branch 'directory-operation' of https://github.com/friendy-su/fio

* 'directory-operation' of https://github.com/friendy-su/fio:
  engines/fileoperations: add more description for file/directory operation engines

7 weeks agoRevert "ioengines: Make td_io_queue print log_err when got error "
Jens Axboe [Mon, 15 Apr 2024 18:26:56 +0000 (12:26 -0600)]
Revert "ioengines: Make td_io_queue print log_err when got error "

We should not be making these error prints, they are purely
information, and in fact they should probably get deleted all
together.

For now, as this is actually breaking test frameworks, just revert
the change.

This reverts commit 3c826d1cafe6c703237378314bdcd123770971e3.

https://lore.kernel.org/fstests/20240415182231.GA2649469@mit.edu/
Reported-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
8 weeks agoengines/fileoperations: add more description for file/directory operation engines
friendy-su [Mon, 8 Apr 2024 09:22:47 +0000 (17:22 +0800)]
engines/fileoperations: add more description for file/directory operation engines

file/directory operations are quite different from I/O operation.
Add more description for how to configure the measurement
and how to utilize the data.

Signed-off-by: friendy-su <friendy.su@sony.com>
2 months agohowto: fix zonemode formatting
Vincent Fu [Tue, 2 Apr 2024 15:10:58 +0000 (11:10 -0400)]
howto: fix zonemode formatting

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoFio 3.37 fio-3.37
Jens Axboe [Tue, 26 Mar 2024 21:13:51 +0000 (15:13 -0600)]
Fio 3.37

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoMerge branch 'delete-instead-of-unlink' of https://github.com/edigaryev/fio
Jens Axboe [Mon, 25 Mar 2024 16:45:13 +0000 (10:45 -0600)]
Merge branch 'delete-instead-of-unlink' of https://github.com/edigaryev/fio

* 'delete-instead-of-unlink' of https://github.com/edigaryev/fio:
  docs: use "delete" term instead of "unlink", which is less common

2 months agodocs: use "delete" term instead of "unlink", which is less common
Nikolay Edigaryev [Mon, 25 Mar 2024 09:42:57 +0000 (13:42 +0400)]
docs: use "delete" term instead of "unlink", which is less common

Signed-off-by: Nikolay Edigaryev <edigaryev@gmail.com>
2 months agoMerge branch 'issue-1735' of https://github.com/yygcode/fio
Vincent Fu [Fri, 22 Mar 2024 14:39:37 +0000 (10:39 -0400)]
Merge branch 'issue-1735' of https://github.com/yygcode/fio

* 'issue-1735' of https://github.com/yygcode/fio:
  iolog: fix disk stats issue

2 months agoiolog: fix disk stats issue
yonggang.yyg [Wed, 20 Mar 2024 16:10:03 +0000 (00:10 +0800)]
iolog: fix disk stats issue

In the iolog replay scenario, the disk util in the td structure is
not initialized, resulting in the disk stats not being correctly
updated.

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

Signed-off-by: Yong Gang <yygcode@gmail.com>
2 months agoexamples: fiograph plots for dir operation ioengines
Vincent Fu [Fri, 22 Mar 2024 14:30:43 +0000 (10:30 -0400)]
examples: fiograph plots for dir operation ioengines

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoengines/fileoperations: use local var for ioengine data
Vincent Fu [Fri, 22 Mar 2024 14:21:56 +0000 (10:21 -0400)]
engines/fileoperations: use local var for ioengine data

Improve code readability by using a local variable for ioengine data.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoengines/fileoperations: remove extra blank lines
Vincent Fu [Fri, 22 Mar 2024 14:16:30 +0000 (10:16 -0400)]
engines/fileoperations: remove extra blank lines

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agoioengines: implement dircreate, dirstat, dirdelete engines to fileoperations.c
friendy-su [Wed, 10 Jan 2024 09:20:36 +0000 (17:20 +0800)]
ioengines: implement dircreate, dirstat, dirdelete engines to fileoperations.c

Similar to file operation, directory operation performance is an
important benchmark to file system in practice.

* dircreate engine measures directories create performance
* dirstat engine measures directories lookup performance
* dirdelete engine measures directories delete performance

Signed-off-by: friendy-su <friendy.su@sony.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agot/run-fio-tests: restrict t0031 to Linux only
Vincent Fu [Thu, 21 Mar 2024 12:36:14 +0000 (08:36 -0400)]
t/run-fio-tests: restrict t0031 to Linux only

This test uses libaio. So run it only on Linux when libaio is available.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agotest: add the test for regrow logs with asynchronous I/O replay
Shin'ichiro Kawasaki [Thu, 21 Mar 2024 03:10:11 +0000 (12:10 +0900)]
test: add the test for regrow logs with asynchronous I/O replay

Add t/jobs/t0031-pre.fio and t/jobs/t0031.fio to test that the log
space is regrown for the asynchronous I/O replay jobs. This test case
confirms the fix by the previous commit titled "iolog: regrow logs in
iolog_delay()".

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240321031011.4140040-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agoiolog: regrow logs in iolog_delay()
Shin'ichiro Kawasaki [Thu, 21 Mar 2024 03:10:10 +0000 (12:10 +0900)]
iolog: regrow logs in iolog_delay()

The commit b85c01f7e9df ("iolog.c: fix inaccurate clat when replay
trace") triggered the assertion failure below for the workload which
does I/O replay as asynchronous I/O together with log recording options
such as write_lat_log.

  fio: stat.c:3030: get_cur_log: Assertion `iolog->pending->nr_samples < iolog->pending->max_samples' failed.
  fio: pid=40120, got signal=6

The assertion means that too many logs are recorded in the pending log
space which keeps the logs until next log space regrow by reglow_logs()
call. However, reglow_logs() is not called, and the pending log space
runs out.

The trigger commit modified iolog_delay() to call io_u_queued_complete()
so that the asynchronous I/Os can be completed during delays between
replayed I/Os. Before this commit, replayed I/Os were not completed
until all I/O units are consumed. So the free I/O unit list gets empty
periodically, then wait_for_completion() and regrow_logs() were called
periodically. After this commit, all I/O units are not consumed, so
wait_for_completion() and regrow_logs() are no longer called for long
duration. Hence the assertion failure.

To avoid the assertion, add the check for log regrow and reglow_logs()
call in iolog_delay().

Fixes: b85c01f7e9df ("iolog.c: fix inaccurate clat when replay trace")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240321031011.4140040-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 months agot/jobs/t0030: add test for --bandwidth-log option
Vincent Fu [Wed, 20 Mar 2024 18:08:46 +0000 (14:08 -0400)]
t/jobs/t0030: add test for --bandwidth-log option

Add a test to detect changes that break the --bandwidth-log option. This
option uses the logging data structures in a way that differs from how
the other logs use them. So it's easy to forget about this special case.

Recent patches resolving related breakage are:
d72244761b2230fbb2d6eaec59cdedd3ea651d4f ("stat: fix segfault with fio
option --bandwidth-log")
acc481b6d34aab3ee6e19f22b64f8bf0dd30480c ("iolog: fix reported defect
from coverity scan")

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agot/fiotestlib: pass command-line options to FioJobFileTest
Vincent Fu [Wed, 20 Mar 2024 18:24:26 +0000 (14:24 -0400)]
t/fiotestlib: pass command-line options to FioJobFileTest

Add a means to specify arbitrary command-line options when we are
running a test that consists of a fio job file.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
2 months agodocs: fix documentation for rate_cycle
Vincent Fu [Mon, 18 Mar 2024 18:51:10 +0000 (14:51 -0400)]
docs: fix documentation for rate_cycle

rate_cycle affects only rate_min and rate_iops_min.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/nvmept_pi: add support for xNVMe ioengine
Vincent Fu [Thu, 7 Mar 2024 18:55:22 +0000 (18:55 +0000)]
t/nvmept_pi: add support for xNVMe ioengine

Add a command-line option to run this script using the xNVMe ioengine
with the async io_uring_cmd backend. The default remains to use the
io_uring_cmd ioengine.

Example:

python3 t/nvmept_pi.py --dut /dev/ng1n1 --lbaf 6 --ioengine xnvme --fio ./fio

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/nvmept_pi: drop JSON output for error cases
Vincent Fu [Thu, 7 Mar 2024 19:25:16 +0000 (19:25 +0000)]
t/nvmept_pi: drop JSON output for error cases

Avoid errors decoding JSON data when testing invalid configurations.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoexamples: add fiograph plots for netio_vsock examples
Vincent Fu [Thu, 7 Mar 2024 18:32:04 +0000 (13:32 -0500)]
examples: add fiograph plots for netio_vsock examples

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoexamples: add fiograph plot for uring-cmd-trim-multi-range
Vincent Fu [Thu, 7 Mar 2024 18:28:40 +0000 (13:28 -0500)]
examples: add fiograph plot for uring-cmd-trim-multi-range

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoexamples: add plots for xNVMe examples
Vincent Fu [Thu, 7 Mar 2024 18:27:11 +0000 (13:27 -0500)]
examples: add plots for xNVMe examples

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoexamples: update plot for cmdprio-bssplit
Vincent Fu [Thu, 7 Mar 2024 17:55:31 +0000 (12:55 -0500)]
examples: update plot for cmdprio-bssplit

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoDoc: Make note of using bsrange with ':'
Avri Altman [Tue, 5 Mar 2024 09:00:08 +0000 (11:00 +0200)]
Doc: Make note of using bsrange with ':'

Which is also a supported form of delimiter.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-6-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/jobs: Fix a typo in jobs 23 & 24
Avri Altman [Tue, 5 Mar 2024 09:00:07 +0000 (11:00 +0200)]
t/jobs: Fix a typo in jobs 23 & 24

s/bsrange/bssplit

Fixes: commit c37183f8a161 (test: test job for randtrimwrite)
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-5-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/jobs: Rename test job 15
Avri Altman [Tue, 5 Mar 2024 09:00:06 +0000 (11:00 +0200)]
t/jobs: Rename test job 15

Make it designate the correct fixing commit.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-4-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/jobs: Further clarify regression test 7
Avri Altman [Tue, 5 Mar 2024 09:00:05 +0000 (11:00 +0200)]
t/jobs: Further clarify regression test 7

Add some more details explaining why the the successful result should be
87,040KB data.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-3-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agofio: Some minor code cleanups
Avri Altman [Tue, 5 Mar 2024 09:00:04 +0000 (11:00 +0200)]
fio: Some minor code cleanups

limit the scope of variables when possible, fix style isses etc.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20240305090008.1216-2-avri.altman@wdc.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoMerge branch 'patch-ioengines' of https://github.com/kcoms555/fio
Jens Axboe [Mon, 4 Mar 2024 14:31:47 +0000 (07:31 -0700)]
Merge branch 'patch-ioengines' of https://github.com/kcoms555/fio

* 'patch-ioengines' of https://github.com/kcoms555/fio:
  ioengines: Make td_io_queue print log_err when got error

3 months agoioengines: Make td_io_queue print log_err when got error
Jaeho [Mon, 4 Mar 2024 10:27:53 +0000 (19:27 +0900)]
ioengines: Make td_io_queue print log_err when got error

* ioengines prints error log when got I/O error

Signed-off-by: Cho Jaeho <kcoms555@naver.com>
3 months agogettime: fix cpuclock-test on AMD platforms
Vincent Fu [Tue, 27 Feb 2024 15:26:00 +0000 (10:26 -0500)]
gettime: fix cpuclock-test on AMD platforms

Starting with gcc 11 __sync_synchronize() compiles to

lock or QWORD PTR [rsp], 0

on x86_64 platforms. Previously it compiled to an mfence instruction.

See line 47 of https://godbolt.org/z/xfE18K7b4 for an example.

On Intel platforms this change does not affect the result of fio's CPU
clock test. But on AMD platforms, this change causes fio's CPU clock
test to fail and fio to fall back to clock_gettime() instead of using
the CPU clock for timing.

This patch has fio explicitly use an mfence instruction instead of
__sync_synchornize() in the CPU clock test code on x86_64 platforms in
order to allow the CPU clock test to pass on AMD platforms.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240227155856.5012-1-vincent.fu@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agohowto: fix job_start_clock_id formatting
Vincent Fu [Tue, 27 Feb 2024 16:03:59 +0000 (11:03 -0500)]
howto: fix job_start_clock_id formatting

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoci: fix macOS sphinx install issues
Vincent Fu [Thu, 22 Feb 2024 14:31:50 +0000 (09:31 -0500)]
ci: fix macOS sphinx install issues

We have had a lot of failures installing sphinx on macOS. The latest
failure suggested using pip instead of homebrew to install sphinx. So
let's try that.

https://github.com/axboe/fio/actions/runs/8004639029/job/21863677360?pr=1727

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoMerge branch 'fix-tests-cfi' of https://github.com/mikoxyz/fio
Jens Axboe [Thu, 22 Feb 2024 17:11:26 +0000 (10:11 -0700)]
Merge branch 'fix-tests-cfi' of https://github.com/mikoxyz/fio

* 'fix-tests-cfi' of https://github.com/mikoxyz/fio:
  options: declare *__val as long long
  t/io_uring: use char * for name arg in detect_node
  t/io_uring: include libgen.h

3 months agooptions: declare *__val as long long
Miko Larsson [Thu, 22 Feb 2024 12:02:23 +0000 (13:02 +0100)]
options: declare *__val as long long

Fixes CFI as the function signatures will now match with parse.h

Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
3 months agot/io_uring: use char * for name arg in detect_node
Miko Larsson [Thu, 22 Feb 2024 12:11:27 +0000 (13:11 +0100)]
t/io_uring: use char * for name arg in detect_node

Fixes the following compiler warning:
warning: passing 'const char *' to parameter of type 'char *' discards
qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
3 months agot/io_uring: include libgen.h
Miko Larsson [Thu, 22 Feb 2024 11:44:54 +0000 (12:44 +0100)]
t/io_uring: include libgen.h

This fixes the build with musl + clang >=15; musl doesn't declare
basename() anywhere else, and clang >=15 doesn't allow implicit
declarations.

Fixes: 4b9e13dc27fb (t/io_uring: support NUMA placement)
Signed-off-by: Miko Larsson <mikoxyzzz@gmail.com>
3 months agoverify: fix integer sizes in verify state file
Vincent Fu [Fri, 16 Feb 2024 01:33:21 +0000 (01:33 +0000)]
verify: fix integer sizes in verify state file

nofiles and depth are 32-bit integers. So we shouldn't use 64-bit
conversion functions and casts. The current code actually works fine on
little-endian platforms since the conversion is a noop but this is
broken on big-endian platforms.

Fixes: 94a6e1bb ("Fix verify state for multiple files")
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/run-fio-tests: add t/nvmept_trim.py
Vincent Fu [Fri, 15 Dec 2023 15:52:27 +0000 (15:52 +0000)]
t/run-fio-tests: add t/nvmept_trim.py

Add the pass-through multi-range trim tests to the automated test suite.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agot/nvmept_trim.py: test multi-range trim
Vincent Fu [Tue, 12 Dec 2023 18:42:20 +0000 (18:42 +0000)]
t/nvmept_trim.py: test multi-range trim

This test script contains some regression tests for existing
functionality and also some tests for the new feature.

The multi-range trim tests basically count the number of requests
submitted and make sure that they are consistent with the block sizes
and number of ranges per request.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoio_u: move number_trim to reclaim 8 bytes in struct io_u
Jens Axboe [Thu, 15 Feb 2024 15:39:49 +0000 (08:39 -0700)]
io_u: move number_trim to reclaim 8 bytes in struct io_u

Move it under clat_prio_index, which already has a 6 byte gap. This
saves 8 bytes total in struct io_u, which is always nice.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoengines/io_uring: add multi range dsm support
Ankit Kumar [Thu, 15 Feb 2024 15:18:12 +0000 (20:48 +0530)]
engines/io_uring: add multi range dsm support

Update the io_uring_cmd ioengine to support multiple ranges for trim.
This includes allocating buffer for multiple ranges, and changes to
the nvme trim helper functions.
Add an example on how to use multi range trim.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240215151812.138370-4-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoengines/nvme: pass offset and len instead of io_u
Ankit Kumar [Thu, 15 Feb 2024 15:18:11 +0000 (20:48 +0530)]
engines/nvme: pass offset and len instead of io_u

Remove io_u dependency while calculating start and number of lba.
This is a prep patch for multi-range trim support where an io_u entry
will contain multiple start offset and buffer len.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240215151812.138370-3-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agotrim: add support for multiple ranges
Ankit Kumar [Thu, 15 Feb 2024 15:18:10 +0000 (20:48 +0530)]
trim: add support for multiple ranges

NVMe specification allow multiple ranges for the dataset management
commands. Currently the block ioctl only allows a single range for
trim, however multiple ranges can be specified using nvme character
device.

Add an option num_range to send multiple range per trim request, which
only works if the data direction is solely trim i.e. trim or randtrim.
Add FIO_MULTI_RANGE_TRIM as the ioengine flag, to restrict the usage of
this new option.
For multi range trim request this modifies the way IO buffers are used.
The buffer length will depend on number of trim ranges and the actual
buffer will contains start and length of each range entry.

This increases fio server version (FIO_SERVER_VER) to 103.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20240215151812.138370-2-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agot/io_uring: pre-calculate per-file depth
Jens Axboe [Thu, 15 Feb 2024 15:17:31 +0000 (08:17 -0700)]
t/io_uring: pre-calculate per-file depth

Rather than do this math every time, just calculate it at setup time
and use that.

Note that there's something wonky with how the depths are distributed,
it's quite common to see the first file eat the majority of the queue
depth, causing multiple file runs to be both slower than they should be,
and with very unevenly distributed depths. To be investigated.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agot/io_uring: account and ignore IO errors
Jens Axboe [Thu, 15 Feb 2024 15:16:55 +0000 (08:16 -0700)]
t/io_uring: account and ignore IO errors

It's still useful to test on devices that may trigger a single or
few IO errors, just log them and ignore them in the IOPS calculations.
And for stats calculations.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agotest: add the test for loops option and read-verify workloads
Shin'ichiro Kawasaki [Wed, 14 Feb 2024 12:20:08 +0000 (21:20 +0900)]
test: add the test for loops option and read-verify workloads

Add t/jobs/t0029.fio to test that the loops option works together with
read-verify workloads.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240214122008.4123286-3-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoverify: fix loops option behavior of read-verify workloads
Shin'ichiro Kawasaki [Wed, 14 Feb 2024 12:20:07 +0000 (21:20 +0900)]
verify: fix loops option behavior of read-verify workloads

The commit 191d6634e8a6 ("verify: fix bytes_done accounting of
experimental verify") introduced td->bytes_verified to separate the
verified bytes from the read bytes in td->bytes_done[]. This fixed the
issue of experimental verify feature. However, it caused another issue.
When the verify workload does only read and does not do write, the read
bytes in td->bytes_done[] is no longer updated and always zero. This
zero value is returned from do_io() to thread_main() in the bytes_done
array. If the read bytes is zero, thread_main() marks the job to
terminate and it makes the loops option ignored. For example, the job
below should do 8k read, but it does only 4k read.

[global]
filename=/tmp/fio.test
size=4k
verify=md5

[write]
rw=write
do_verify=0

[read]
stonewall=1
rw=read
loops=2
do_verify=1

To make the loops option work together with the read-verify workloads,
modify io_u_update_bytes_done(). After updating td->bytes_verified,
check if the workload does not write. If so, do not return from
io_u_update_bytes_done() and update td->bytes_done[] for DDIR_READ in
the following code.

Fixes: 191d6634e8a6 ("verify: fix bytes_done accounting of experimental verify")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20240214122008.4123286-2-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 months agoexamples: add PI example with xnvme ioengine
Ankit Kumar [Tue, 13 Feb 2024 15:33:15 +0000 (21:03 +0530)]
examples: add PI example with xnvme ioengine

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-6-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoengines/xnvme: add checks for verify, block size and metadata size
Ankit Kumar [Tue, 13 Feb 2024 15:33:14 +0000 (21:03 +0530)]
engines/xnvme: add checks for verify, block size and metadata size

Add checks to ensure that the correct block size and metadata size is
passed by the user.
Disable normal verify checks when end to end data protection checks
are enabled because of CRC conflict.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-5-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
3 months agoengines:xnvme: add support for end to end data protection
Ankit Kumar [Tue, 13 Feb 2024 15:33:13 +0000 (21:03 +0530)]
engines:xnvme: add support for end to end data protection

This patch enables support for protection information to xnvme
ioengine.

This adds 4 new ioengine specific options
 * pi_act - Protection information action. Default: 1
 * pi_chk - Can be set to GUARD, APPTAG or REFTAG
 * apptag - Sets apptag field of command dword 15
 * apptag_mask - Sets apptag_mask field of command dword 15

For the sake of consistency these options are the same as the ones used
by io_uring_cmd ioengine and SPDK's external ioengine.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-4-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>