Thread (37 messages) 37 messages, 4 authors, 2021-10-19

Re: [PATCH 05/14] block: don't call blk_status_to_errno() for success status

From: Pavel Begunkov <asml.silence@gmail.com>
Date: 2021-10-18 10:49:07

On 10/17/21 01:37, Jens Axboe wrote:
quoted hunk ↗ jump to hunk
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@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
  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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help