Skip to content

Commit

Permalink
Revert "io_uring: Support Compare command for verification"
Browse files Browse the repository at this point in the history
This reverts commit 6170d92.

This feature does not work.

The NVMe compare command directs the device to compare the contents of a
data buffer with the contents of the media. In verify mode fio prepares
read requests and does not fill the data buffer with any specific
contents. Using this feature results in compare errors.

root@localhost:~/fio-dev/fio-canonical# ./fio --name=test --rw=write --verify=crc32c --ioengine=io_uring_cmd --filename=/dev/ng0n1 --verify_mode=compare
test: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=io_uring_cmd, iodepth=1
fio-3.38-30-g46559
Starting 1 process
fio: io_u error on file /dev/ng0n1: Device-specific error: read offset=0, buflen=4096
fio: io_uring_cmd: /dev/ng0n1: cq entry status (sct=0x02; sc=0x85)
fio: pid=711175, err=17029/file:io_u.c:1976, func=io_u error, error=Unknown error 17029

test: (groupid=0, jobs=1): err=17029 (file:io_u.c:1976, func=io_u error, error=Unknown error 17029): pid=711175: Tue Jan 28 14:46:45 2025

Status code descriptions:
0x02: Media and data integrity,
0x85: Compare Failure: See the NVM Command Set Specification for the
description

Signed-off-by: Vincent Fu <[email protected]>
  • Loading branch information
vincentkfu committed Jan 28, 2025
1 parent 46559ad commit 047bc9f
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 68 deletions.
41 changes: 1 addition & 40 deletions engines/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ enum uring_cmd_write_mode {
FIO_URING_CMD_WMODE_VERIFY,
};

enum uring_cmd_verify_mode {
FIO_URING_CMD_VMODE_READ = 1,
FIO_URING_CMD_VMODE_COMPARE,
};

struct io_sq_ring {
unsigned *head;
unsigned *tail;
Expand Down Expand Up @@ -106,7 +101,6 @@ struct ioring_options {
unsigned int writefua;
unsigned int deac;
unsigned int write_mode;
unsigned int verify_mode;
struct cmdprio_options cmdprio_options;
unsigned int fixedbufs;
unsigned int registerfiles;
Expand Down Expand Up @@ -202,26 +196,6 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_IOURING,
},
{
.name = "verify_mode",
.lname = "Do verify based on the configured command (e.g., Read or Compare command)",
.type = FIO_OPT_STR,
.off1 = offsetof(struct ioring_options, verify_mode),
.help = "Issue Read or Compare command in the verification phase",
.def = "read",
.posval = {
{ .ival = "read",
.oval = FIO_URING_CMD_VMODE_READ,
.help = "Issue Read commands in the verification phase"
},
{ .ival = "compare",
.oval = FIO_URING_CMD_VMODE_COMPARE,
.help = "Issue Compare commands in the verification phase"
},
},
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_IOURING,
},
{
.name = "fixedbufs",
.lname = "Fixed (pre-mapped) IO buffers",
Expand Down Expand Up @@ -495,7 +469,6 @@ static int fio_ioring_cmd_prep(struct thread_data *td, struct io_u *io_u)
struct nvme_dsm *dsm;
void *ptr = ld->dsm;
unsigned int dsm_size;
uint8_t read_opcode = nvme_cmd_read;

/* only supports nvme_uring_cmd */
if (o->cmd_type != FIO_URING_CMD_NVME)
Expand Down Expand Up @@ -536,21 +509,9 @@ static int fio_ioring_cmd_prep(struct thread_data *td, struct io_u *io_u)
ptr += io_u->index * dsm_size;
dsm = (struct nvme_dsm *)ptr;

/*
* If READ command belongs to the verification phase and the
* verify_mode=compare, convert READ to COMPARE command.
*/
if (io_u->flags & IO_U_F_VER_LIST && io_u->ddir == DDIR_READ &&
o->verify_mode == FIO_URING_CMD_VMODE_COMPARE) {
populate_verify_io_u(td, io_u);
read_opcode = nvme_cmd_compare;
io_u_set(td, io_u, IO_U_F_VER_IN_DEV);
}

return fio_nvme_uring_cmd_prep(cmd, io_u,
o->nonvectored ? NULL : &ld->iovecs[io_u->index],
dsm, read_opcode, ld->write_opcode,
ld->cdw12_flags[io_u->ddir]);
dsm, ld->write_opcode, ld->cdw12_flags[io_u->ddir]);
}

