Skip to content

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

Open
Krien wants to merge 2 commits into
axboe:masterfrom
Krien:master
Open

io_uring: Add support for 'zone_append' when using uring_cmd and zonemode ZBD#2103
Krien wants to merge 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.

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>
@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 Outdated
FIO_URING_CMD_WMODE_ZONE_APPEND,
};

#define WMODE_SPLIT_MAX 4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be increased by one.
Better yet, set FIO_URING_CMD_WMODE_WRITE = 0, add FIO_URING_CMD_WMODE_LAST at the end of the enum, and #define WMODE_SPLIT_MAX FIO_URING_CMD_WMODE_LAST so that this value is automatically updated.
Fio does something similar with enum fio_ddir.

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>
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.

3 participants