From 37ba07f338293d2496c6ac773fee1b3453189bb1 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Wed, 7 Jul 2021 15:55:06 +1000 Subject: [PATCH] LU-10391 ptlrpc: change rq_self to struct lnet_nid rq_self in struct ptlrpc_request can now store largs NIDs. ptlrpc_connection_get() is also changed to received a 'struct lnet_nid'. Signed-off-by: Mr NeilBrown Change-Id: If2ea7770e967e2f044f2b2300950b612463e130c Reviewed-on: https://review.whamcloud.com/44636 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frank Sehr Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lustre/include/lustre_net.h | 9 +++++---- lustre/ldlm/ldlm_lib.c | 3 ++- lustre/ptlrpc/client.c | 4 ++-- lustre/ptlrpc/connection.c | 4 ++-- lustre/ptlrpc/events.c | 12 +++++++----- lustre/ptlrpc/lproc_ptlrpc.c | 4 ++-- lustre/ptlrpc/niobuf.c | 13 +++++++------ 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index a11825c..56f2419 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -1111,7 +1111,7 @@ struct ptlrpc_request { /** import where request is being sent */ struct obd_import *rq_import; /** our LNet NID */ - lnet_nid_t rq_self; + struct lnet_nid rq_self; /** Peer description (the other side) */ struct lnet_process_id rq_peer; /** Descriptor for the NID from which the peer sent the request. */ @@ -1894,7 +1894,8 @@ static inline bool nrs_policy_compat_one(const struct ptlrpc_service *svc, /* ptlrpc/events.c */ extern int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, - struct lnet_process_id *peer, lnet_nid_t *self); + struct lnet_process_id *peer, + struct lnet_nid *self); /** * These callbacks are invoked by LNet when something happened to * underlying buffer @@ -1912,8 +1913,8 @@ extern void server_bulk_callback(struct lnet_event *ev); /* ptlrpc/connection.c */ struct ptlrpc_connection *ptlrpc_connection_get(struct lnet_process_id peer, - lnet_nid_t self, - struct obd_uuid *uuid); + struct lnet_nid *self, + struct obd_uuid *uuid); static inline void ptlrpc_connection_put(struct ptlrpc_connection *conn) { diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 62c182c..1f5689a 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1481,7 +1481,8 @@ dont_check_exports: */ ptlrpc_request_change_export(req, export); - pcon = ptlrpc_connection_get(req->rq_peer, req->rq_self, &cluuid); + pcon = ptlrpc_connection_get(req->rq_peer, + &req->rq_self, &cluuid); if (pcon == NULL) GOTO(out, rc = -ENOTCONN); diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index fff2296..f9f99dc 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -126,7 +126,7 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid, lnet_nid_t nid4refnet) { struct ptlrpc_connection *c; - lnet_nid_t self; + struct lnet_nid self; struct lnet_process_id peer; int err; @@ -142,7 +142,7 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid, return NULL; } - c = ptlrpc_connection_get(peer, self, uuid); + c = ptlrpc_connection_get(peer, &self, uuid); if (c) { memcpy(c->c_remote_uuid.uuid, uuid->uuid, sizeof(c->c_remote_uuid.uuid)); diff --git a/lustre/ptlrpc/connection.c b/lustre/ptlrpc/connection.c index 7d4663d..ff359b1 100644 --- a/lustre/ptlrpc/connection.c +++ b/lustre/ptlrpc/connection.c @@ -76,7 +76,7 @@ static const struct rhashtable_params conn_hash_params = { }; struct ptlrpc_connection * -ptlrpc_connection_get(struct lnet_process_id peer4, lnet_nid_t self, +ptlrpc_connection_get(struct lnet_process_id peer4, struct lnet_nid *self, struct obd_uuid *uuid) { struct ptlrpc_connection *conn, *conn2; @@ -96,7 +96,7 @@ ptlrpc_connection_get(struct lnet_process_id peer4, lnet_nid_t self, RETURN(NULL); conn->c_peer = peer; - lnet_nid4_to_nid(self, &conn->c_self); + conn->c_self = *self; atomic_set(&conn->c_refcount, 1); if (uuid) obd_str2uuid(&conn->c_remote_uuid, uuid->uuid); diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index b4956cc..5e9550c 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -350,7 +350,7 @@ void request_in_callback(struct lnet_event *ev) /* Multi-Rail: keep track of both initiator and source NID. */ req->rq_peer = lnet_pid_to_pid4(&ev->initiator); req->rq_source = lnet_pid_to_pid4(&ev->source); - req->rq_self = lnet_nid_to_nid4(&ev->target.nid); + req->rq_self = ev->target.nid; req->rq_rqbd = rqbd; req->rq_phase = RQ_PHASE_NEW; if (ev->type == LNET_EVENT_PUT) @@ -527,7 +527,8 @@ static void ptlrpc_master_callback(struct lnet_event *ev) } int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, - struct lnet_process_id *peer, lnet_nid_t *self) + struct lnet_process_id *peer, + struct lnet_nid *self) { int best_dist = 0; __u32 best_order = 0; @@ -550,8 +551,9 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, if (dist < 0) continue; - if (dist == 0) { /* local! use loopback LND */ - peer->nid = *self = LNET_NID_LO_0; + if (dist == 0) { /* local! use loopback LND */ + peer->nid = LNET_NID_LO_0; + lnet_nid4_to_nid(peer->nid, self); rc = 0; break; } @@ -563,7 +565,7 @@ int ptlrpc_uuid_to_peer(struct obd_uuid *uuid, best_order = order; peer->nid = lnet_nid_to_nid4(&dst_nid); - *self = lnet_nid_to_nid4(&src_nid); + *self = src_nid; rc = 0; } } diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 7ef662e..7c06a49 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1063,8 +1063,8 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) req->rq_history_seq, req->rq_export && req->rq_export->exp_obd ? req->rq_export->exp_obd->obd_name : - libcfs_nid2str_r(req->rq_self, nidstr, - sizeof(nidstr)), + libcfs_nidstr_r(&req->rq_self, nidstr, + sizeof(nidstr)), libcfs_id2str(req->rq_peer), req->rq_xid, req->rq_reqlen, ptlrpc_rqphase2str(req), (s64)req->rq_arrival_time.tv_sec, diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index 546c523..a1d0516 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -188,7 +188,7 @@ int ptlrpc_start_bulk_transfer(struct ptlrpc_bulk_desc *desc) * request, so they are based on the route taken by the * message. */ - lnet_nid4_to_nid(desc->bd_req->rq_self, &self_nid); + self_nid = desc->bd_req->rq_self; lnet_pid4_to_pid(desc->bd_req->rq_source, &peer_id); /* NB total length may be 0 for a read past EOF, so we send 0 @@ -628,10 +628,10 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) ptlrpc_at_set_reply(req, flags); - if (req->rq_export == NULL || req->rq_export->exp_connection == NULL) - conn = ptlrpc_connection_get(req->rq_peer, req->rq_self, NULL); - else - conn = ptlrpc_connection_addref(req->rq_export->exp_connection); + if (req->rq_export == NULL || req->rq_export->exp_connection == NULL) + conn = ptlrpc_connection_get(req->rq_peer, &req->rq_self, NULL); + else + conn = ptlrpc_connection_addref(req->rq_export->exp_connection); if (unlikely(conn == NULL)) { CERROR("not replying on NULL connection\n"); /* bug 9635 */ @@ -648,7 +648,8 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags) rc = ptl_send_buf(&rs->rs_md_h, rs->rs_repbuf, rs->rs_repdata_len, (rs->rs_difficult && !rs->rs_no_ack) ? LNET_ACK_REQ : LNET_NOACK_REQ, - &rs->rs_cb_id, req->rq_self, req->rq_source, + &rs->rs_cb_id, lnet_nid_to_nid4(&req->rq_self), + req->rq_source, ptlrpc_req2svc(req)->srv_rep_portal, req->rq_rep_mbits ? req->rq_rep_mbits : req->rq_xid, req->rq_reply_off, NULL); -- 1.8.3.1