All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kemeng Shi <shikemeng@huaweicloud.com>
To: hch@lst.de, axboe@kernel.dk, dwagner@suse.de, hare@suse.de,
	ming.lei@redhat.com, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: john.garry@huawei.com, jack@suse.cz
Subject: [PATCH v4 11/14] blk-mq: remove unnecessary error count and check in blk_mq_dispatch_rq_list
Date: Wed, 18 Jan 2023 17:37:23 +0800	[thread overview]
Message-ID: <20230118093726.3939160-11-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20230118093726.3939160-1-shikemeng@huaweicloud.com>

blk_mq_dispatch_rq_list will notify if hctx is busy in return bool. It will
return true if we are not busy and can handle more and return false on the
opposite. Inside blk_mq_dispatch_rq_list, errors is only used if list is
empty and we will return true if list is empty and (errors + queued) != 0.

There are three types of status returned from request:
 -busy error BLK_STS*_RESOURCE: the failed request will be added back
to list and list will not be empty.
 -BLK_STS_OK: We count queued for BLK_STS_OK
 -rest error: We count errors for rest error

If list is empty, there is no request gets busy error then (errors +
queued) will be total requests in the list which is checked not empty at
beginning of blk_mq_dispatch_rq_list. So (errors + queued) != 0 is always
met if list is empty. Then the (errors + queued) != 0 check and errors
number count is not needed.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 block/blk-mq.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index d4fdb01475b6..90471b5c868f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2033,7 +2033,7 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
 	enum prep_dispatch prep;
 	struct request_queue *q = hctx->queue;
 	struct request *rq, *nxt;
-	int errors, queued;
+	int queued;
 	blk_status_t ret = BLK_STS_OK;
 	LIST_HEAD(zone_list);
 	bool needs_resource = false;
@@ -2044,7 +2044,7 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
 	/*
 	 * Now process all the entries, sending them to the driver.
 	 */
-	errors = queued = 0;
+	queued = 0;
 	do {
 		struct blk_mq_queue_data bd;
 
@@ -2097,7 +2097,6 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
 			needs_resource = true;
 			break;
 		default:
-			errors++;
 			blk_mq_end_request(rq, ret);
 		}
 	} while (!list_empty(list));
@@ -2175,10 +2174,10 @@ bool blk_mq_dispatch_rq_list(struct blk_mq_hw_ctx *hctx, struct list_head *list,
 
 		blk_mq_update_dispatch_busy(hctx, true);
 		return false;
-	} else
-		blk_mq_update_dispatch_busy(hctx, false);
+	}
 
-	return (queued + errors) != 0;
+	blk_mq_update_dispatch_busy(hctx, false);
+	return true;
 }
 
 /**
-- 
2.30.0


  parent reply	other threads:[~2023-01-18  1:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18  9:37 [PATCH v4 01/14] blk-mq: avoid sleep in blk_mq_alloc_request_hctx Kemeng Shi
2023-01-18  9:37 ` [PATCH v4 02/14] blk-mq: remove stale comment for blk_mq_sched_mark_restart_hctx Kemeng Shi
2023-01-18  9:37 ` [PATCH v4 03/14] blk-mq: wait on correct sbitmap_queue in blk_mq_mark_tag_wait Kemeng Shi
2023-01-18  9:37 ` [PATCH v4 04/14] blk-mq: Fix potential io hung for shared sbitmap per tagset Kemeng Shi
2023-02-06 15:52   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 05/14] blk-mq: remove unnecessary list_empty check in blk_mq_try_issue_list_directly Kemeng Shi
2023-01-18  9:37 ` [PATCH v4 06/14] blk-mq: remove unncessary from_schedule parameter in blk_mq_plug_issue_direct Kemeng Shi
2023-01-18 17:36   ` Christoph Hellwig
2023-02-06 15:52   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 07/14] blk-mq: make blk_mq_commit_rqs a general function for all commits Kemeng Shi
2023-01-18 17:37   ` Christoph Hellwig
2023-01-19  1:40     ` Kemeng Shi
2023-01-28  1:55       ` Kemeng Shi
2023-02-06 15:53   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 08/14] blk-mq: remove unncessary error count and commit in blk_mq_plug_issue_direct Kemeng Shi
2023-01-18 17:38   ` Christoph Hellwig
2023-02-06 15:53   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 09/14] blk-mq: use blk_mq_commit_rqs helper in blk_mq_try_issue_list_directly Kemeng Shi
2023-01-18 17:38   ` Christoph Hellwig
2023-02-06 15:53   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 10/14] blk-mq: simplify flush check in blk_mq_dispatch_rq_list Kemeng Shi
2023-01-18 17:38   ` Christoph Hellwig
2023-02-06 15:53   ` Christoph Hellwig
2023-01-18  9:37 ` Kemeng Shi [this message]
2023-01-18 17:39   ` [PATCH v4 11/14] blk-mq: remove unnecessary error count and " Christoph Hellwig
2023-02-06 15:54   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 12/14] blk-mq: remove set of bd->last when get driver tag for next request fails Kemeng Shi
2023-01-18 17:42   ` Christoph Hellwig
2023-01-19  1:45     ` Kemeng Shi
2023-01-28  2:03       ` Kemeng Shi
2023-02-06  1:05         ` Kemeng Shi
2023-02-06 16:06           ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 13/14] blk-mq: use switch/case to improve readability in blk_mq_try_issue_list_directly Kemeng Shi
2023-01-18 17:42   ` Christoph Hellwig
2023-01-18  9:37 ` [PATCH v4 14/14] blk-mq: correct stale comment of .get_budget Kemeng Shi
2023-01-18 17:42   ` Christoph Hellwig
2023-02-06 16:22 ` [PATCH v4 01/14] blk-mq: avoid sleep in blk_mq_alloc_request_hctx Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230118093726.3939160-11-shikemeng@huaweicloud.com \
    --to=shikemeng@huaweicloud.com \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=john.garry@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.