[RFC 7/9] print_req_error: Add persistent durable name

Tony Asleson
2019-12-23T22:56:19Z

Add persistent durable name to errors that occur in block mid layer.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
---
block/blk-core.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index d5e668ec751b..a0171a7c6535 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -211,11 +211,20 @@ static void print_req_error(struct request *req, blk_status_t status,
const char *caller)
{
int idx = (__force int)status;
+ char dict[128];
+ int dict_len = 0;

if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
return;

- printk_ratelimited(KERN_ERR
+ if (req->rq_disk) {
+ dict_len = dev_durable_name(
+ disk_to_dev(req->rq_disk)->parent,
+ dict,
+ sizeof(dict));
+ }
+
+ printk_emit_ratelimited(0, LOGLEVEL_ERR, dict, dict_len,
"%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,
--
2.21.0