io_uring: Add IO_U_F_DEVICE_ERROR to identify error types
authorMinwoo Im <minwoo.im.dev@gmail.com>
Thu, 26 Sep 2024 00:41:34 +0000 (09:41 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 26 Sep 2024 17:32:50 +0000 (11:32 -0600)
commitebe67b667f25694ead4caa0198598318f891b345
treef415c7be2bc507018b2889d7a99dc97cb2c2a490
parent12c4b854a34414bad23ef613efece7caca82445e
io_uring: Add IO_U_F_DEVICE_ERROR to identify error types

__io_u_log_error expects a positive value of io_u->error parsing it with
strerror() expecting it to be an errno.  io_uring_cmd (cmd_type=nvme),
for example, has returned errno value as a positive value and
device-specific CQE status type and code as well.

Commit 78831c6b35c5 ("io_uring: Fix the flip to negative of CQE status")
has put the abs() to the cqe->res, and it caused confusions between the
actual CQE stauts and the system error value (errno).  Now we have
Commit 2a13699a89dc ("io_uring: Add .errdetails to parse CQ status"),
meaning that io_uring_cmd ioengines will parse the actual value of
io_u->error value as CQE status value, so we should know if the value is
for CQE status or errno.

This patch added a flag IO_U_F_DEVICE_ERROR to io_u to represent if
io_u->error has device-specific error value, otherwise it's errno.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Link: https://lore.kernel.org/r/20240926004134.26004-1-minwoo.im.dev@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/io_uring.c
io_u.c
io_u.h