static struct io_u *fio_ioring_event(struct thread_data *td, int event)
Expand Down
5 changes: 2 additions & 3 deletions engines/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ void fio_nvme_uring_cmd_trim_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,

int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
struct iovec *iov, struct nvme_dsm *dsm,
uint8_t read_opcode, uint8_t write_opcode,
unsigned int cdw12_flags)
uint8_t write_opcode, unsigned int cdw12_flags)
{
struct nvme_data *data = FILE_ENG_DATA(io_u->file);
__u64 slba;
Expand All @@ -374,7 +373,7 @@ int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,

switch (io_u->ddir) {
case DDIR_READ:
cmd->opcode = read_opcode;
cmd->opcode = nvme_cmd_read;
break;
case DDIR_WRITE:
cmd->opcode = write_opcode;
Expand Down
4 changes: 1 addition & 3 deletions engines/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ enum nvme_io_opcode {
nvme_cmd_write = 0x01,
nvme_cmd_read = 0x02,
nvme_cmd_write_uncor = 0x04,
nvme_cmd_compare = 0x05,
nvme_cmd_write_zeroes = 0x08,
nvme_cmd_dsm = 0x09,
nvme_cmd_verify = 0x0c,
Expand Down Expand Up @@ -432,8 +431,7 @@ int fio_nvme_get_info(struct fio_file *f, __u64 *nlba, __u32 pi_act,

int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
struct iovec *iov, struct nvme_dsm *dsm,
uint8_t read_opcode, uint8_t write_opcode,
unsigned int cdw12_flags);
uint8_t write_opcode, unsigned int cdw12_flags);

void fio_nvme_pi_fill(struct nvme_uring_cmd *cmd, struct io_u *io_u,
struct nvme_cmd_ext_io_opts *opts);
Expand Down
14 changes: 0 additions & 14 deletions fio.1
Original file line number Diff line number Diff line change
Expand Up @@ -2677,20 +2677,6 @@ Use Verify commands for write operations
.RE
.RE
.TP
.BI (io_uring_cmd)verify_mode \fR=\fPstr
Specifies the type of command to be used in the verification phase. Defaults to 'read'.
.RS
.RS
.TP
.B read
Use Read commands for data verification
.TP
.B compare
Use Compare commands for data verification
.TP
.RE
.RE
.TP
.BI (sg)sg_write_mode \fR=\fPstr
Specify the type of write commands to issue. This option can take multiple
values:
Expand Down
1 change: 0 additions & 1 deletion io_u.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ enum {
IO_U_F_VER_LIST = 1 << 7,
IO_U_F_PATTERN_DONE = 1 << 8,
IO_U_F_DEVICE_ERROR = 1 << 9,
IO_U_F_VER_IN_DEV = 1 << 10, /* Verify data in device */
};

/*
Expand Down
7 changes: 0 additions & 7 deletions verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,13 +901,6 @@ int verify_io_u(struct thread_data *td, struct io_u **io_u_ptr)
if (td_ioengine_flagged(td, FIO_FAKEIO))
return 0;

/*
* If data has already been verified from the device, we can skip
* the actual verification phase here.
*/
if (io_u->flags & IO_U_F_VER_IN_DEV)
return 0;

if (io_u->flags & IO_U_F_TRIMMED) {
ret = verify_trimmed_io_u(td, io_u);
goto done;
Expand Down

0 comments on commit 047bc9f

Please sign in to comment.