All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: "axboe@kernel.dk" <axboe@kernel.dk>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sung-Jun Park <sungjun07.park@samsung.com>,
	Daejun Park <daejun7.park@samsung.com>,
	Jinyoung CHOI <j-young.choi@samsung.com>,
	Jieon Seol <jieon.seol@samsung.com>,
	Jaemyung Lee <jaemyung.lee@samsung.com>,
	Keoseong Park <keosung.park@samsung.com>,
	Dukhyun Kwon <d_hyun.kwon@samsung.com>,
	JinHwan Park <jh.i.park@samsung.com>
Subject: [PATCH] block: remove redundant check in blk_attempt_plug_merge
Date: Wed, 21 Apr 2021 17:15:17 +0900	[thread overview]
Message-ID: <20210421081517epcms2p75252b49900647146260b4f3c18cfd7c5@epcms2p7> (raw)
In-Reply-To: CGME20210421081517epcms2p75252b49900647146260b4f3c18cfd7c5@epcms2p7

blk_attempt_plug_merge is only called by blk_mq_submit_bio and the
parameter of same_queue_rq is not NULL. This patch remove redundant
check for same_queue_rq is not NULL in list_for_each_entry_reverse.

Signed-off-by: Daejun Park <daejun7.park@samsung.com>
---
 block/blk-merge.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index ffb4aa0ea68b..0af8a276de09 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -1030,7 +1030,6 @@ static enum bio_merge_status blk_attempt_bio_merge(struct request_queue *q,
  * @nr_segs: number of segments in @bio
  * @same_queue_rq: pointer to &struct request that gets filled in when
  * another request associated with @q is found on the plug list
- * (optional, may be %NULL)
  *
  * Determine whether @bio being queued on @q can be merged with a request
  * on %current's plugged list.  Returns %true if merge was successful,
@@ -1059,18 +1058,16 @@ bool blk_attempt_plug_merge(struct request_queue *q, struct bio *bio,
 	plug_list = &plug->mq_list;
 
 	list_for_each_entry_reverse(rq, plug_list, queuelist) {
-		if (rq->q == q && same_queue_rq) {
-			/*
-			 * Only blk-mq multiple hardware queues case checks the
-			 * rq in the same queue, there should be only one such
-			 * rq in a queue
-			 **/
-			*same_queue_rq = rq;
-		}
-
 		if (rq->q != q)
 			continue;
 
+		/*
+		 * Only blk-mq multiple hardware queues case checks the
+		 * rq in the same queue, there should be only one such
+		 * rq in a queue
+		 **/
+		*same_queue_rq = rq;
+
 		if (blk_attempt_bio_merge(q, rq, bio, nr_segs, false) ==
 		    BIO_MERGE_OK)
 			return true;
-- 
2.25.1


           reply	other threads:[~2021-04-21  8:15 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CGME20210421081517epcms2p75252b49900647146260b4f3c18cfd7c5@epcms2p7>]

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=20210421081517epcms2p75252b49900647146260b4f3c18cfd7c5@epcms2p7 \
    --to=daejun7.park@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=d_hyun.kwon@samsung.com \
    --cc=j-young.choi@samsung.com \
    --cc=jaemyung.lee@samsung.com \
    --cc=jh.i.park@samsung.com \
    --cc=jieon.seol@samsung.com \
    --cc=keosung.park@samsung.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sungjun07.park@samsung.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.