linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] print_req_error: Use dev_err_ratelimited
@ 2020-10-26 16:05 Tony Asleson
  2020-11-17 20:41 ` Tony Asleson
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Asleson @ 2020-10-26 16:05 UTC (permalink / raw)
  To: axboe, linux-block, linux-kernel

Replace printk_ratelimited with dev_err_ratelimited which
adds dev_printk meta data. This is used by journald to
add disk ID information to the journal entry.

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

diff --git a/block/blk-core.c b/block/blk-core.c
index 10c08ac50697..ee5d63e54a11 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -216,16 +216,18 @@ EXPORT_SYMBOL_GPL(blk_status_to_errno);
 static void print_req_error(struct request *req, blk_status_t status,
 		const char *caller)
 {
+	struct device *dev;
 	int idx = (__force int)status;
 
 	if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
 		return;
 
-	printk_ratelimited(KERN_ERR
-		"%s: %s error, dev %s, sector %llu op 0x%x:(%s) flags 0x%x "
+	dev = req->rq_disk ? disk_to_dev(req->rq_disk) : NULL;
+
+	dev_err_ratelimited(dev,
+		"%s: %s error, 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), blk_op_str(req_op(req)),
 		req->cmd_flags & ~REQ_OP_MASK,
 		req->nr_phys_segments,

base-commit: bbf5c979011a099af5dc76498918ed7df445635b
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] print_req_error: Use dev_err_ratelimited
  2020-10-26 16:05 [PATCH] print_req_error: Use dev_err_ratelimited Tony Asleson
@ 2020-11-17 20:41 ` Tony Asleson
  0 siblings, 0 replies; 2+ messages in thread
From: Tony Asleson @ 2020-11-17 20:41 UTC (permalink / raw)
  To: axboe, linux-block, linux-kernel

Any thoughts on this?

Getting all the error paths to go through dev_printk is
quite useful.


On 10/26/20 11:05 AM, Tony Asleson wrote:
> Replace printk_ratelimited with dev_err_ratelimited which
> adds dev_printk meta data. This is used by journald to
> add disk ID information to the journal entry.
> 
> Signed-off-by: Tony Asleson <tasleson@redhat.com>
> ---
>  block/blk-core.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 10c08ac50697..ee5d63e54a11 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -216,16 +216,18 @@ EXPORT_SYMBOL_GPL(blk_status_to_errno);
>  static void print_req_error(struct request *req, blk_status_t status,
>  		const char *caller)
>  {
> +	struct device *dev;
>  	int idx = (__force int)status;
>  
>  	if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
>  		return;
>  
> -	printk_ratelimited(KERN_ERR
> -		"%s: %s error, dev %s, sector %llu op 0x%x:(%s) flags 0x%x "
> +	dev = req->rq_disk ? disk_to_dev(req->rq_disk) : NULL;
> +
> +	dev_err_ratelimited(dev,
> +		"%s: %s error, 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), blk_op_str(req_op(req)),
>  		req->cmd_flags & ~REQ_OP_MASK,
>  		req->nr_phys_segments,
> 
> base-commit: bbf5c979011a099af5dc76498918ed7df445635b
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-17 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 16:05 [PATCH] print_req_error: Use dev_err_ratelimited Tony Asleson
2020-11-17 20:41 ` Tony Asleson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).