[lustre-devel] [PATCH 02/19] lnet: change tp_nid to 16byte in lnet_test_peer.
James Simmons
jsimmons at infradead.org
Sun Nov 28 15:27:37 PST 2021
From: Mr NeilBrown <neilb at suse.de>
This updates 'struct lnet_test_peer' to store a large address nid.
WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 7e89b556ea7dc4b4c ("LU-10391 lnet: change tp_nid to 16byte in lnet_test_peer.")
Signed-off-by: Mr NeilBrown <neilb at suse.de>
Reviewed-on: https://review.whamcloud.com/43595
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Chris Horn <chris.horn at hpe.com>
Reviewed-by: Amir Shehata <ashehata at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
include/linux/lnet/lib-types.h | 2 +-
net/lnet/lnet/lib-move.c | 18 +++++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/include/linux/lnet/lib-types.h b/include/linux/lnet/lib-types.h
index 380a7b9..1901ad2 100644
--- a/include/linux/lnet/lib-types.h
+++ b/include/linux/lnet/lib-types.h
@@ -233,7 +233,7 @@ struct lnet_libmd {
struct lnet_test_peer {
/* info about peers we are trying to fail */
struct list_head tp_list; /* ln_test_peers */
- lnet_nid_t tp_nid; /* matching nid */
+ struct lnet_nid tp_nid; /* matching nid */
unsigned int tp_threshold; /* # failures to simulate */
};
diff --git a/net/lnet/lnet/lib-move.c b/net/lnet/lnet/lib-move.c
index 170d684..b9f5973 100644
--- a/net/lnet/lnet/lib-move.c
+++ b/net/lnet/lnet/lib-move.c
@@ -190,13 +190,15 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
}
int
-lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
+lnet_fail_nid(lnet_nid_t nid4, unsigned int threshold)
{
struct lnet_test_peer *tp;
struct list_head *el;
struct list_head *next;
+ struct lnet_nid nid;
LIST_HEAD(cull);
+ lnet_nid4_to_nid(nid4, &nid);
/* NB: use lnet_net_lock(0) to serialize operations on test peers */
if (threshold) {
/* Adding a new entry */
@@ -218,9 +220,9 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
list_for_each_safe(el, next, &the_lnet.ln_test_peers) {
tp = list_entry(el, struct lnet_test_peer, tp_list);
- if (!tp->tp_threshold || /* needs culling anyway */
- nid == LNET_NID_ANY || /* removing all entries */
- tp->tp_nid == nid) { /* matched this one */
+ if (!tp->tp_threshold || /* needs culling anyway */
+ LNET_NID_IS_ANY(&nid) || /* removing all entries */
+ nid_same(&tp->tp_nid, &nid)) { /* matched this one */
list_move(&tp->tp_list, &cull);
}
}
@@ -237,14 +239,16 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
}
static int
-fail_peer(lnet_nid_t nid, int outgoing)
+fail_peer(lnet_nid_t nid4, int outgoing)
{
struct lnet_test_peer *tp;
struct list_head *el;
struct list_head *next;
+ struct lnet_nid nid;
LIST_HEAD(cull);
int fail = 0;
+ lnet_nid4_to_nid(nid4, &nid);
/* NB: use lnet_net_lock(0) to serialize operations on test peers */
lnet_net_lock(0);
@@ -264,8 +268,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
continue;
}
- if (tp->tp_nid == LNET_NID_ANY || /* fail every peer */
- nid == tp->tp_nid) { /* fail this peer */
+ if (LNET_NID_IS_ANY(&tp->tp_nid) || /* fail every peer */
+ nid_same(&nid, &tp->tp_nid)) { /* fail this peer */
fail = 1;
if (tp->tp_threshold != LNET_MD_THRESH_INF) {
--
1.8.3.1
More information about the lustre-devel
mailing list