On 10/17/21 01:37, Jens Axboe wrote:
We only need to call it to resolve the blk_status_t -> errno mapping
if the status is different than BLK_STS_OK. Check that it is before
doing so.
Suggested-by: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
block/blk-mq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ffccc5f0f66a..fa5b12200404 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -676,9 +676,11 @@ static void blk_account_io_completion(struct request *req, unsigned int bytes)
bool blk_update_request(struct request *req, blk_status_t error,
unsigned int nr_bytes)
{
- int total_bytes;
+ int total_bytes, blk_errno = 0;
- trace_block_rq_complete(req, blk_status_to_errno(error), nr_bytes);
+ if (unlikely(error != BLK_STS_OK))
+ blk_errno = blk_status_to_errno(error);
+ trace_block_rq_complete(req, blk_errno, nr_bytes);
Last time I checked relevant asm, the inference of arguments was done
under the trace branch, so no extra work if tracing is not active.
if (!req->bio)
return false;
--
Pavel Begunkov