lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 03/24] lustre: ptlrpc: pass net num to ptlrpc_uuid_to_connection
Date: Sun, 18 Sep 2022 01:21:53 -0400	[thread overview]
Message-ID: <1663478534-19917-4-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1663478534-19917-1-git-send-email-jsimmons@infradead.org>

From: Mr NeilBrown <neilb@suse.de>

Rather than passing a nid to indicate which net to choose,
pass just the net number.  This will make it easier to convert to
'struct lnet_nid'.

Also change ptlrpc_uuid_to_peer() to take the refnet as an explicit
argument, rather than embedding in in the peer pid.

This makes the refnet test more obvious, and removes the (strange)
need to test the address part against zero.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: a0bdb01ad05b24d24 ("LU-10391 ptlrpc: pass net num to ptlrpc_uuid_to_connection")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/44637
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_net.h |  5 +++--
 fs/lustre/ldlm/ldlm_lib.c      | 10 +++++-----
 fs/lustre/ptlrpc/client.c      |  5 ++---
 fs/lustre/ptlrpc/events.c      |  7 ++++---
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/fs/lustre/include/lustre_net.h b/fs/lustre/include/lustre_net.h
index 3a35b03..d564e28 100644
--- a/fs/lustre/include/lustre_net.h
+++ b/fs/lustre/include/lustre_net.h
@@ -1707,7 +1707,8 @@ static inline bool nrs_policy_compat_one(const struct ptlrpc_service *svc,
 /* ptlrpc/events.c */
 int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
 			struct lnet_process_id *peer,
-			struct lnet_nid *self);
+			struct lnet_nid *self,
+			u32 refnet);
 /**
  * These callbacks are invoked by LNet when something happened to
  * underlying buffer
@@ -1811,7 +1812,7 @@ static inline int ptlrpc_client_bulk_active(struct ptlrpc_request *req)
 void ptlrpc_init_client(int req_portal, int rep_portal, const char *name,
 			struct ptlrpc_client *);
 struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid,
-						    lnet_nid_t nid4refnet);
+						    u32 refnet);
 
 int ptlrpc_queue_wait(struct ptlrpc_request *req);
 int ptlrpc_replay_req(struct ptlrpc_request *req);
diff --git a/fs/lustre/ldlm/ldlm_lib.c b/fs/lustre/ldlm/ldlm_lib.c
index 02d1eea..804bb9c 100644
--- a/fs/lustre/ldlm/ldlm_lib.c
+++ b/fs/lustre/ldlm/ldlm_lib.c
@@ -56,7 +56,7 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid,
 {
 	struct ptlrpc_connection *ptlrpc_conn;
 	struct obd_import_conn *imp_conn = NULL, *item;
-	lnet_nid_t nid4refnet = LNET_NID_ANY;
+	u32 refnet = LNET_NET_ANY;
 	int rc = 0;
 
 	if (!create && !priority) {
@@ -66,10 +66,10 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid,
 
 	if (imp->imp_connection &&
 	    imp->imp_connection->c_remote_uuid.uuid[0] == 0)
-		/* nid4refnet is used to restrict network connections */
-		nid4refnet = lnet_nid_to_nid4(&imp->imp_connection->c_self);
+		/* refnet is used to restrict network connections */
+		refnet = LNET_NID_NET(&imp->imp_connection->c_self);
 
