From 78831c6b35c53f844748e79711b99218fb58f928 Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Wed, 15 May 2024 14:36:40 +0900 Subject: [PATCH 1/2] 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 --- engines/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/io_uring.c b/engines/io_uring.c index 9069fa3e81..56bef9a00a 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -476,7 +476,7 @@ static struct io_u *fio_ioring_cmd_event(struct thread_data *td, int event) io_u = (struct io_u *) (uintptr_t) cqe->user_data; if (cqe->res != 0) { - io_u->error = -cqe->res; + io_u->error = abs(cqe->res); return io_u; } else { io_u->error = 0; From f26af3ddd7becec1b296a67a4b80cf7d19e19928 Mon Sep 17 00:00:00 2001 From: Minwoo Im Date: Wed, 15 May 2024 14:46:04 +0900 Subject: [PATCH 2/2] 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 --- options.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/options.c b/options.c index 61ea41cc4e..51686914e6 100644 --- a/options.c +++ b/options.c @@ -495,7 +495,11 @@ static int ignore_error_type(struct thread_data *td, enum error_type_bit etype, if (fname[0] == 'E') { error[i] = str2error(fname); } else { - error[i] = atoi(fname); + int base = 10; + if (!strncmp(fname, "0x", 2) || + !strncmp(fname, "0X", 2)) + base = 16; + error[i] = strtol(fname, NULL, base); if (error[i] < 0) error[i] = -error[i]; }