Skip to content

Commit 047bc9f

Browse files
committed
Revert "io_uring: Support Compare command for verification"
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]>
1 parent 46559ad commit 047bc9f

File tree

6 files changed

+4
-68
lines changed

6 files changed

+4
-68
lines changed

engines/io_uring.c

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ enum uring_cmd_write_mode {
4141
FIO_URING_CMD_WMODE_VERIFY,
4242
};
4343

44-
enum uring_cmd_verify_mode {
45-
FIO_URING_CMD_VMODE_READ = 1,
46-
FIO_URING_CMD_VMODE_COMPARE,
47-
};
48-
4944
struct io_sq_ring {
5045
unsigned *head;
5146
unsigned *tail;
@@ -106,7 +101,6 @@ struct ioring_options {
106101
unsigned int writefua;
107102
unsigned int deac;
108103
unsigned int write_mode;
109-
unsigned int verify_mode;
110104
struct cmdprio_options cmdprio_options;
111105
unsigned int fixedbufs;
112106
unsigned int registerfiles;
@@ -202,26 +196,6 @@ static struct fio_option options[] = {
202196
.category = FIO_OPT_C_ENGINE,
203197
.group = FIO_OPT_G_IOURING,
204198
},
205-
{
206-
.name = "verify_mode",
207-
.lname = "Do verify based on the configured command (e.g., Read or Compare command)",
208-
.type = FIO_OPT_STR,
209-
.off1 = offsetof(struct ioring_options, verify_mode),
210-
.help = "Issue Read or Compare command in the verification phase",
211-
.def = "read",
212-
.posval = {
213-
{ .ival = "read",
214-
.oval = FIO_URING_CMD_VMODE_READ,
215-
.help = "Issue Read commands in the verification phase"
216-
},
217-
{ .ival = "compare",
218-
.oval = FIO_URING_CMD_VMODE_COMPARE,
219-
.help = "Issue Compare commands in the verification phase"
220-
},
221-
},
222-
.category = FIO_OPT_C_ENGINE,
223-
.group = FIO_OPT_G_IOURING,
224-
},
225199
{
226200
.name = "fixedbufs",
227201
.lname = "Fixed (pre-mapped) IO buffers",
@@ -495,7 +469,6 @@ static int fio_ioring_cmd_prep(struct thread_data *td, struct io_u *io_u)
495469
struct nvme_dsm *dsm;
496470
void *ptr = ld->dsm;
497471
unsigned int dsm_size;
498-
uint8_t read_opcode = nvme_cmd_read;
499472

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

539-
/*
540-
* If READ command belongs to the verification phase and the
541-
* verify_mode=compare, convert READ to COMPARE command.
542-
*/
543-
if (io_u->flags & IO_U_F_VER_LIST && io_u->ddir == DDIR_READ &&
544-
o->verify_mode == FIO_URING_CMD_VMODE_COMPARE) {
545-
populate_verify_io_u(td, io_u);
546-
read_opcode = nvme_cmd_compare;
547-
io_u_set(td, io_u, IO_U_F_VER_IN_DEV);
548-
}
549-
550512
return fio_nvme_uring_cmd_prep(cmd, io_u,
551513
o->nonvectored ? NULL : &ld->iovecs[io_u->index],
552-
dsm, read_opcode, ld->write_opcode,
553-
ld->cdw12_flags[io_u->ddir]);
514+
dsm, ld->write_opcode, ld->cdw12_flags[io_u->ddir]);
554515
}
555516

556517
static struct io_u *fio_ioring_event(struct thread_data *td, int event)

engines/nvme.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,7 @@ void fio_nvme_uring_cmd_trim_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
363363

364364
int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
365365
struct iovec *iov, struct nvme_dsm *dsm,
366-
uint8_t read_opcode, uint8_t write_opcode,
367-
unsigned int cdw12_flags)
366+
uint8_t write_opcode, unsigned int cdw12_flags)
368367
{
369368
struct nvme_data *data = FILE_ENG_DATA(io_u->file);
370369
__u64 slba;
@@ -374,7 +373,7 @@ int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
374373

375374
switch (io_u->ddir) {
376375
case DDIR_READ:
377-
cmd->opcode = read_opcode;
376+
cmd->opcode = nvme_cmd_read;
378377
break;
379378
case DDIR_WRITE:
380379
cmd->opcode = write_opcode;

engines/nvme.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ enum nvme_io_opcode {
7777
nvme_cmd_write = 0x01,
7878
nvme_cmd_read = 0x02,
7979
nvme_cmd_write_uncor = 0x04,
80-
nvme_cmd_compare = 0x05,
8180
nvme_cmd_write_zeroes = 0x08,
8281
nvme_cmd_dsm = 0x09,
8382
nvme_cmd_verify = 0x0c,
@@ -432,8 +431,7 @@ int fio_nvme_get_info(struct fio_file *f, __u64 *nlba, __u32 pi_act,
432431

433432
int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,
434433
struct iovec *iov, struct nvme_dsm *dsm,
435-
uint8_t read_opcode, uint8_t write_opcode,
436-
unsigned int cdw12_flags);
434+
uint8_t write_opcode, unsigned int cdw12_flags);
437435

438436
void fio_nvme_pi_fill(struct nvme_uring_cmd *cmd, struct io_u *io_u,
439437
struct nvme_cmd_ext_io_opts *opts);

fio.1

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,20 +2677,6 @@ Use Verify commands for write operations
26772677
.RE
26782678
.RE
26792679
.TP
2680-
.BI (io_uring_cmd)verify_mode \fR=\fPstr
2681-
Specifies the type of command to be used in the verification phase. Defaults to 'read'.
2682-
.RS
2683-
.RS
2684-
.TP
2685-
.B read
2686-
Use Read commands for data verification
2687-
.TP
2688-
.B compare
2689-
Use Compare commands for data verification
2690-
.TP
2691-
.RE
2692-
.RE
2693-
.TP
26942680
.BI (sg)sg_write_mode \fR=\fPstr
26952681
Specify the type of write commands to issue. This option can take multiple
26962682
values:

io_u.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ enum {
2323
IO_U_F_VER_LIST = 1 << 7,
2424
IO_U_F_PATTERN_DONE = 1 << 8,
2525
IO_U_F_DEVICE_ERROR = 1 << 9,
26-
IO_U_F_VER_IN_DEV = 1 << 10, /* Verify data in device */
2726
};
2827

2928
/*

verify.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -901,13 +901,6 @@ int verify_io_u(struct thread_data *td, struct io_u **io_u_ptr)
901901
if (td_ioengine_flagged(td, FIO_FAKEIO))
902902
return 0;
903903

904-
/*
905-
* If data has already been verified from the device, we can skip
906-
* the actual verification phase here.
907-
*/
908-
if (io_u->flags & IO_U_F_VER_IN_DEV)
909-
return 0;
910-
911904
if (io_u->flags & IO_U_F_TRIMMED) {
912905
ret = verify_trimmed_io_u(td, io_u);
913906
goto done;

0 commit comments

Comments
 (0)