-	ptlrpc_conn = ptlrpc_uuid_to_connection(uuid, nid4refnet);
+	ptlrpc_conn = ptlrpc_uuid_to_connection(uuid, refnet);
 	if (!ptlrpc_conn) {
 		CDEBUG(D_HA, "can't find connection %s\n", uuid->uuid);
 		return -ENOENT;
@@ -145,7 +145,7 @@ int client_import_dyn_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
 	struct ptlrpc_connection *ptlrpc_conn;
 	int rc;
 
-	ptlrpc_conn = ptlrpc_uuid_to_connection(uuid, prim_nid);
+	ptlrpc_conn = ptlrpc_uuid_to_connection(uuid, LNET_NIDNET(prim_nid));
 	if (!ptlrpc_conn) {
 		const char *str_uuid = obd_uuid2str(uuid);
 
diff --git a/fs/lustre/ptlrpc/client.c b/fs/lustre/ptlrpc/client.c
index 7a4a9c9..7ca7d35 100644
--- a/fs/lustre/ptlrpc/client.c
+++ b/fs/lustre/ptlrpc/client.c
@@ -102,7 +102,7 @@ void ptlrpc_init_client(int req_portal, int rep_portal, const char *name,
  * Return PortalRPC connection for remote uud @uuid
  */
 struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid,
-						    lnet_nid_t nid4refnet)
+						    u32 refnet)
 {
 	struct ptlrpc_connection *c;
 	struct lnet_nid self;
@@ -114,8 +114,7 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid,
 	 * before accessing its values.
 	 * coverity[uninit_use_in_call]
 	 */
-	peer.nid = nid4refnet;
-	err = ptlrpc_uuid_to_peer(uuid, &peer, &self);
+	err = ptlrpc_uuid_to_peer(uuid, &peer, &self, refnet);
 	if (err != 0) {
 		CNETERR("cannot find peer %s!\n", uuid->uuid);
 		return NULL;
diff --git a/fs/lustre/ptlrpc/events.c b/fs/lustre/ptlrpc/events.c
index 231eace..793c078 100644
--- a/fs/lustre/ptlrpc/events.c
+++ b/fs/lustre/ptlrpc/events.c
@@ -469,7 +469,8 @@ static void ptlrpc_master_callback(struct lnet_event *ev)
 
 int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
 			struct lnet_process_id *peer,
-			struct lnet_nid *self)
+			struct lnet_nid *self,
+			u32 refnet)
 {
 	int best_dist = 0;
 	u32 best_order = 0;
@@ -484,8 +485,8 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid,
 
 	/* Choose the matching UUID that's closest */
 	while (lustre_uuid_to_peer(uuid->uuid, &dst_nid, count++) == 0) {
-		if (peer->nid != LNET_NID_ANY && LNET_NIDADDR(peer->nid) == 0 &&
-		    LNET_NID_NET(&dst_nid) != LNET_NIDNET(peer->nid))
+		if (refnet != LNET_NET_ANY &&
+		    LNET_NID_NET(&dst_nid) != refnet)
 			continue;
 
 		dist = LNetDist(&dst_nid, &src_nid, &order);
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2022-09-18  5:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-18  5:21 [lustre-devel] [PATCH 00/24] lustre: update to 2.15.52 James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 01/24] lustre: dne: add crush2 hash type James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 02/24] lustre: ptlrpc: change rq_self to struct lnet_nid James Simmons
2022-09-18  5:21 ` James Simmons [this message]
2022-09-18  5:21 ` [lustre-devel] [PATCH 04/24] lustre: ptlrpc: change rq_peer " James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 05/24] lustre: ptlrpc: change rq_source " James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 06/24] lustre: ptlrpc: change bd_sender in ptlrpc_bulk_frag_ops James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 07/24] lustre: ptlrpc: pass lnet_nid for self to ptl_send_buf() James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 08/24] lustre: llite: don't use a kms if it invalid James Simmons
2022-09-18  5:21 ` [lustre-devel] [PATCH 09/24] lustre: mdc: check/grab import before access James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 10/24] lustre: llog: handle -EBADR for catalog processing James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 11/24] lnet: Always use ping reply to set route lr_alive James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 12/24] lustre: clio: remove vvp_page_print() James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 13/24] lustre: clio: remove cpo_prep and cpo_make_ready James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 14/24] lustre: clio: remove struct vvp_page James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 15/24] lustre: clio: remove unused convenience functions James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 16/24] lustre: clio: remove cpl_obj James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 17/24] lustre: osc: remove oap_cli James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 18/24] lustre: osc: Remove submit time James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 19/24] lnet: selftest: revert "LU-16011 lnet: use preallocate bulk for server" James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 20/24] lustre: flr: allow layout version update from client/MDS James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 21/24] lustre: ptlrpc: adds configurable ping interval James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 22/24] lnet: allow direct messages regardless of peer NI status James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 23/24] lnet: Honor peer timeout of zero James Simmons
2022-09-18  5:22 ` [lustre-devel] [PATCH 24/24] lustre: update version to 2.15.52 James Simmons

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=1663478534-19917-4-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).