cqe = &ld->cq_ring.cqes[index];
io_u = (struct io_u *) (uintptr_t) cqe->user_data;
- if (cqe->res != 0) {
- io_u->error = abs(cqe->res);
- return io_u;
- } else {
- io_u->error = 0;
- }
+ io_u->error = cqe->res;
+ if (io_u->error != 0)
+ goto ret;
if (o->cmd_type == FIO_URING_CMD_NVME) {
data = FILE_ENG_DATA(io_u->file);
}
}
+ret:
+ /*
+ * If IO_U_F_DEVICE_ERROR is not set, io_u->error will be parsed as an
+ * errno, otherwise device-specific error value (status value in CQE).
+ */
+ if ((int)io_u->error > 0)
+ io_u_set(td, io_u, IO_U_F_DEVICE_ERROR);
+ else
+ io_u_clear(td, io_u, IO_U_F_DEVICE_ERROR);
+ io_u->error = abs(io_u->error);
return io_u;
}
#define MAXMSGCHUNK 128
char *msg, msgchunk[MAXMSGCHUNK];
+ if (!(io_u->flags & IO_U_F_DEVICE_ERROR))
+ return NULL;
+
msg = calloc(1, MAXERRDETAIL);
strcpy(msg, "io_uring_cmd: ");
log_err("fio: io_u error%s%s: %s: %s offset=%llu, buflen=%llu\n",
io_u->file ? " on file " : "",
io_u->file ? io_u->file->file_name : "",
- strerror(io_u->error),
+ (io_u->flags & IO_U_F_DEVICE_ERROR) ?
+ "Device-specific error" : strerror(io_u->error),
io_ddir_name(io_u->ddir),
io_u->offset, io_u->xfer_buflen);
if (td->io_ops->errdetails) {
char *err = td->io_ops->errdetails(td, io_u);
- log_err("fio: %s\n", err);
- free(err);
+ if (err) {
+ log_err("fio: %s\n", err);
+ free(err);
+ }
}
if (!td->error)
IO_U_F_BARRIER = 1 << 6,
IO_U_F_VER_LIST = 1 << 7,
IO_U_F_PATTERN_DONE = 1 << 8,
+ IO_U_F_DEVICE_ERROR = 1 << 9,
};
/*