This patch adds more debug data on the top of the existing print_req_error() where we enhance the print message with the printing request operations in string format and other request fields. Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx> --- block/blk-core.c | 57 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index d1a227cfb72e..659e5ea6f6c9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -167,6 +167,54 @@ int blk_status_to_errno(blk_status_t status) } EXPORT_SYMBOL_GPL(blk_status_to_errno); +static inline const char *req_op_str(struct request *req) +{ + char *ret; + + switch (req_op(req)) { + case REQ_OP_READ: + ret = "read"; + break; + case REQ_OP_WRITE: + ret = "write"; + break; + case REQ_OP_FLUSH: + ret = "flush"; + break; + case REQ_OP_DISCARD: + ret = "discard"; + break; + case REQ_OP_SECURE_ERASE: + ret = "secure_erase"; + break; + case REQ_OP_ZONE_RESET: + ret = "zone_reset"; + break; + case REQ_OP_WRITE_SAME: + ret = "write_same"; + break; + case REQ_OP_WRITE_ZEROES: + ret = "write_zeroes"; + break; + case REQ_OP_SCSI_IN: + ret = "scsi_in"; + break; + case REQ_OP_SCSI_OUT: + ret = "scsi_out"; + break; + case REQ_OP_DRV_IN: + ret = "drv_in"; + break; + case REQ_OP_DRV_OUT: + ret = "drv_out"; + break; + default: + ret = "unknown"; + } + + return ret; +} + static void print_req_error(struct request *req, blk_status_t status, const char *caller) { @@ -176,11 +224,14 @@ static void print_req_error(struct request *req, blk_status_t status, return; printk_ratelimited(KERN_ERR - "%s: %s error, dev %s, sector %llu op 0x%x flags 0x%x\n", + "%s: %s error, dev %s, sector %llu op 0x%x:(%s) flags 0x%x " + "phys_seg %u prio class %u\n", caller, blk_errors[idx].name, req->rq_disk ? req->rq_disk->disk_name : "?", - blk_rq_pos(req), req_op(req), - req->cmd_flags & ~REQ_OP_MASK); + blk_rq_pos(req), req_op(req), req_op_str(req), + req->cmd_flags & ~REQ_OP_MASK, + req->nr_phys_segments, + IOPRIO_PRIO_CLASS(req->ioprio)); } static void req_bio_endio(struct request *rq, struct bio *bio, -- 2.19.1