Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 178cc590 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

block: improve print_req_error



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: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 8060c47b
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -167,18 +167,20 @@ int blk_status_to_errno(blk_status_t status)
}
}
EXPORT_SYMBOL_GPL(blk_status_to_errno);
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;
	int idx = (__force int)status;


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


	printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu flags %x\n",
	printk_ratelimited(KERN_ERR
				__func__, blk_errors[idx].name,
		"%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 : "?",
		req->rq_disk ?  req->rq_disk->disk_name : "?",
				(unsigned long long)blk_rq_pos(req),
		blk_rq_pos(req), req_op(req),
				req->cmd_flags);
		req->cmd_flags & ~REQ_OP_MASK);
}
}


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


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


	blk_account_io_completion(req, nr_bytes);
	blk_account_io_completion(req, nr_bytes);