lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 21 Apr 2021 17:15:17 +0900
From:   Daejun Park <daejun7.park@...sung.com>
To:     "axboe@...nel.dk" <axboe@...nel.dk>
CC:     "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Sung-Jun Park <sungjun07.park@...sung.com>,
        Daejun Park <daejun7.park@...sung.com>,
        Jinyoung CHOI <j-young.choi@...sung.com>,
        Jieon Seol <jieon.seol@...sung.com>,
        Jaemyung Lee <jaemyung.lee@...sung.com>,
        Keoseong Park <keosung.park@...sung.com>,
        Dukhyun Kwon <d_hyun.kwon@...sung.com>,
        JinHwan Park <jh.i.park@...sung.com>
Subject: [PATCH] block: remove redundant check in blk_attempt_plug_merge

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@...sung.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