From: Mr NeilBrown Date: Fri, 26 Jun 2020 05:37:10 +0000 (+1000) Subject: LU-10391 lnet: change lnet_prep_send to take net_processid X-Git-Tag: 2.15.0-RC1~79 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F43605%2F12;p=fs%2Flustre-release.git LU-10391 lnet: change lnet_prep_send to take net_processid Instead of a 'struct lnet_process_id', lnet_prep_send() now takes a "struct lnet_processid *" with allows larger address. Test-Parameters: trivial Test-Parameters: serverversion=2.12 serverdistro=el7.9 testlist=runtests Test-Parameters: clientversion=2.12 testlist=runtests Signed-off-by: Mr NeilBrown Change-Id: Ibf01340663316e24b6c3053166465293c4f761e1 Reviewed-on: https://review.whamcloud.com/43605 Reviewed-by: James Simmons Reviewed-by: Serguei Smirnov Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index 8c1b244..e4658a8 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -655,7 +655,7 @@ void lnet_msg_commit(struct lnet_msg *msg, int cpt); void lnet_msg_decommit(struct lnet_msg *msg, int cpt, int status); void lnet_prep_send(struct lnet_msg *msg, int type, - struct lnet_process_id target, unsigned int offset, + struct lnet_processid *target, unsigned int offset, unsigned int len); int lnet_send(struct lnet_nid *nid, struct lnet_msg *msg, struct lnet_nid *rtr_nid); diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index ed7f102..229cd33 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -709,12 +709,11 @@ lnet_setpayloadbuffer(struct lnet_msg *msg) } void -lnet_prep_send(struct lnet_msg *msg, int type, struct lnet_process_id target, +lnet_prep_send(struct lnet_msg *msg, int type, struct lnet_processid *target, unsigned int offset, unsigned int len) { msg->msg_type = type; - msg->msg_target.pid = target.pid; - lnet_nid4_to_nid(target.nid, &msg->msg_target.nid); + msg->msg_target = *target; msg->msg_len = len; msg->msg_offset = offset; @@ -724,8 +723,8 @@ lnet_prep_send(struct lnet_msg *msg, int type, struct lnet_process_id target, memset (&msg->msg_hdr, 0, sizeof (msg->msg_hdr)); msg->msg_hdr.type = type; /* dest_nid will be overwritten by lnet_select_pathway() */ - lnet_nid4_to_nid(target.nid, &msg->msg_hdr.dest_nid); - msg->msg_hdr.dest_pid = target.pid; + msg->msg_hdr.dest_nid = target->nid; + msg->msg_hdr.dest_pid = target->pid; /* src_nid will be set later */ msg->msg_hdr.src_pid = the_lnet.ln_pid; msg->msg_hdr.payload_length = len; @@ -4238,7 +4237,7 @@ lnet_parse_get(struct lnet_ni *ni, struct lnet_msg *msg, int rdma_get) { struct lnet_match_info info; struct lnet_hdr *hdr = &msg->msg_hdr; - struct lnet_process_id source_id; + struct lnet_processid source_id; struct lnet_handle_wire reply_wmd; int rc; @@ -4248,7 +4247,7 @@ lnet_parse_get(struct lnet_ni *ni, struct lnet_msg *msg, int rdma_get) hdr->msg.get.sink_length = le32_to_cpu(hdr->msg.get.sink_length); hdr->msg.get.src_offset = le32_to_cpu(hdr->msg.get.src_offset); - source_id.nid = lnet_nid_to_nid4(&hdr->src_nid); + source_id.nid = hdr->src_nid; source_id.pid = hdr->src_pid; /* Primary peer NID */ info.mi_id.nid = msg->msg_initiator; @@ -4275,7 +4274,7 @@ lnet_parse_get(struct lnet_ni *ni, struct lnet_msg *msg, int rdma_get) reply_wmd = hdr->msg.get.return_wmd; - lnet_prep_send(msg, LNET_MSG_REPLY, source_id, + lnet_prep_send(msg, LNET_MSG_REPLY, &source_id, msg->msg_offset, msg->msg_wanted); msg->msg_hdr.msg.reply.dst_wmd = reply_wmd; @@ -4970,7 +4969,7 @@ lnet_attach_rsp_tracker(struct lnet_rsp_tracker *rspt, int cpt, */ int LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack, - struct lnet_process_id target, unsigned int portal, + struct lnet_process_id target4, unsigned int portal, __u64 match_bits, unsigned int offset, __u64 hdr_data) { @@ -4978,24 +4977,27 @@ LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack, struct lnet_libmd *md; int cpt; int rc; + struct lnet_processid target; struct lnet_rsp_tracker *rspt = NULL; struct lnet_nid self; LASSERT(the_lnet.ln_refcount > 0); lnet_nid4_to_nid(self4, &self); + lnet_nid4_to_nid(target4.nid, &target.nid); + target.pid = target4.pid; if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */ - fail_peer(target.nid, 1)) { /* shall we now? */ + fail_peer(target4.nid, 1)) { /* shall we now? */ CERROR("Dropping PUT to %s: simulated failure\n", - libcfs_id2str(target)); + libcfs_id2str(target4)); return -EIO; } msg = lnet_msg_alloc(); if (msg == NULL) { CERROR("Dropping PUT to %s: ENOMEM on struct lnet_msg\n", - libcfs_id2str(target)); + libcfs_id2str(target4)); return -ENOMEM; } msg->msg_vmflush = !!(current->flags & PF_MEMALLOC); @@ -5006,7 +5008,7 @@ LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack, rspt = lnet_rspt_alloc(cpt); if (!rspt) { CERROR("Dropping PUT to %s: ENOMEM on response tracker\n", - libcfs_id2str(target)); + libcfs_id2str(target4)); return -ENOMEM; } INIT_LIST_HEAD(&rspt->rspt_on_list); @@ -5017,7 +5019,7 @@ LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack, md = lnet_handle2md(&mdh); if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) { CERROR("Dropping PUT (%llu:%d:%s): MD (%d) invalid\n", - match_bits, portal, libcfs_id2str(target), + match_bits, portal, libcfs_id2str(target4), md == NULL ? -1 : md->md_threshold); if (md != NULL && md->md_me != NULL) CERROR("Source MD also attached to portal %d\n", @@ -5031,11 +5033,11 @@ LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack, return -ENOENT; } - CDEBUG(D_NET, "LNetPut -> %s\n", libcfs_id2str(target)); + CDEBUG(D_NET, "%s -> %s\n", __func__, libcfs_id2str(target4)); lnet_msg_attach_md(msg, md, 0, 0); - lnet_prep_send(msg, LNET_MSG_PUT, target, 0, md->md_length); + lnet_prep_send(msg, LNET_MSG_PUT, &target, 0, md->md_length); msg->msg_hdr.msg.put.match_bits = cpu_to_le64(match_bits); msg->msg_hdr.msg.put.ptl_index = cpu_to_le32(portal); @@ -5073,7 +5075,7 @@ LNetPut(lnet_nid_t self4, struct lnet_handle_md mdh, enum lnet_ack_req ack, if (rc != 0) { CNETERR("Error sending PUT to %s: %d\n", - libcfs_id2str(target), rc); + libcfs_id2str(target4), rc); msg->msg_no_resend = true; lnet_finalize(msg, rc); } @@ -5205,7 +5207,7 @@ EXPORT_SYMBOL(lnet_set_reply_msg_len); */ int LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, - struct lnet_process_id target, unsigned int portal, + struct lnet_process_id target4, unsigned int portal, __u64 match_bits, unsigned int offset, bool recovery) { struct lnet_msg *msg; @@ -5214,23 +5216,26 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, int cpt; int rc; struct lnet_nid self; + struct lnet_processid target; LASSERT(the_lnet.ln_refcount > 0); lnet_nid4_to_nid(self4, &self); + lnet_nid4_to_nid(target4.nid, &target.nid); + target.pid = target4.pid; if (!list_empty(&the_lnet.ln_test_peers) && /* normally we don't */ - fail_peer(target.nid, 1)) /* shall we now? */ + fail_peer(target4.nid, 1)) /* shall we now? */ { CERROR("Dropping GET to %s: simulated failure\n", - libcfs_id2str(target)); + libcfs_id2str(target4)); return -EIO; } msg = lnet_msg_alloc(); if (!msg) { CERROR("Dropping GET to %s: ENOMEM on struct lnet_msg\n", - libcfs_id2str(target)); + libcfs_id2str(target4)); return -ENOMEM; } @@ -5239,7 +5244,7 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, rspt = lnet_rspt_alloc(cpt); if (!rspt) { CERROR("Dropping GET to %s: ENOMEM on response tracker\n", - libcfs_id2str(target)); + libcfs_id2str(target4)); return -ENOMEM; } INIT_LIST_HEAD(&rspt->rspt_on_list); @@ -5251,7 +5256,7 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, md = lnet_handle2md(&mdh); if (md == NULL || md->md_threshold == 0 || md->md_me != NULL) { CERROR("Dropping GET (%llu:%d:%s): MD (%d) invalid\n", - match_bits, portal, libcfs_id2str(target), + match_bits, portal, libcfs_id2str(target4), md == NULL ? -1 : md->md_threshold); if (md != NULL && md->md_me != NULL) CERROR("REPLY MD also attached to portal %d\n", @@ -5264,11 +5269,11 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, return -ENOENT; } - CDEBUG(D_NET, "LNetGet -> %s\n", libcfs_id2str(target)); + CDEBUG(D_NET, "%s -> %s\n", __func__, libcfs_id2str(target4)); lnet_msg_attach_md(msg, md, 0, 0); - lnet_prep_send(msg, LNET_MSG_GET, target, 0, 0); + lnet_prep_send(msg, LNET_MSG_GET, &target, 0, 0); msg->msg_hdr.msg.get.match_bits = cpu_to_le64(match_bits); msg->msg_hdr.msg.get.ptl_index = cpu_to_le32(portal); @@ -5293,7 +5298,7 @@ LNetGet(lnet_nid_t self4, struct lnet_handle_md mdh, rc = lnet_send(&self, msg, NULL); if (rc < 0) { CNETERR("Error sending GET to %s: %d\n", - libcfs_id2str(target), rc); + libcfs_id2str(target4), rc); msg->msg_no_resend = true; lnet_finalize(msg, rc); } diff --git a/lnet/lnet/lib-msg.c b/lnet/lnet/lib-msg.c index bea9883..462163f 100644 --- a/lnet/lnet/lib-msg.c +++ b/lnet/lnet/lib-msg.c @@ -384,8 +384,7 @@ lnet_complete_msg_locked(struct lnet_msg *msg, int cpt) ack_wmd = msg->msg_hdr.msg.put.ack_wmd; - lnet_prep_send(msg, LNET_MSG_ACK, - lnet_pid_to_pid4(&msg->msg_ev.source), 0, 0); + lnet_prep_send(msg, LNET_MSG_ACK, &msg->msg_ev.source, 0, 0); msg->msg_hdr.msg.ack.dst_wmd = ack_wmd; msg->msg_hdr.msg.ack.match_bits = msg->msg_ev.match_bits;