Linux FSCRYPT development
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Eric Biggers <ebiggers@google.com>,
	Andreas Dilger <adilger@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: linux-fscrypt@vger.kernel.org, James Simmons <jsimmons@infradead.org>
Subject: [PATCH 05/18] lnet: change LNetPrimaryNID to use struct lnet_nid
Date: Thu,  9 Jun 2022 08:33:01 -0400	[thread overview]
Message-ID: <1654777994-29806-6-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1654777994-29806-1-git-send-email-jsimmons@infradead.org>

From: Mr NeilBrown <neilb@suse.de>

Rather than taking and returning a 4-byte-addr nid, LNetPrimaryNID now
takes a pointer to a struct lnet_nid, and updates it in-place.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: ac881498fa19e6b04 ("LU-10391 lnet: change LNetPrimaryNID to use struct lnet_nid")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/43616
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/ptlrpc/connection.c |  2 +-
 include/linux/lnet/api.h      |  2 +-
 net/lnet/lnet/peer.c          | 21 +++++++++++----------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/lustre/ptlrpc/connection.c b/fs/lustre/ptlrpc/connection.c
index d1f53c6..58161fe 100644
--- a/fs/lustre/ptlrpc/connection.c
+++ b/fs/lustre/ptlrpc/connection.c
@@ -82,8 +82,8 @@ struct ptlrpc_connection *
 	struct ptlrpc_connection *conn, *conn2;
 	struct lnet_processid peer;
 
-	peer4.nid = LNetPrimaryNID(peer4.nid);
 	lnet_pid4_to_pid(peer4, &peer);
+	LNetPrimaryNID(&peer.nid);
 	conn = rhashtable_lookup_fast(&conn_hash, &peer, conn_hash_params);
 	if (conn) {
 		ptlrpc_connection_addref(conn);
diff --git a/include/linux/lnet/api.h b/include/linux/lnet/api.h
index 6d8e915..447b41d 100644
--- a/include/linux/lnet/api.h
+++ b/include/linux/lnet/api.h
@@ -77,7 +77,7 @@
  */
 int LNetGetId(unsigned int index, struct lnet_processid *id);
 int LNetDist(lnet_nid_t nid, lnet_nid_t *srcnid, u32 *order);
-lnet_nid_t LNetPrimaryNID(lnet_nid_t nid);
+void LNetPrimaryNID(struct lnet_nid *nid);
 
 /** @} lnet_addr */
 
diff --git a/net/lnet/lnet/peer.c b/net/lnet/lnet/peer.c
index 714326a..2055f31 100644
--- a/net/lnet/lnet/peer.c
+++ b/net/lnet/lnet/peer.c
@@ -1430,18 +1430,20 @@ struct lnet_peer_ni *
 }
 EXPORT_SYMBOL(LNetAddPeer);
 
-/* FIXME support large-addr nid */
-lnet_nid_t
-LNetPrimaryNID(lnet_nid_t nid)
+void LNetPrimaryNID(struct lnet_nid *nid)
 {
 	struct lnet_peer *lp;
 	struct lnet_peer_ni *lpni;
-	lnet_nid_t primary_nid = nid;
+	struct lnet_nid orig;
 	int rc = 0;
 	int cpt;
 
+	if (!nid || nid_is_lo0(nid))
+		return;
+	orig = *nid;
+
 	cpt = lnet_net_lock_current();
-	lpni = lnet_nid2peerni_locked(nid, LNET_NID_ANY, cpt);
+	lpni = lnet_peerni_by_nid_locked(nid, NULL, cpt);
 	if (IS_ERR(lpni)) {
 		rc = PTR_ERR(lpni);
 		goto out_unlock;
@@ -1468,7 +1470,7 @@ struct lnet_peer_ni *
 		 * and lookup the lpni again
 		 */
 		lnet_peer_ni_decref_locked(lpni);
-		lpni = lnet_find_peer_ni_locked(nid);
+		lpni = lnet_peer_ni_find_locked(nid);
 		if (!lpni) {
 			rc = -ENOENT;
 			goto out_unlock;
@@ -1483,15 +1485,14 @@ struct lnet_peer_ni *
 		if (lnet_is_discovery_disabled(lp))
 			break;
 	}
-	primary_nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+	*nid = lp->lp_primary_nid;
 out_decref:
 	lnet_peer_ni_decref_locked(lpni);
 out_unlock:
 	lnet_net_unlock(cpt);
 
-	CDEBUG(D_NET, "NID %s primary NID %s rc %d\n", libcfs_nid2str(nid),
-	       libcfs_nid2str(primary_nid), rc);
-	return primary_nid;
+	CDEBUG(D_NET, "NID %s primary NID %s rc %d\n", libcfs_nidstr(&orig),
+	       libcfs_nidstr(nid), rc);
 }
 EXPORT_SYMBOL(LNetPrimaryNID);
 
-- 
1.8.3.1


  parent reply	other threads:[~2022-06-09 12:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 12:32 [PATCH 00/18] lustre: sync with OpenSFS tree June 8, 2022 James Simmons
2022-06-09 12:32 ` [PATCH 01/18] lustre: llite: reenable fast_read by default James Simmons
2022-06-09 12:32 ` [PATCH 02/18] lustre: llite: Check vmpage in releasepage James Simmons
2022-06-09 12:32 ` [PATCH 03/18] lustre: update version to 2.15.50 James Simmons
2022-06-09 12:33 ` [PATCH 04/18] lustre: llog: read canceled records in llog_backup James Simmons
2022-06-09 12:33 ` James Simmons [this message]
2022-06-09 12:33 ` [PATCH 06/18] lnet: alter lnet_drop_rule_match() to take lnet_nid James Simmons
2022-06-09 12:33 ` [PATCH 07/18] lnet: Change LNetDist to work with struct lnet_nid James Simmons
2022-06-09 12:33 ` [PATCH 08/18] lnet: convert LNetPut to take 16byte nid and pid James Simmons
2022-06-09 12:33 ` [PATCH 09/18] lnet: change LNetGet " James Simmons
2022-06-09 12:33 ` [PATCH 10/18] lnet: socklnd: pass large processid to ksocknal_add_peer James Simmons
2022-06-09 12:33 ` [PATCH 11/18] lnet: socklnd: large processid for ksocknal_get_peer_info James Simmons
2022-06-09 12:33 ` [PATCH 12/18] lnet: socklnd: switch ksocknal_del_peer to lnet_processid James Simmons
2022-06-09 12:33 ` [PATCH 13/18] lustre: llite: access lli_lsm_md with lock in all places James Simmons
2022-06-09 12:33 ` [PATCH 14/18] lustre: quota: fallocate does not increase projectid usage James Simmons
2022-06-09 12:33 ` [PATCH 15/18] lnet: selftest: improve lnet_selftest speed James Simmons
2022-06-09 12:33 ` [PATCH 16/18] lustre: mdc: Use early cancels for hsm requests James Simmons
2022-06-09 12:33 ` [PATCH 17/18] lustre: ptlrpc: send disconnected events James Simmons
2022-06-09 12:33 ` [PATCH 18/18] lnet: Avoid redundant peer NI lookups James Simmons
2022-06-10  0:09 ` [PATCH 00/18] lustre: sync with OpenSFS tree June 8, 2022 Eric Biggers

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=1654777994-29806-6-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=ebiggers@google.com \
    --cc=linux-fscrypt@vger.kernel.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