* [PATCH] Add cmd_flags to print_req_error
@ 2018-10-30 2:40 Balbir Singh
2018-10-30 9:37 ` Ming Lei
0 siblings, 1 reply; 5+ messages in thread
From: Balbir Singh @ 2018-10-30 2:40 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel, Balbir Singh
I ran into a bug where after hibernation due to incompatible
backends, the block driver returned BLK_STS_NOTSUPP, with the
current message it's hard to find out what the command flags
were. Adding req->cmd_flags help make the problem easier to
diagnose.
Signed-off-by: Balbir Singh <sblbir@amzn.com>
Reviewed-by: Eduardo Valentin <eduval@amazon.com>
---
Testing: Compile tested at my end
Changelog
- convert %llx to %x and remove casting to unsigned long long
block/blk-core.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index cdfabc5646da..0fd6104bb0d2 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -256,10 +256,11 @@ static void print_req_error(struct request *req, blk_status_t status)
if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
return;
- printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu\n",
- __func__, blk_errors[idx].name, req->rq_disk ?
- req->rq_disk->disk_name : "?",
- (unsigned long long)blk_rq_pos(req));
+ printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %x\n",
+ __func__, blk_errors[idx].name,
+ req->rq_disk ? req->rq_disk->disk_name : "?",
+ (unsigned long long)blk_rq_pos(req),
+ req->cmd_flags);
}
static void req_bio_endio(struct request *rq, struct bio *bio,
--
2.16.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Add cmd_flags to print_req_error
2018-10-30 2:40 [PATCH] Add cmd_flags to print_req_error Balbir Singh
@ 2018-10-30 9:37 ` Ming Lei
0 siblings, 0 replies; 5+ messages in thread
From: Ming Lei @ 2018-10-30 9:37 UTC (permalink / raw)
To: Balbir Singh; +Cc: axboe, linux-block, linux-kernel
On Tue, Oct 30, 2018 at 02:40:15AM +0000, Balbir Singh wrote:
> I ran into a bug where after hibernation due to incompatible
> backends, the block driver returned BLK_STS_NOTSUPP, with the
> current message it's hard to find out what the command flags
> were. Adding req->cmd_flags help make the problem easier to
> diagnose.
>
> Signed-off-by: Balbir Singh <sblbir@amzn.com>
> Reviewed-by: Eduardo Valentin <eduval@amazon.com>
> ---
>
> Testing: Compile tested at my end
>
> Changelog
> - convert %llx to %x and remove casting to unsigned long long
>
> block/blk-core.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index cdfabc5646da..0fd6104bb0d2 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -256,10 +256,11 @@ static void print_req_error(struct request *req, blk_status_t status)
> if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
> return;
>
> - printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu\n",
> - __func__, blk_errors[idx].name, req->rq_disk ?
> - req->rq_disk->disk_name : "?",
> - (unsigned long long)blk_rq_pos(req));
> + printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %x\n",
> + __func__, blk_errors[idx].name,
> + req->rq_disk ? req->rq_disk->disk_name : "?",
> + (unsigned long long)blk_rq_pos(req),
> + req->cmd_flags);
> }
>
> static void req_bio_endio(struct request *rq, struct bio *bio,
> --
> 2.16.2
>
Looks fine:
Reviewed-by: Ming Lei <ming.lei@redhat.com>
--
Ming
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add cmd_flags to print_req_error
2018-10-29 22:39 ` Jens Axboe
@ 2018-10-30 2:53 ` Balbir Singh
0 siblings, 0 replies; 5+ messages in thread
From: Balbir Singh @ 2018-10-30 2:53 UTC (permalink / raw)
To: Jens Axboe; +Cc: Balbir Singh, linux-block, linux-kernel
On Mon, Oct 29, 2018 at 04:39:05PM -0600, Jens Axboe wrote:
> On 10/28/18 6:57 PM, Balbir Singh wrote:
> > I ran into a bug where after hibernation due to incompatible
> > backends, the block driver returned BLK_STS_NOTSUPP, with the
> > current message it's hard to find out what the command flags
> > were. Adding req->cmd_flags help make the problem easier to
> > diagnose.
>
> I recently did the same thing to debug something, so I like
> this change. One comment:
>
> > + printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %llx\n",
> > + __func__, blk_errors[idx].name,
> > + req->rq_disk ? req->rq_disk->disk_name : "?",
> > + (unsigned long long)blk_rq_pos(req),
> > + (unsigned long long)req->cmd_flags);
>
> Why are you casting it to unsigned long long for printing? A simple
> %x should suffice, no cast necessary.
>
Thanks! resent
I was looking at blk_dump_rq_flags() and tried to do something similar.
I agree a %x is sufficient, I was trying to be consistent. We can fix
that path up if needed.
> --
> Jens Axboe
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Add cmd_flags to print_req_error
2018-10-29 0:57 Balbir Singh
@ 2018-10-29 22:39 ` Jens Axboe
2018-10-30 2:53 ` Balbir Singh
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2018-10-29 22:39 UTC (permalink / raw)
To: Balbir Singh; +Cc: linux-block, linux-kernel
On 10/28/18 6:57 PM, Balbir Singh wrote:
> I ran into a bug where after hibernation due to incompatible
> backends, the block driver returned BLK_STS_NOTSUPP, with the
> current message it's hard to find out what the command flags
> were. Adding req->cmd_flags help make the problem easier to
> diagnose.
I recently did the same thing to debug something, so I like
this change. One comment:
> + printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %llx\n",
> + __func__, blk_errors[idx].name,
> + req->rq_disk ? req->rq_disk->disk_name : "?",
> + (unsigned long long)blk_rq_pos(req),
> + (unsigned long long)req->cmd_flags);
Why are you casting it to unsigned long long for printing? A simple
%x should suffice, no cast necessary.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Add cmd_flags to print_req_error
@ 2018-10-29 0:57 Balbir Singh
2018-10-29 22:39 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Balbir Singh @ 2018-10-29 0:57 UTC (permalink / raw)
To: axboe; +Cc: linux-block, linux-kernel, Balbir Singh
I ran into a bug where after hibernation due to incompatible
backends, the block driver returned BLK_STS_NOTSUPP, with the
current message it's hard to find out what the command flags
were. Adding req->cmd_flags help make the problem easier to
diagnose.
Signed-off-by: Balbir Singh <sblbir@amazon.com>
Reviewed-by: Eduardo Valentin <eduval@amazon.com>
---
The patch has been just compile tested only.
block/blk-core.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index cdfabc5646da..28b8f93835a7 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -256,10 +256,11 @@ static void print_req_error(struct request *req, blk_status_t status)
if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
return;
- printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu\n",
- __func__, blk_errors[idx].name, req->rq_disk ?
- req->rq_disk->disk_name : "?",
- (unsigned long long)blk_rq_pos(req));
+ printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %llx\n",
+ __func__, blk_errors[idx].name,
+ req->rq_disk ? req->rq_disk->disk_name : "?",
+ (unsigned long long)blk_rq_pos(req),
+ (unsigned long long)req->cmd_flags);
}
static void req_bio_endio(struct request *rq, struct bio *bio,
--
2.16.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-30 9:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 2:40 [PATCH] Add cmd_flags to print_req_error Balbir Singh
2018-10-30 9:37 ` Ming Lei
-- strict thread matches above, loose matches on Subject: below --
2018-10-29 0:57 Balbir Singh
2018-10-29 22:39 ` Jens Axboe
2018-10-30 2:53 ` Balbir Singh
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).