Skip to content

io_uring: Add support for 'zone_append' when using uring_cmd and zonemode ZBD - #2103

Merged
axboe merged 2 commits into
axboe:masterfrom
Krien:master
Jun 25, 2026
Merged

axboe merged 2 commits into
axboe:masterfrom
Krien:master

Conversation

@Krien

@Krien Krien commented Jun 4, 2026

Copy link
Copy Markdown

This pull request adds support for zone appends for NVMe ZNS devices. Zone appends enable an iodepth larger than 1 for writes within zones. It only supports uring_cmd as appends can not yet be used in the standard write path (see #1026) and appends can only be enabled when the zonemode is explicitly set to ZBD.

The request introduces the following changes:

  1. Add fio_ioring_cmd_finish_zone as a new zone finish command for uring_cmd.
  2. Set the finish command in uring_cmd to fio_ioring_cmd_finish_zone instead of the default finish through blkzone. This is needed because appends at iodepth>1 can lead to finish commands, which will fail on the character device.
  3. Add a new write_mode for zone_append. The offset needs to be set to the zone start when appends are used.

@Krien
Krien force-pushed the master branch 2 times, most recently from 58ae1f5 to 0151b74 Compare June 15, 2026 18:37
@vincentkfu

Copy link
Copy Markdown
Collaborator

@damien-lemoal @kawasaki Do you have any feedback on this?

@damien-lemoal damien-lemoal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me, except for one nit.

Comment thread engines/nvme.c Outdated
/* Zone appends must be issued to the start of the target zone */
if (cmd->opcode == nvme_zns_cmd_append && io_u->file->zbd_info) {
zone_size = io_u->file->zbd_info->zone_size;
offset = (io_u->offset / zone_size) * zone_size;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset = io_u->offset & (~(zone_size - 1));

Because the zone size is always a power of 2. So let's avoid the expensive divisions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread engines/nvme.c

/* If the file is not yet opened, open it for this function. */
fd = f->fd;
if (fd < 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can that happen ? The file should already be open since IOs are on-going. No ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it should not happen. I followed the same if statement used in blkzoned_finish_zone to ensure consistent behavior. If this is not desirable, I will remove the if.

@damien-lemoal

Copy link
Copy Markdown
Contributor

Note: patches on the mailing list would be a lot easier to review/comment. The github GUI is really horrendous for reviews :(

Comment thread engines/io_uring.c Resolved
@Krien
Krien force-pushed the master branch 2 times, most recently from 5a20d34 to 29f4a26 Compare June 24, 2026 08:32
Krijn Doekemeijer added 2 commits June 25, 2026 08:12
When using uring_cmd use fio_ioring_cmd_finish_zone instead of the
finish command from blkzone, which is supposed to be used with block
devices.

Signed-off-by: Krijn Doekemeijer <krijn.doekemeijer@wdc.com>
Add a new write mode 'zone_append' for io_uring_cmd that uses zone_appends instead of
writes when ZBD is enabled. Zone appends are issued to the start of
zones.

Signed-off-by: Krijn Doekemeijer <krijn.doekemeijer@wdc.com>
@Krien
Krien requested a review from vincentkfu June 25, 2026 11:32
@axboe
axboe merged commit 360e4d6 into axboe:master Jun 25, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ 换网址