The following changes since commit 55b10ccca6a2ba623360a38c3fdf7332461646bb: Merge branch 'master' of https://github.com/scaleoutsean/fio (2024-08-06 09:17:03 -0600) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to 7bc12310ac39f8bf694a6785d027e4cee96dbbdf: Merge branch 'errdetails' of https://github.com/minwooim/fio (2024-08-16 08:21:20 -0600) ---------------------------------------------------------------- Jens Axboe (1): Merge branch 'errdetails' of https://github.com/minwooim/fio Minwoo Im (2): ioengines: Add thread_data to .errdetails io_uring: Add .errdetails to parse CQ status engines/io_uring.c | 34 ++++++++++++++++++++++++++++++++++ engines/librpma_fio.c | 2 +- engines/librpma_fio.h | 2 +- engines/sg.c | 2 +- io_u.c | 2 +- ioengines.h | 4 ++-- 6 files changed, 40 insertions(+), 6 deletions(-) --- Diff of recent changes: diff --git a/engines/io_uring.c b/engines/io_uring.c index 334c77b9..bfbdc3b4 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -554,6 +554,39 @@ static struct io_u *fio_ioring_cmd_event(struct thread_data *td, int event) return io_u; } +static char *fio_ioring_cmd_errdetails(struct thread_data *td, + struct io_u *io_u) +{ + struct ioring_options *o = td->eo; + unsigned int sct = (io_u->error >> 8) & 0x7; + unsigned int sc = io_u->error & 0xff; +#define MAXERRDETAIL 1024 +#define MAXMSGCHUNK 128 + char *msg, msgchunk[MAXMSGCHUNK]; + + msg = calloc(1, MAXERRDETAIL); + strcpy(msg, "io_uring_cmd: "); + + snprintf(msgchunk, MAXMSGCHUNK, "%s: ", io_u->file->file_name); + strlcat(msg, msgchunk, MAXERRDETAIL); + + if (o->cmd_type == FIO_URING_CMD_NVME) { + strlcat(msg, "cq entry status (", MAXERRDETAIL); + + snprintf(msgchunk, MAXMSGCHUNK, "sct=0x%02x; ", sct); + strlcat(msg, msgchunk, MAXERRDETAIL); + + snprintf(msgchunk, MAXMSGCHUNK, "sc=0x%02x)", sc); + strlcat(msg, msgchunk, MAXERRDETAIL); + } else { + /* Print status code in generic */ + snprintf(msgchunk, MAXMSGCHUNK, "status=0x%x", io_u->error); + strlcat(msg, msgchunk, MAXERRDETAIL); + } + + return msg; +} + static int fio_ioring_cqring_reap(struct thread_data *td, unsigned int events, unsigned int max) { @@ -1590,6 +1623,7 @@ static struct ioengine_ops ioengine_uring_cmd = { .commit = fio_ioring_commit, .getevents = fio_ioring_getevents, .event = fio_ioring_cmd_event, + .errdetails = fio_ioring_cmd_errdetails, .cleanup = fio_ioring_cleanup, .open_file = fio_ioring_cmd_open_file, .close_file = fio_ioring_cmd_close_file, diff --git a/engines/librpma_fio.c b/engines/librpma_fio.c index 42d6163e..4ccc6d0b 100644 --- a/engines/librpma_fio.c +++ b/engines/librpma_fio.c @@ -790,7 +790,7 @@ struct io_u *librpma_fio_client_event(struct thread_data *td, int event) return io_u; } -char *librpma_fio_client_errdetails(struct io_u *io_u) +char *librpma_fio_client_errdetails(struct thread_data *td, struct io_u *io_u) { /* get the string representation of an error */ enum ibv_wc_status status = io_u->error; diff --git a/engines/librpma_fio.h b/engines/librpma_fio.h index 480ded1b..2bcbb378 100644 --- a/engines/librpma_fio.h +++ b/engines/librpma_fio.h @@ -162,7 +162,7 @@ int librpma_fio_client_getevents(struct thread_data *td, unsigned int min, struct io_u *librpma_fio_client_event(struct thread_data *td, int event); -char *librpma_fio_client_errdetails(struct io_u *io_u); +char *librpma_fio_client_errdetails(struct thread_data *td, struct io_u *io_u); static inline int librpma_fio_client_io_read(struct thread_data *td, struct io_u *io_u, int flags) diff --git a/engines/sg.c b/engines/sg.c index 0bb5be4a..9df70bd2 100644 --- a/engines/sg.c +++ b/engines/sg.c @@ -1154,7 +1154,7 @@ int fio_sgio_close(struct thread_data *td, struct fio_file *f) * Build an error string with details about the driver, host or scsi * error contained in the sg header Caller will use as necessary. */ -static char *fio_sgio_errdetails(struct io_u *io_u) +static char *fio_sgio_errdetails(struct thread_data *td, struct io_u *io_u) { struct sg_io_hdr *hdr = &io_u->hdr; #define MAXERRDETAIL 1024 diff --git a/io_u.c b/io_u.c index f81086b6..40b09082 100644 --- a/io_u.c +++ b/io_u.c @@ -1963,7 +1963,7 @@ static void __io_u_log_error(struct thread_data *td, struct io_u *io_u) zbd_log_err(td, io_u); if (td->io_ops->errdetails) { - char *err = td->io_ops->errdetails(io_u); + char *err = td->io_ops->errdetails(td, io_u); log_err("fio: %s\n", err); free(err); diff --git a/ioengines.h b/ioengines.h index 6039d41e..b9834fec 100644 --- a/ioengines.h +++ b/ioengines.h @@ -9,7 +9,7 @@ #include "zbd_types.h" #include "dataplacement.h" -#define FIO_IOOPS_VERSION 35 +#define FIO_IOOPS_VERSION 36 #ifndef CONFIG_DYNAMIC_ENGINES #define FIO_STATIC static @@ -40,7 +40,7 @@ struct ioengine_ops { int (*commit)(struct thread_data *); int (*getevents)(struct thread_data *, unsigned int, unsigned int, const struct timespec *); struct io_u *(*event)(struct thread_data *, int); - char *(*errdetails)(struct io_u *); + char *(*errdetails)(struct thread_data *, struct io_u *); int (*cancel)(struct thread_data *, struct io_u *); void (*cleanup)(struct thread_data *); int (*open_file)(struct thread_data *, struct fio_file *);