From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
leon@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: [PATCH 2/3] RDMA/rtrs-clt: Break the loop once one path is connected
Date: Fri, 2 Sep 2022 18:19:21 +0800 [thread overview]
Message-ID: <20220902101922.26273-3-guoqing.jiang@linux.dev> (raw)
In-Reply-To: <20220902101922.26273-1-guoqing.jiang@linux.dev>
No need to iterate all paths after find one connected path.
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 5219bb10777a..c29eccdb4fd2 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -54,7 +54,10 @@ static inline bool rtrs_clt_is_connected(const struct rtrs_clt_sess *clt)
rcu_read_lock();
list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry)
- connected |= READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED;
+ if (READ_ONCE(clt_path->state) == RTRS_CLT_CONNECTED) {
+ connected = true;
+ break;
+ }
rcu_read_unlock();
return connected;
--
2.31.1
next prev parent reply other threads:[~2022-09-02 10:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 10:19 [PATCH 0/3] misc changes for rtrs Guoqing Jiang
2022-09-02 10:19 ` [PATCH 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH Guoqing Jiang
2022-09-02 10:19 ` Guoqing Jiang [this message]
2022-09-02 10:19 ` [PATCH 3/3] RDMA/rtrs-clt: Kill xchg_paths Guoqing Jiang
2022-09-02 19:15 ` kernel test robot
2022-09-03 3:54 ` Guoqing Jiang
2022-09-03 4:02 ` [Updated PATCH " Guoqing Jiang
2022-09-05 12:28 ` [PATCH 0/3] misc changes for rtrs Leon Romanovsky
2022-09-06 7:04 ` Guoqing Jiang
2022-09-06 11:13 ` Leon Romanovsky
2022-09-08 8:53 ` Haris Iqbal
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=20220902101922.26273-3-guoqing.jiang@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox