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 v3 08/14] blk-mq: remove unncessary error count and commit in blk_mq_plug_issue_direct
Date: Wed, 11 Jan 2023 21:01:53 +0800	[thread overview]
Message-ID: <20230111130159.3741753-9-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20230111130159.3741753-1-shikemeng@huaweicloud.com>

We need only to explicitly commit in two error cases:
 -did not queue everything initially scheduled to queue
 -the last attempt to queue a request failed
(see comment of blk_mq_commit_rqs for more details).
Both cases can be checked with ret of last request which breaks list walk.
Remove unnecessary error count and unnecessary commit triggered by error
which is not covered by cases described above.

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

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 98f6003474f2..c6c84f44c7a6 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2706,11 +2706,10 @@ static void blk_mq_plug_issue_direct(struct blk_plug *plug)
 	struct blk_mq_hw_ctx *hctx = NULL;
 	struct request *rq;
 	int queued = 0;
-	int errors = 0;
+	blk_status_t ret;
 
 	while ((rq = rq_list_pop(&plug->mq_list))) {
 		bool last = rq_list_empty(plug->mq_list);
-		blk_status_t ret;
 
 		if (hctx != rq->mq_hctx) {
 			if (hctx)
@@ -2726,20 +2725,15 @@ static void blk_mq_plug_issue_direct(struct blk_plug *plug)
 		case BLK_STS_RESOURCE:
 		case BLK_STS_DEV_RESOURCE:
 			blk_mq_request_bypass_insert(rq, false, true);
-			blk_mq_plug_commit_rqs(hctx, &queued);
-			return;
+			goto out;
 		default:
 			blk_mq_end_request(rq, ret);
-			errors++;
 			break;
 		}
 	}
 
-	/*
-	 * If we didn't flush the entire list, we could have told the driver
-	 * there was more coming, but that turned out to be a lie.
-	 */
-	if (errors)
+out:
+	if (ret != BLK_STS_OK)
 		blk_mq_plug_commit_rqs(hctx, &queued);
 }
 
-- 
2.30.0


  parent reply	other threads:[~2023-01-11  5:04 UTC|newest]

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

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=20230111130159.3741753-9-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.