Skip to content

Commit

Permalink
block: improve print_req_error
Browse files Browse the repository at this point in the history
Print the calling function instead of print_req_error as a prefix, and
print the operation and op_flags separately instead of the whole field.

Reviewed-by: Bart Van Assche <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Chaitanya Kulkarni <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 20, 2019
1 parent 8060c47 commit 178cc59
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,20 @@ 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)
static void print_req_error(struct request *req, blk_status_t status,
const char *caller)
{
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 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);
printk_ratelimited(KERN_ERR
"%s: %s error, dev %s, sector %llu op 0x%x flags 0x%x\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);
}

static void req_bio_endio(struct request *rq, struct bio *bio,
Expand Down Expand Up @@ -1362,7 +1364,7 @@ bool blk_update_request(struct request *req, blk_status_t error,

if (unlikely(error && !blk_rq_is_passthrough(req) &&
!(req->rq_flags & RQF_QUIET)))
print_req_error(req, error);
print_req_error(req, error, __func__);

blk_account_io_completion(req, nr_bytes);

Expand Down

0 comments on commit 178cc59

Please sign in to comment.