diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-07-02 13:37:43 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-27 11:53:13 -0400 |
commit | 7864f2b22636ed82340a00ab2ca36a967cf0c63d (patch) | |
tree | c0557dcc56579ce75ae7477d7d9b8a479a186ec9 /block | |
parent | fefbbf798da91511e3fbab69f28ce20604e2bbb3 (diff) |
block: Add blk_status_to_str()
If we're going to the trouble of having these nice error strings, let's
make them available.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 7663a9b94b80..e27b4ba513ce 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -218,18 +218,23 @@ int blk_status_to_errno(blk_status_t status) } EXPORT_SYMBOL_GPL(blk_status_to_errno); -static void print_req_error(struct request *req, blk_status_t status, - const char *caller) +const char *blk_status_to_str(blk_status_t status) { int idx = (__force int)status; if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors))) - return; + return "(invalid error)"; + return blk_errors[idx].name; +} +EXPORT_SYMBOL_GPL(blk_status_to_str); +static void print_req_error(struct request *req, blk_status_t status, + const char *caller) +{ printk_ratelimited(KERN_ERR "%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, + caller, blk_status_to_str(status), req->rq_disk ? req->rq_disk->disk_name : "?", blk_rq_pos(req), req_op(req), blk_op_str(req_op(req)), req->cmd_flags & ~REQ_OP_MASK, |