diff mbox series

[04/25] lnet: change cfs_match_nid to take large nid.

Message ID 20250130141115.950749-5-jsimmons@infradead.org (mailing list archive)
State New
Headers show
Series lustre: sync to OpenSFS branch April 30, 2023 | expand

Commit Message

James Simmons Jan. 30, 2025, 2:10 p.m. UTC
From: Mr NeilBrown <neilb@suse.de>

large nid now used more places.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 3d0b1b0200542f845 ("LU-10391 lustre: change cfs_match_nid to take large nid.")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50098
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/llite_lib.c      |  2 +-
 include/uapi/linux/lnet/nidstr.h |  2 +-
 net/lnet/lnet/nidstrings.c       | 10 ++++++----
 3 files changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/llite/llite_lib.c b/fs/lustre/llite/llite_lib.c
index 2c286e858056..d4f17ce24465 100644
--- a/fs/lustre/llite/llite_lib.c
+++ b/fs/lustre/llite/llite_lib.c
@@ -3746,7 +3746,7 @@  void ll_compute_rootsquash_state(struct ll_sb_info *sbi)
 		while (LNetGetId(i++, &id) != -ENOENT) {
 			if (nid_is_lo0(&id.nid))
 				continue;
-			if (cfs_match_nid(lnet_nid_to_nid4(&id.nid),
+			if (cfs_match_nid(&id.nid,
 					  &squash->rsi_nosquash_nids)) {
 				matched = true;
 				break;
diff --git a/include/uapi/linux/lnet/nidstr.h b/include/uapi/linux/lnet/nidstr.h
index d5829fef0d9f..1ccb8fa826b4 100644
--- a/include/uapi/linux/lnet/nidstr.h
+++ b/include/uapi/linux/lnet/nidstr.h
@@ -98,7 +98,7 @@  char *libcfs_id2str(struct lnet_process_id id);
 void cfs_free_nidlist(struct list_head *list);
 int cfs_parse_nidlist(char *str, int len, struct list_head *list);
 int cfs_print_nidlist(char *buffer, int count, struct list_head *list);
-int cfs_match_nid(lnet_nid_t nid, struct list_head *list);
+int cfs_match_nid(struct lnet_nid *nid, struct list_head *list);
 int cfs_match_net(__u32 net_id, __u32 net_type,
 		  struct list_head *net_num_list);
 
diff --git a/net/lnet/lnet/nidstrings.c b/net/lnet/lnet/nidstrings.c
index b5a585507d6a..d235048a8ff0 100644
--- a/net/lnet/lnet/nidstrings.c
+++ b/net/lnet/lnet/nidstrings.c
@@ -358,20 +358,22 @@  EXPORT_SYMBOL(cfs_parse_nidlist);
  *
  * Return:	1 on match, 0 otherwises
  */
-int cfs_match_nid(lnet_nid_t nid, struct list_head *nidlist)
+int cfs_match_nid(struct lnet_nid *nid, struct list_head *nidlist)
 {
 	struct nidrange *nr;
 	struct addrrange *ar;
 
+	if (!nid_is_nid4(nid))
+		return 0;
 	list_for_each_entry(nr, nidlist, nr_link) {
-		if (nr->nr_netstrfns->nf_type != LNET_NETTYP(LNET_NIDNET(nid)))
+		if (nr->nr_netstrfns->nf_type != nid->nid_type)
 			continue;
-		if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid)))
+		if (nr->nr_netnum != be16_to_cpu(nid->nid_num))
 			continue;
 		if (nr->nr_all)
 			return 1;
 		list_for_each_entry(ar, &nr->nr_addrranges, ar_link)
-			if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid),
+			if (nr->nr_netstrfns->nf_match_addr(be32_to_cpu(nid->nid_addr[0]),
 							    &ar->ar_numaddr_ranges))
 				return 1;
 	}