Whamcloud - gitweb
LU-10391 lnet: use large nids in struct lnet_event 00/43600/12
authorMr NeilBrown <neilb@suse.de>
Tue, 30 Nov 2021 14:51:37 +0000 (09:51 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 18 Jan 2022 09:08:28 +0000 (09:08 +0000)
All nids, including those in process_id, are changed to
to struct lnet_nid / struct lnet_processid.

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 <neilb@suse.de>
Change-Id: I799dbbc22f7cfe403f07eb22f4bfc4e4b5dc23ea
Reviewed-on: https://review.whamcloud.com/43600
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
40 files changed:
lnet/include/lnet/api.h
lnet/include/lnet/lib-lnet.h
lnet/include/uapi/linux/lnet/lnet-types.h
lnet/lnet/api-ni.c
lnet/lnet/lib-msg.c
lnet/lnet/peer.c
lnet/selftest/rpc.c
lustre/include/lustre_export.h
lustre/include/lustre_net.h
lustre/include/lustre_sec.h
lustre/include/obd.h
lustre/include/obd_class.h
lustre/ldlm/ldlm_flock.c
lustre/ldlm/ldlm_lib.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_lproc.c
lustre/mgc/mgc_request.c
lustre/mgs/mgs_llog.c
lustre/obdclass/genops.c
lustre/obdclass/lprocfs_status.c
lustre/obdclass/lprocfs_status_server.c
lustre/obdclass/obd_config.c
lustre/osc/osc_request.c
lustre/osp/osp_trans.c
lustre/ptlrpc/client.c
lustre/ptlrpc/connection.c
lustre/ptlrpc/events.c
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/import.c
lustre/ptlrpc/niobuf.c
lustre/ptlrpc/nodemap_lproc.c
lustre/ptlrpc/nodemap_member.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/ptlrpc_internal.h
lustre/ptlrpc/sec.c
lustre/ptlrpc/sec_config.c
lustre/ptlrpc/service.c
lustre/target/tgt_handler.c

index c139be1..4990f8a 100644 (file)
@@ -161,7 +161,7 @@ int LNetGet(lnet_nid_t            self,
 int LNetSetLazyPortal(int portal);
 int LNetClearLazyPortal(int portal);
 int LNetCtl(unsigned int cmd, void *arg);
-void LNetDebugPeer(struct lnet_process_id id);
+void LNetDebugPeer(struct lnet_processid *id);
 int LNetGetPeerDiscoveryStatus(void);
 int LNetAddPeer(lnet_nid_t *nids, __u32 num_nids);
 
index 43fec25..730c614 100644 (file)
@@ -921,7 +921,8 @@ struct lnet_peer_ni *lnet_peer_ni_get_locked(struct lnet_peer *lp,
                                             struct lnet_nid *nid);
 struct lnet_peer_ni *lnet_find_peer_ni_locked(lnet_nid_t nid);
 struct lnet_peer_ni *lnet_peer_ni_find_locked(struct lnet_nid *nid);
-struct lnet_peer *lnet_find_peer(lnet_nid_t nid);
+struct lnet_peer *lnet_find_peer4(lnet_nid_t nid);
+struct lnet_peer *lnet_find_peer(struct lnet_nid *nid);
 void lnet_peer_net_added(struct lnet_net *net);
 void lnet_peer_primary_nid_locked(lnet_nid_t nid, struct lnet_nid *result);
 int lnet_discover_peer_locked(struct lnet_peer_ni *lpni, int cpt, bool block);
index ca887fd..02f1bb6 100644 (file)
@@ -517,25 +517,25 @@ enum lnet_event_kind {
  */
 struct lnet_event {
        /** The identifier (nid, pid) of the target. */
-       struct lnet_process_id   target;
+       struct lnet_processid   target;
        /** The identifier (nid, pid) of the initiator. */
-       struct lnet_process_id   initiator;
+       struct lnet_processid   initiator;
        /** The source NID on the initiator. */
-       struct lnet_process_id   source;
+       struct lnet_processid   source;
        /**
         * The NID of the immediate sender. If the request has been forwarded
         * by routers, this is the NID of the last hop; otherwise it's the
         * same as the source.
         */
-       lnet_nid_t          sender;
+       struct lnet_nid sender;
        /** Indicates the type of the event. */
        enum lnet_event_kind    type;
        /** The portal table index specified in the request */
-       unsigned int        pt_index;
+       unsigned int            pt_index;
        /** A copy of the match bits specified in the request. */
-       __u64               match_bits;
+       __u64                   match_bits;
        /** The length (in bytes) specified in the request. */
-       unsigned int        rlength;
+       unsigned int            rlength;
        /**
         * The length (in bytes) of the data that was manipulated by the
         * operation. For truncated operations, the manipulated length will be
@@ -543,7 +543,7 @@ struct lnet_event {
         * see struct lnet_md). For all other operations, the manipulated length
         * will be the length of the requested operation, i.e. rlength.
         */
-       unsigned int        mlength;
+       unsigned int            mlength;
        /**
         * The handle to the MD associated with the event. The handle may be
         * invalid if the MD has been unlinked.
@@ -560,36 +560,36 @@ struct lnet_event {
         * 64 bits of out-of-band user data. Only valid for LNET_EVENT_PUT.
         * \see LNetPut
         */
-       __u64               hdr_data;
+       __u64                   hdr_data;
        /**
         * The message type, to ensure a handler for LNET_EVENT_SEND can
         * distinguish between LNET_MSG_GET and LNET_MSG_PUT.
         */
-       __u32               msg_type;
+       __u32                   msg_type;
        /**
         * Indicates the completion status of the operation. It's 0 for
         * successful operations, otherwise it's an error code.
         */
-       int                 status;
+       int                     status;
        /**
         * Indicates whether the MD has been unlinked. Note that:
         * - An event with unlinked set is the last event on the MD.
         * - This field is also set for an explicit LNET_EVENT_UNLINK event.
         * \see LNetMDUnlink
         */
-       int                 unlinked;
+       int                     unlinked;
        /**
         * The displacement (in bytes) into the memory region that the
         * operation used. The offset can be determined by the operation for
         * a remote managed MD or by the local MD.
         * \see struct lnet_md::options
         */
-       unsigned int        offset;
+       unsigned int            offset;
        /**
         * The sequence number for this event. Sequence numbers are unique
         * to each event.
         */
-       volatile unsigned long sequence;
+       volatile unsigned long  sequence;
 };
 
 /** \addtogroup lnet_data
index 7598c8d..b130c11 100644 (file)
@@ -4376,7 +4376,7 @@ LNetCtl(unsigned int cmd, void *arg)
                        return rc;
 
                mutex_lock(&the_lnet.ln_api_mutex);
-               lp = lnet_find_peer(ping->ping_id.nid);
+               lp = lnet_find_peer4(ping->ping_id.nid);
                if (lp) {
                        ping->ping_id.nid =
                                lnet_nid_to_nid4(&lp->lp_primary_nid);
@@ -4400,7 +4400,7 @@ LNetCtl(unsigned int cmd, void *arg)
                        return rc;
 
                mutex_lock(&the_lnet.ln_api_mutex);
-               lp = lnet_find_peer(discover->ping_id.nid);
+               lp = lnet_find_peer4(discover->ping_id.nid);
                if (lp) {
                        discover->ping_id.nid =
                                lnet_nid_to_nid4(&lp->lp_primary_nid);
@@ -4530,9 +4530,9 @@ LNetCtl(unsigned int cmd, void *arg)
 }
 EXPORT_SYMBOL(LNetCtl);
 
-void LNetDebugPeer(struct lnet_process_id id)
+void LNetDebugPeer(struct lnet_processid *id)
 {
-       lnet_debug_peer(id.nid);
+       lnet_debug_peer(lnet_nid_to_nid4(&id->nid));
 }
 EXPORT_SYMBOL(LNetDebugPeer);
 
index 65544bd..290b78f 100644 (file)
@@ -68,25 +68,25 @@ lnet_build_msg_event(struct lnet_msg *msg, enum lnet_event_kind ev_type)
 
        if (ev_type == LNET_EVENT_SEND) {
                /* event for active message */
-               ev->target.nid    = le64_to_cpu(hdr->dest_nid);
+               lnet_nid4_to_nid(le64_to_cpu(hdr->dest_nid), &ev->target.nid);
                ev->target.pid    = le32_to_cpu(hdr->dest_pid);
-               ev->initiator.nid = LNET_NID_ANY;
+               ev->initiator.nid = LNET_ANY_NID;
                ev->initiator.pid = the_lnet.ln_pid;
-               ev->source.nid    = LNET_NID_ANY;
+               ev->source.nid    = LNET_ANY_NID;
                ev->source.pid    = the_lnet.ln_pid;
-               ev->sender        = LNET_NID_ANY;
+               ev->sender        = LNET_ANY_NID;
        } else {
                /* event for passive message */
                ev->target.pid    = hdr->dest_pid;
-               ev->target.nid    = hdr->dest_nid;
+               lnet_nid4_to_nid(hdr->dest_nid, &ev->target.nid);
                ev->initiator.pid = hdr->src_pid;
                /* Multi-Rail: resolve src_nid to "primary" peer NID */
-               ev->initiator.nid = lnet_nid_to_nid4(&msg->msg_initiator);
+               ev->initiator.nid = msg->msg_initiator;
                /* Multi-Rail: track source NID. */
                ev->source.pid    = hdr->src_pid;
-               ev->source.nid    = hdr->src_nid;
-               ev->rlength       = hdr->payload_length;
-               ev->sender        = lnet_nid_to_nid4(&msg->msg_from);
+               lnet_nid4_to_nid(hdr->src_nid, &ev->source.nid);
+               ev->rlength       = hdr->payload_length;
+               ev->sender        = msg->msg_from;
                ev->mlength       = msg->msg_wanted;
                ev->offset        = msg->msg_offset;
        }
@@ -373,7 +373,6 @@ lnet_complete_msg_locked(struct lnet_msg *msg, int cpt)
 
        if (status == 0 && msg->msg_ack) {
                /* Only send an ACK if the PUT completed successfully */
-               struct lnet_nid src;
 
                lnet_msg_decommit(msg, cpt, 0);
 
@@ -385,14 +384,15 @@ 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, msg->msg_ev.source, 0, 0);
+               lnet_prep_send(msg, LNET_MSG_ACK,
+                              lnet_pid_to_pid4(&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;
                msg->msg_hdr.msg.ack.mlength = cpu_to_le32(msg->msg_ev.mlength);
 
-               lnet_nid4_to_nid(msg->msg_ev.target.nid, &src);
-               rc = lnet_send(&src, msg, &msg->msg_from);
+               rc = lnet_send(&msg->msg_ev.target.nid, msg,
+                              &msg->msg_from);
 
                lnet_net_lock(cpt);
                /*
index 5d7d511..b126515 100644 (file)
@@ -776,7 +776,7 @@ lnet_peer_ni_get_locked(struct lnet_peer *lp, struct lnet_nid *nid)
 }
 
 struct lnet_peer *
-lnet_find_peer(lnet_nid_t nid)
+lnet_find_peer4(lnet_nid_t nid)
 {
        struct lnet_peer_ni *lpni;
        struct lnet_peer *lp = NULL;
@@ -794,6 +794,25 @@ lnet_find_peer(lnet_nid_t nid)
        return lp;
 }
 
+struct lnet_peer *
+lnet_find_peer(struct lnet_nid *nid)
+{
+       struct lnet_peer_ni *lpni;
+       struct lnet_peer *lp = NULL;
+       int cpt;
+
+       cpt = lnet_net_lock_current();
+       lpni = lnet_peer_ni_find_locked(nid);
+       if (lpni) {
+               lp = lpni->lpni_peer_net->lpn_peer;
+               lnet_peer_addref_locked(lp);
+               lnet_peer_ni_decref_locked(lpni);
+       }
+       lnet_net_unlock(cpt);
+
+       return lp;
+}
+
 struct lnet_peer_net *
 lnet_get_next_peer_net_locked(struct lnet_peer *lp, __u32 prev_lpn_id)
 {
@@ -2333,11 +2352,11 @@ void lnet_peer_push_event(struct lnet_event *ev)
        pbuf = LNET_PING_INFO_TO_BUFFER(ev->md_start + ev->offset);
 
        /* lnet_find_peer() adds a refcount */
-       lp = lnet_find_peer(ev->source.nid);
+       lp = lnet_find_peer(&ev->source.nid);
        if (!lp) {
                CDEBUG(D_NET, "Push Put from unknown %s (source %s). Ignoring...\n",
-                      libcfs_nid2str(ev->initiator.nid),
-                      libcfs_nid2str(ev->source.nid));
+                      libcfs_nidstr(&ev->initiator.nid),
+                      libcfs_nidstr(&ev->source.nid));
                pbuf->pb_needs_post = true;
                return;
        }
@@ -2356,7 +2375,7 @@ void lnet_peer_push_event(struct lnet_event *ev)
                CDEBUG(D_NET, "Push Put error %d from %s (source %s)\n",
                       ev->status,
                       libcfs_nidstr(&lp->lp_primary_nid),
-                      libcfs_nid2str(ev->source.nid));
+                      libcfs_nidstr(&ev->source.nid));
                goto out;
        }
 
@@ -2661,8 +2680,8 @@ lnet_discovery_event_reply(struct lnet_peer *lp, struct lnet_event *ev)
 
        spin_lock(&lp->lp_lock);
 
-       lnet_nid4_to_nid(ev->target.nid, &lp->lp_disc_src_nid);
-       lnet_nid4_to_nid(ev->source.nid, &lp->lp_disc_dst_nid);
+       lp->lp_disc_src_nid = ev->target.nid;
+       lp->lp_disc_dst_nid = ev->source.nid;
 
        /*
         * If some kind of error happened the contents of message
@@ -2674,7 +2693,7 @@ lnet_discovery_event_reply(struct lnet_peer *lp, struct lnet_event *ev)
                CDEBUG(D_NET, "Ping Reply error %d from %s (source %s)\n",
                       ev->status,
                       libcfs_nidstr(&lp->lp_primary_nid),
-                      libcfs_nid2str(ev->source.nid));
+                      libcfs_nidstr(&ev->source.nid));
                goto out;
        }
 
@@ -2861,7 +2880,7 @@ lnet_discovery_event_send(struct lnet_peer *lp, struct lnet_event *ev)
 out:
        CDEBUG(D_NET, "%s Send to %s: %d\n",
                (ev->msg_type == LNET_MSG_GET ? "Ping" : "Push"),
-               libcfs_nid2str(ev->target.nid), rc);
+               libcfs_nidstr(&ev->target.nid), rc);
        return rc;
 }
 
@@ -4060,7 +4079,7 @@ int lnet_get_peer_info(struct lnet_ioctl_peer_cfg *cfg, void __user *bulk)
        __u32 size;
        int rc;
 
-       lp = lnet_find_peer(cfg->prcfg_prim_nid);
+       lp = lnet_find_peer4(cfg->prcfg_prim_nid);
 
        if (!lp) {
                rc = -ENOENT;
index 85288d3..6d00c1f 100644 (file)
@@ -1490,8 +1490,8 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
 
                buffer = container_of(ev->md_start, struct srpc_buffer,
                                      buf_msg);
-               buffer->buf_peer = ev->source;
-               buffer->buf_self = ev->target.nid;
+               buffer->buf_peer = lnet_pid_to_pid4(&ev->source);
+               buffer->buf_self = lnet_nid_to_nid4(&ev->target.nid);
 
                LASSERT(scd->scd_buf_nposted > 0);
                scd->scd_buf_nposted--;
@@ -1529,7 +1529,7 @@ srpc_lnet_ev_handler(struct lnet_event *ev)
                    (msg->msg_magic != SRPC_MSG_MAGIC &&
                     msg->msg_magic != __swab32(SRPC_MSG_MAGIC))) {
                        CERROR("Dropping RPC (%s) from %s: status %d mlength %d type %u magic %u.\n",
-                              sv->sv_name, libcfs_id2str(ev->initiator),
+                              sv->sv_name, libcfs_idstr(&ev->initiator),
                               ev->status, ev->mlength,
                               msg->msg_type, msg->msg_magic);
 
index ab01d7e..3137ccf 100644 (file)
@@ -145,7 +145,7 @@ struct mgs_export_data {
  * It tracks access patterns to this export on a per-client-NID basis
  */
 struct nid_stat {
-       lnet_nid_t               nid;
+       struct lnet_nid          nid;
        struct hlist_node        nid_hash;
        struct list_head         nid_list;
        struct obd_device       *nid_obd;
index 1b6d96b..fa7617c 100644 (file)
@@ -532,22 +532,22 @@ struct ptlrpc_connection {
        /** linkage for connections hash table */
        struct rhash_head       c_hash;
        /** Our own lnet nid for this connection */
-       lnet_nid_t              c_self;
+       struct lnet_nid         c_self;
        /** Remote side nid for this connection */
-       struct lnet_process_id       c_peer;
+       struct lnet_processid   c_peer;
        /** UUID of the other side */
-       struct obd_uuid         c_remote_uuid;
+       struct obd_uuid         c_remote_uuid;
        /** reference counter for this connection */
-       atomic_t            c_refcount;
+       atomic_t                c_refcount;
 };
 
 /** Client definition for PortalRPC */
 struct ptlrpc_client {
-        /** What lnet portal does this client send messages to by default */
-        __u32                   cli_request_portal;
-        /** What portal do we expect replies on */
-        __u32                   cli_reply_portal;
-        /** Name of the client */
+       /** What lnet portal does this client send messages to by default */
+       __u32                   cli_request_portal;
+       /** What portal do we expect replies on */
+       __u32                   cli_reply_portal;
+       /** Name of the client */
        const char              *cli_name;
 };
 
@@ -1940,7 +1940,7 @@ static inline void  ptlrpc_connection_put(struct ptlrpc_connection *conn)
 
        CDEBUG(D_INFO, "PUT conn=%p refcount %d to %s\n",
               conn, atomic_read(&conn->c_refcount),
-              libcfs_nid2str(conn->c_peer.nid));
+              libcfs_nidstr(&conn->c_peer.nid));
 }
 
 struct ptlrpc_connection *ptlrpc_connection_addref(struct ptlrpc_connection *);
@@ -1966,10 +1966,10 @@ static inline bool ptlrpc_connection_is_local(struct ptlrpc_connection *conn)
        if (!conn)
                return false;
 
-       if (conn->c_peer.nid == conn->c_self)
+       if (nid_same(&conn->c_peer.nid, &conn->c_self))
                return true;
 
-       RETURN(LNetIsPeerLocal(conn->c_peer.nid));
+       RETURN(LNetIsPeerLocal(lnet_nid_to_nid4(&conn->c_peer.nid)));
 }
 
 /* ptlrpc/niobuf.c */
index 5e53d4e..b70563c 100644 (file)
@@ -372,12 +372,12 @@ static inline void sptlrpc_rule_set_init(struct sptlrpc_rule_set *set)
 void sptlrpc_rule_set_free(struct sptlrpc_rule_set *set);
 int  sptlrpc_rule_set_expand(struct sptlrpc_rule_set *set);
 int  sptlrpc_rule_set_merge(struct sptlrpc_rule_set *set,
-                            struct sptlrpc_rule *rule);
+                           struct sptlrpc_rule *rule);
 int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
-                            enum lustre_sec_part from,
-                            enum lustre_sec_part to,
-                            lnet_nid_t nid,
-                            struct sptlrpc_flavor *sf);
+                           enum lustre_sec_part from,
+                           enum lustre_sec_part to,
+                           lnet_nid_t nid,
+                           struct sptlrpc_flavor *sf);
 void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *set);
 
 int  sptlrpc_process_config(struct lustre_cfg *lcfg);
@@ -389,9 +389,9 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd);
 int  sptlrpc_conf_target_get_rules(struct obd_device *obd,
                                   struct sptlrpc_rule_set *rset);
 void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
-                                  enum lustre_sec_part from,
-                                  lnet_nid_t nid,
-                                  struct sptlrpc_flavor *flavor);
+                                 enum lustre_sec_part from,
+                                 lnet_nid_t nid,
+                                 struct sptlrpc_flavor *flavor);
 
 /* The maximum length of security payload. 1024 is enough for Kerberos 5,
  * and should be enough for other future mechanisms but not sure.
index d9c014e..f0a762b 100644 (file)
@@ -770,7 +770,7 @@ void obd_uuid_del(struct obd_device *obd, struct obd_export *export);
 struct obd_export *obd_uuid_lookup(struct obd_device *obd,
                                   struct obd_uuid *uuid);
 
-int obd_nid_export_for_each(struct obd_device *obd, lnet_nid_t nid,
+int obd_nid_export_for_each(struct obd_device *obd, struct lnet_nid *nid,
                            int cb(struct obd_export *exp, void *data),
                            void *data);
 int obd_nid_add(struct obd_device *obd, struct obd_export *exp);
index bbb571b..06658d2 100644 (file)
@@ -101,13 +101,13 @@ int class_notify_sptlrpc_conf(const char *fsname, int namelen);
 static inline char *obd_export_nid2str(struct obd_export *exp)
 {
        return exp->exp_connection == NULL ?
-              "<unknown>" : libcfs_nid2str(exp->exp_connection->c_peer.nid);
+              "<unknown>" : libcfs_nidstr(&exp->exp_connection->c_peer.nid);
 }
 
 static inline char *obd_import_nid2str(struct obd_import *imp)
 {
        return imp->imp_connection == NULL ?
-              "<unknown>" : libcfs_nid2str(imp->imp_connection->c_peer.nid);
+              "<unknown>" : libcfs_nidstr(&imp->imp_connection->c_peer.nid);
 }
 
 int obd_export_evict_by_nid(struct obd_device *obd, const char *nid);
index 76b2487..b83dde8 100644 (file)
@@ -215,7 +215,7 @@ ldlm_flock_deadlock(struct ldlm_lock *req, struct ldlm_lock *bl_lock)
                        int found;
 
                        found = obd_nid_export_for_each(bl_exp->exp_obd,
-                                                       bl_exp_conn->c_peer.nid,
+                                                       &bl_exp_conn->c_peer.nid,
                                                        ldlm_flock_lookup_cb,
                                                        &cb_data);
                        if (found)
@@ -241,8 +241,8 @@ ldlm_flock_deadlock(struct ldlm_lock *req, struct ldlm_lock *bl_lock)
                        break;
 
                if (bl_owner == req_owner &&
-                   (bl_exp_conn->c_peer.nid ==
-                    req_exp->exp_connection->c_peer.nid)) {
+                   nid_same(&bl_exp_conn->c_peer.nid,
+                             &req_exp->exp_connection->c_peer.nid)) {
                        class_export_put(bl_exp);
                        return 1;
                }
index 5030c14..aacf22f 100644 (file)
@@ -72,7 +72,7 @@ static int import_set_conn(struct obd_import *imp, struct obd_uuid *uuid,
        if (imp->imp_connection &&
            imp->imp_connection->c_remote_uuid.uuid[0] == 0)
                /* nid4refnet is used to restrict network connections */
-               nid4refnet = imp->imp_connection->c_self;
+               nid4refnet = lnet_nid_to_nid4(&imp->imp_connection->c_self);
        ptlrpc_conn = ptlrpc_uuid_to_connection(uuid, nid4refnet);
        if (!ptlrpc_conn) {
                CDEBUG(D_HA, "can't find connection %s\n", uuid->uuid);
@@ -325,7 +325,7 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
        const char *name = obd->obd_type->typ_name;
        enum ldlm_ns_type ns_type = LDLM_NS_TYPE_UNKNOWN;
        char *cli_name = lustre_cfg_buf(lcfg, 0);
-       struct ptlrpc_connection fake_conn = { .c_self = 0,
+       struct ptlrpc_connection fake_conn = { .c_self = {},
                                               .c_remote_uuid.uuid[0] = 0 };
        int rc;
 
@@ -548,7 +548,7 @@ int client_obd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                               rc);
                        GOTO(err_import, rc);
                }
-               fake_conn.c_self = LNET_MKNID(refnet, 0);
+               lnet_nid4_to_nid(LNET_MKNID(refnet, 0), &fake_conn.c_self);
                imp->imp_connection = &fake_conn;
        }
 
@@ -1269,13 +1269,14 @@ int target_handle_connect(struct ptlrpc_request *req)
        } else if ((mds_conn || (lw_client && initial_conn) ||
                   OCD_HAS_FLAG(data, MDS_MDS)) && export->exp_connection) {
                spin_unlock(&export->exp_lock);
-               if (req->rq_peer.nid != export->exp_connection->c_peer.nid) {
+               if (req->rq_peer.nid !=
+                   lnet_nid_to_nid4(&export->exp_connection->c_peer.nid)) {
                        /* MDS or LWP reconnected after failover. */
                        LCONSOLE_WARN("%s: Received %s connection from %s, removing former export from %s\n",
                                      target->obd_name,
                                      lw_client ? "LWP" : "MDS",
                                      libcfs_nid2str(req->rq_peer.nid),
-                                     libcfs_nid2str(export->exp_connection->c_peer.nid));
+                                     libcfs_nidstr(&export->exp_connection->c_peer.nid));
                } else {
                        /* New connection from the same NID. */
                        LCONSOLE_WARN("%s: Received new %s connection from %s, %s former export from same NID\n",
@@ -1286,7 +1287,8 @@ int target_handle_connect(struct ptlrpc_request *req)
                                      "keep" : "remove");
                }
 
-               if (req->rq_peer.nid == export->exp_connection->c_peer.nid &&
+               if (req->rq_peer.nid ==
+                   lnet_nid_to_nid4(&export->exp_connection->c_peer.nid) &&
                    OCD_HAS_FLAG(data, MDS_MDS)) {
                        /*
                         * Because exports between MDTs will always be
@@ -1308,14 +1310,14 @@ int target_handle_connect(struct ptlrpc_request *req)
                        rc = 0;
                }
        } else if (export->exp_connection != NULL && initial_conn &&
-                  req->rq_peer.nid != export->exp_connection->c_peer.nid) {
+                  req->rq_peer.nid != lnet_nid_to_nid4(&export->exp_connection->c_peer.nid)) {
                spin_unlock(&export->exp_lock);
                /* In MDS failover we have static UUID but NID can change. */
                LCONSOLE_WARN("%s: Client %s seen on new nid %s when existing nid %s is already connected\n",
                              target->obd_name, cluuid.uuid,
                              libcfs_nid2str(req->rq_peer.nid),
-                             libcfs_nid2str(
-                                       export->exp_connection->c_peer.nid));
+                             libcfs_nidstr(
+                                     &export->exp_connection->c_peer.nid));
                rc = -EALREADY;
                class_export_put(export);
                export = NULL;
@@ -1503,7 +1505,8 @@ dont_check_exports:
 
        /* Check to see if connection came from another NID. */
        if (export->exp_connection != NULL &&
-           export->exp_connection->c_peer.nid != req->rq_peer.nid) {
+           lnet_nid_to_nid4(&export->exp_connection->c_peer.nid) !=
+           req->rq_peer.nid) {
                obd_nid_del(export->exp_obd, export);
                ptlrpc_connection_put(export->exp_connection);
                export->exp_connection = NULL;
index 03ca051..f82df7d 100644 (file)
@@ -679,14 +679,14 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
                                 struct ptlrpc_request *req, int rc,
                                 const char *ast_type)
 {
-       struct lnet_process_id peer = req->rq_import->imp_connection->c_peer;
+       struct lnet_processid *peer = &req->rq_import->imp_connection->c_peer;
 
        if (!req->rq_replied || (rc && rc != -EINVAL)) {
                if (ldlm_is_cancel(lock)) {
                        LDLM_DEBUG(lock,
                                   "%s AST (req@%p x%llu) timeout from nid %s, but cancel was received (AST reply lost?)",
                                   ast_type, req, req->rq_xid,
-                                  libcfs_nid2str(peer.nid));
+                                  libcfs_nidstr(&peer->nid));
                        ldlm_lock_cancel(lock);
                        rc = -ERESTART;
                } else if (rc == -ENODEV || rc == -ESHUTDOWN ||
@@ -710,7 +710,7 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
                } else {
                        LDLM_ERROR(lock,
                                   "client (nid %s) %s %s AST (req@%p x%llu status %d rc %d), evict it",
-                                  libcfs_nid2str(peer.nid),
+                                  libcfs_nidstr(&peer->nid),
                                   req->rq_replied ? "returned error from" :
                                   "failed to reply to",
                                   ast_type, req, req->rq_xid,
@@ -727,7 +727,7 @@ static int ldlm_handle_ast_error(struct ldlm_lock *lock,
 
                LDLM_DEBUG(lock,
                           "client (nid %s) returned %d from %s AST (req@%p x%llu) - normal race",
-                          libcfs_nid2str(peer.nid),
+                          libcfs_nidstr(&peer->nid),
                           req->rq_repmsg ?
                           lustre_msg_get_status(req->rq_repmsg) : -1,
                           ast_type, req, req->rq_xid);
index 23bcfda..cee372d 100644 (file)
@@ -1388,7 +1388,7 @@ int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *cancels,
                if (rc == LUSTRE_ESTALE) {
                        CDEBUG(D_DLMTRACE,
                               "client/server (nid %s) out of sync -- not fatal\n",
-                              libcfs_nid2str(req->rq_import->imp_connection->c_peer.nid));
+                              libcfs_nidstr(&req->rq_import->imp_connection->c_peer.nid));
                        rc = 0;
                } else if (rc == -ETIMEDOUT && /* check there was no reconnect*/
                           req->rq_import_generation == imp->imp_generation) {
index 89700bb..0fc378b 100644 (file)
@@ -142,7 +142,8 @@ static void ucred_set_jobid(struct mdt_thread_info *info, struct lu_ucred *uc)
 static void ucred_set_nid(struct mdt_thread_info *info, struct lu_ucred *uc)
 {
        if (info && info->mti_exp && info->mti_exp->exp_connection)
-               uc->uc_nid = info->mti_exp->exp_connection->c_peer.nid;
+               uc->uc_nid = lnet_nid_to_nid4(
+                       &info->mti_exp->exp_connection->c_peer.nid);
        else
                uc->uc_nid = LNET_NID_ANY;
 }
index e90d528..8dc4597 100644 (file)
@@ -1471,7 +1471,7 @@ static int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
 {
        struct nid_stat *stats = seq->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_mdt_print_open_files, seq);
 }
 
index 13d1b6b..b5bddd0 100644 (file)
@@ -1633,7 +1633,8 @@ static int mgc_process_recover_nodemap_log(struct obd_device *obd,
        mgc_conn = class_exp2cliimp(cld->cld_mgcexp)->imp_connection;
 
        /* don't need to get local config */
-       if (cld_is_nodemap(cld) && LNetIsPeerLocal(mgc_conn->c_peer.nid))
+       if (cld_is_nodemap(cld) &&
+           LNetIsPeerLocal(lnet_nid_to_nid4(&mgc_conn->c_peer.nid)))
                GOTO(out, rc = 0);
 
        /* allocate buffer for bulk transfer.
index d20dcec..3960f9e 100644 (file)
@@ -1547,7 +1547,7 @@ static int only_mgs_is_running(struct obd_device *mgs_obd)
                if (num_exports > 1)
                        CERROR("%s: node %s still connected during replace_nids connect_flags:%llx\n",
                               mgs_obd->obd_name,
-                              libcfs_nid2str(exp->exp_nid_stats->nid),
+                              libcfs_nidstr(&exp->exp_nid_stats->nid),
                               exp_connect_flags(exp));
        }
        spin_unlock(&mgs_obd->obd_dev_lock);
index 2553a2e..5f3edde 100644 (file)
@@ -1641,10 +1641,12 @@ static int take_first(struct obd_export *exp, void *data)
 
 int obd_export_evict_by_nid(struct obd_device *obd, const char *nid)
 {
-       lnet_nid_t nid_key = libcfs_str2nid((char *)nid);
+       struct lnet_nid nid_key;
        struct obd_export *doomed_exp;
        int exports_evicted = 0;
 
+       libcfs_strnid(&nid_key, nid);
+
        spin_lock(&obd->obd_dev_lock);
        /* umount has run already, so evict thread should leave
         * its task to umount thread now */
@@ -1655,7 +1657,7 @@ int obd_export_evict_by_nid(struct obd_device *obd, const char *nid)
        spin_unlock(&obd->obd_dev_lock);
 
        doomed_exp = NULL;
-       while (obd_nid_export_for_each(obd, nid_key,
+       while (obd_nid_export_for_each(obd, &nid_key,
                                       take_first, &doomed_exp) > 0) {
 
                LASSERTF(doomed_exp != obd->obd_self_export,
index 1d5b9b9..0131691 100644 (file)
@@ -818,14 +818,14 @@ static void lprocfs_import_seq_show_locked(struct seq_file *m,
        spin_lock(&imp->imp_lock);
        j = 0;
        list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
-               libcfs_nid2str_r(conn->oic_conn->c_peer.nid,
-                                nidstr, sizeof(nidstr));
+               libcfs_nidstr_r(&conn->oic_conn->c_peer.nid,
+                                 nidstr, sizeof(nidstr));
                seq_printf(m, "%s%s", j ? ", " : "", nidstr);
                j++;
        }
        if (imp->imp_connection)
-               libcfs_nid2str_r(imp->imp_connection->c_peer.nid,
-                                nidstr, sizeof(nidstr));
+               libcfs_nidstr_r(&imp->imp_connection->c_peer.nid,
+                                 nidstr, sizeof(nidstr));
        else
                strncpy(nidstr, "<none>", sizeof(nidstr));
        seq_printf(m, " ]\n"
index 9a30639..afdcb51 100644 (file)
@@ -270,7 +270,7 @@ static int lprocfs_exp_export_seq_show(struct seq_file *m, void *data)
 {
        struct nid_stat *stats = m->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_exp_print_export_seq, m);
 }
 LPROC_SEQ_FOPS_RO(lprocfs_exp_export);
@@ -281,7 +281,7 @@ static void lprocfs_free_client_stats(struct nid_stat *client_stat)
               client_stat->nid_proc, client_stat->nid_stats);
 
        LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
-                "nid %s:count %d\n", libcfs_nid2str(client_stat->nid),
+                "nid %s:count %d\n", libcfs_nidstr(&client_stat->nid),
                 atomic_read(&client_stat->nid_exp_ref_count));
 
        if (client_stat->nid_proc)
@@ -331,7 +331,7 @@ lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
 {
        struct nid_stat *stats = m->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_exp_print_nodemap_seq, m);
 }
 LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap);
@@ -350,7 +350,7 @@ static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
 {
        struct nid_stat *stats = m->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_exp_print_uuid_seq, m);
 }
 LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
@@ -412,7 +412,7 @@ static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
 {
        struct nid_stat *stats = m->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_exp_print_hash_seq, m);
 }
 LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
@@ -438,7 +438,7 @@ int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data)
 {
        struct nid_stat *stats = m->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_exp_print_replydata_seq, m);
 }
 LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
@@ -457,7 +457,7 @@ int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data)
 {
        struct nid_stat *stats = m->private;
 
-       return obd_nid_export_for_each(stats->nid_obd, stats->nid,
+       return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
                                       lprocfs_exp_print_fmd_count_seq, m);
 }
 LPROC_SEQ_FOPS_RO(lprocfs_exp_fmd_count);
@@ -547,13 +547,14 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
        if (new_stat == NULL)
                RETURN(-ENOMEM);
 
-       new_stat->nid     = *nid;
+       lnet_nid4_to_nid(*nid, &new_stat->nid);
        new_stat->nid_obd = exp->exp_obd;
        /* we need set default refcount to 1 to balance obd_disconnect */
        atomic_set(&new_stat->nid_exp_ref_count, 1);
 
        old_stat = cfs_hash_findadd_unique(obd->obd_nid_stats_hash,
-                                          nid, &new_stat->nid_hash);
+                                          &new_stat->nid,
+                                          &new_stat->nid_hash);
        CDEBUG(D_INFO, "Found stats %p for nid %s - ref %d\n",
               old_stat, nidstr, atomic_read(&old_stat->nid_exp_ref_count));
 
@@ -650,7 +651,8 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid)
 destroy_new_ns:
        if (new_stat->nid_proc != NULL)
                lprocfs_remove(&new_stat->nid_proc);
-       cfs_hash_del(obd->obd_nid_stats_hash, nid, &new_stat->nid_hash);
+       cfs_hash_del(obd->obd_nid_stats_hash, &new_stat->nid,
+                    &new_stat->nid_hash);
 
 destroy_new:
        nidstat_putref(new_stat);
index 113acc1..c450c07 100644 (file)
@@ -169,10 +169,10 @@ static u32 nid_keyhash(const void *data, u32 key_len, u32 seed)
 static int
 nid_keycmp(struct rhashtable_compare_arg *arg, const void *obj)
 {
-       const lnet_nid_t *nid = arg->key;
+       const struct lnet_nid *nid = arg->key;
        const struct obd_export *exp = obj;
 
-       if (exp->exp_connection->c_peer.nid == *nid)
+       if (nid_same(&exp->exp_connection->c_peer.nid, nid))
                return 0;
 
        return -ESRCH;
@@ -187,7 +187,7 @@ nid_export_exit(void *vexport, void *data)
 }
 
 static const struct rhashtable_params nid_hash_params = {
-       .key_len                = sizeof(lnet_nid_t),
+       .key_len                = sizeof(struct lnet_nid),
        .head_offset            = offsetof(struct obd_export, exp_nid_hash),
        .obj_hashfn             = nid_keyhash,
        .obj_cmpfn              = nid_keycmp,
@@ -233,7 +233,7 @@ void obd_nid_del(struct obd_device *obd, struct obd_export *exp)
 }
 EXPORT_SYMBOL(obd_nid_del);
 
-int obd_nid_export_for_each(struct obd_device *obd, lnet_nid_t nid,
+int obd_nid_export_for_each(struct obd_device *obd, struct lnet_nid *nid,
                            int cb(struct obd_export *exp, void *data),
                            void *data)
 {
@@ -242,7 +242,7 @@ int obd_nid_export_for_each(struct obd_device *obd, lnet_nid_t nid,
        int ret = 0;
 
        rcu_read_lock();
-       exports = rhltable_lookup(&obd->obd_nid_hash, &nid, nid_hash_params);
+       exports = rhltable_lookup(&obd->obd_nid_hash, nid, nid_hash_params);
        if (!exports) {
                ret = -ENODEV;
                goto out_unlock;
@@ -2352,7 +2352,7 @@ EXPORT_SYMBOL(class_manual_cleanup);
 static unsigned
 nidstats_hash(struct cfs_hash *hs, const void *key, unsigned int mask)
 {
-       return cfs_hash_djb2_hash(key, sizeof(lnet_nid_t), mask);
+       return cfs_hash_djb2_hash(key, sizeof(struct lnet_nid), mask);
 }
 
 static void *
@@ -2368,7 +2368,8 @@ nidstats_key(struct hlist_node *hnode)
 static int
 nidstats_keycmp(const void *key, struct hlist_node *hnode)
 {
-       return *(lnet_nid_t *)nidstats_key(hnode) == *(lnet_nid_t *)key;
+       return nid_same((struct lnet_nid *)nidstats_key(hnode),
+                        (struct lnet_nid *)key);
 }
 
 static void *
@@ -2396,15 +2397,14 @@ nidstats_put_locked(struct cfs_hash *hs, struct hlist_node *hnode)
 }
 
 static struct cfs_hash_ops nid_stat_hash_ops = {
-       .hs_hash        = nidstats_hash,
-       .hs_key         = nidstats_key,
-       .hs_keycmp      = nidstats_keycmp,
-       .hs_object      = nidstats_object,
-       .hs_get         = nidstats_get,
-       .hs_put_locked  = nidstats_put_locked,
+       .hs_hash        = nidstats_hash,
+       .hs_key         = nidstats_key,
+       .hs_keycmp      = nidstats_keycmp,
+       .hs_object      = nidstats_object,
+       .hs_get         = nidstats_get,
+       .hs_put_locked  = nidstats_put_locked,
 };
 
-
 /*
  * client_generation<->export hash operations
  */
index b239a91..f426f8a 100644 (file)
@@ -1878,7 +1878,7 @@ static void dump_all_bulk_pages(struct obdo *oa, __u32 page_count,
 }
 
 static int
-check_write_checksum(struct obdo *oa, const struct lnet_process_id *peer,
+check_write_checksum(struct obdo *oa, const struct lnet_processid *peer,
                     __u32 client_cksum, __u32 server_cksum,
                     struct osc_brw_async_args *aa)
 {
@@ -1951,7 +1951,7 @@ check_write_checksum(struct obdo *oa, const struct lnet_process_id *peer,
                           DFID " object "DOSTID" extent [%llu-%llu], original "
                           "client csum %x (type %x), server csum %x (type %x),"
                           " client csum now %x\n",
-                          obd_name, msg, libcfs_nid2str(peer->nid),
+                          obd_name, msg, libcfs_nidstr(&peer->nid),
                           oa->o_valid & OBD_MD_FLFID ? oa->o_parent_seq : (__u64)0,
                           oa->o_valid & OBD_MD_FLFID ? oa->o_parent_oid : 0,
                           oa->o_valid & OBD_MD_FLFID ? oa->o_parent_ver : 0,
@@ -1970,7 +1970,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc)
        struct osc_brw_async_args *aa = (void *)&req->rq_async_args;
        struct client_obd *cli = aa->aa_cli;
        const char *obd_name = cli->cl_import->imp_obd->obd_name;
-       const struct lnet_process_id *peer =
+       const struct lnet_processid *peer =
                &req->rq_import->imp_connection->c_peer;
        struct ost_body *body;
        u32 client_cksum = 0;
@@ -2110,7 +2110,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc)
                        GOTO(out, rc);
 
                if (req->rq_bulk != NULL &&
-                   peer->nid != req->rq_bulk->bd_sender) {
+                   lnet_nid_to_nid4(&peer->nid) != req->rq_bulk->bd_sender) {
                        via = " via ";
                        router = libcfs_nid2str(req->rq_bulk->bd_sender);
                }
@@ -2135,7 +2135,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc)
                                           " extent [%llu-%llu], client %x/%x, "
                                           "server %x, cksum_type %x\n",
                                           obd_name,
-                                          libcfs_nid2str(peer->nid),
+                                          libcfs_nidstr(&peer->nid),
                                           via, router,
                                           clbody->oa.o_valid & OBD_MD_FLFID ?
                                                clbody->oa.o_parent_seq : 0ULL,
@@ -2164,7 +2164,7 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc)
                if ((cksum_missed & (-cksum_missed)) == cksum_missed)
                        CERROR("%s: checksum %u requested from %s but not sent\n",
                               obd_name, cksum_missed,
-                              libcfs_nid2str(peer->nid));
+                              libcfs_nidstr(&peer->nid));
        } else {
                rc = 0;
        }
index 08022c3..ea42715 100644 (file)
@@ -1117,12 +1117,13 @@ static int osp_send_update_req(const struct lu_env *env,
        LASSERT(oth != NULL);
 
        if (ou && ou->ou_generation != our->our_generation) {
-               const struct lnet_process_id *peer =
-                       &osp->opd_obd->u.cli.cl_import->imp_connection->c_peer;
+               const struct lnet_processid *peer;
+
                rc = -ESTALE;
                osp_trans_callback(env, oth, rc);
+               peer = &osp->opd_obd->u.cli.cl_import->imp_connection->c_peer;
                CDEBUG(D_HA, "%s: stale tx to %s: gen %llu != %llu: rc = %d\n",
-                      osp->opd_obd->obd_name, libcfs_nid2str(peer->nid),
+                      osp->opd_obd->obd_name, libcfs_nidstr(&peer->nid),
                       osp->opd_update->ou_generation, our->our_generation, rc);
                RETURN(rc);
        }
index c08850f..5b74d89 100644 (file)
@@ -1350,7 +1350,7 @@ static int ptlrpc_check_status(struct ptlrpc_request *req)
        rc = lustre_msg_get_status(req->rq_repmsg);
        if (lustre_msg_get_type(req->rq_repmsg) == PTL_RPC_MSG_ERR) {
                struct obd_import *imp = req->rq_import;
-               lnet_nid_t nid = imp->imp_connection->c_peer.nid;
+               struct lnet_nid *nid = &imp->imp_connection->c_peer.nid;
                __u32 opc = lustre_msg_get_opc(req->rq_reqmsg);
 
                if (ptlrpc_console_allow(req, opc, rc))
@@ -1358,7 +1358,7 @@ static int ptlrpc_check_status(struct ptlrpc_request *req)
                                           "%s: operation %s to node %s failed: rc = %d\n",
                                           imp->imp_obd->obd_name,
                                           ll_opcode2str(opc),
-                                          libcfs_nid2str(nid), rc);
+                                          libcfs_nidstr(nid), rc);
                RETURN(rc < 0 ? rc : -EINVAL);
        }
 
@@ -2290,7 +2290,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink)
                  req->rq_sent, req->rq_real_sent);
 
        if (imp && obd_debug_peer_on_timeout)
-               LNetDebugPeer(imp->imp_connection->c_peer);
+               LNetDebugPeer(&imp->imp_connection->c_peer);
 
        ptlrpc_unregister_reply(req, async_unlink);
        ptlrpc_unregister_bulk(req, async_unlink);
index 72d2371..fe9cf6c 100644 (file)
@@ -48,20 +48,20 @@ static struct rhashtable conn_hash;
 
 static u32 lnet_process_id_hash(const void *data, u32 len, u32 seed)
 {
-       const struct lnet_process_id *lpi = data;
+       const struct lnet_processid *lpi = data;
 
        seed = cfs_hash_32(seed ^ lpi->pid, 32);
-       seed ^= cfs_hash_64(lpi->nid, 32);
+       seed = cfs_hash_32(nidhash(&lpi->nid) ^ seed, 32);
        return seed;
 }
 
 static int lnet_process_id_cmp(struct rhashtable_compare_arg *arg,
                               const void *obj)
 {
-       const struct lnet_process_id *lpi = arg->key;
+       const struct lnet_processid *lpi = arg->key;
        const struct ptlrpc_connection *con = obj;
 
-       if (lpi->nid == con->c_peer.nid &&
+       if (nid_same(&lpi->nid, &con->c_peer.nid) &&
            lpi->pid == con->c_peer.pid)
                return 0;
        return -ESRCH;
@@ -76,13 +76,15 @@ static const struct rhashtable_params conn_hash_params = {
 };
 
 struct ptlrpc_connection *
-ptlrpc_connection_get(struct lnet_process_id peer, lnet_nid_t self,
+ptlrpc_connection_get(struct lnet_process_id peer4, lnet_nid_t self,
                      struct obd_uuid *uuid)
 {
        struct ptlrpc_connection *conn, *conn2;
+       struct lnet_processid peer;
        ENTRY;
 
-       peer.nid = LNetPrimaryNID(peer.nid);
+       peer4.nid = LNetPrimaryNID(peer4.nid);
+       lnet_pid4_to_pid(peer4, &peer);
        conn = rhashtable_lookup_fast(&conn_hash, &peer, conn_hash_params);
        if (conn) {
                ptlrpc_connection_addref(conn);
@@ -94,7 +96,7 @@ ptlrpc_connection_get(struct lnet_process_id peer, lnet_nid_t self,
                RETURN(NULL);
 
        conn->c_peer = peer;
-       conn->c_self = self;
+       lnet_nid4_to_nid(self, &conn->c_self);
        atomic_set(&conn->c_refcount, 1);
        if (uuid)
                obd_str2uuid(&conn->c_remote_uuid, uuid->uuid);
@@ -127,7 +129,7 @@ try_again:
 out:
        CDEBUG(D_INFO, "conn=%p refcount %d to %s\n",
               conn, atomic_read(&conn->c_refcount),
-              libcfs_nid2str(conn->c_peer.nid));
+              libcfs_nidstr(&conn->c_peer.nid));
        return conn;
 }
 
@@ -139,7 +141,7 @@ ptlrpc_connection_addref(struct ptlrpc_connection *conn)
        atomic_inc(&conn->c_refcount);
        CDEBUG(D_INFO, "conn=%p refcount %d to %s\n",
               conn, atomic_read(&conn->c_refcount),
-              libcfs_nid2str(conn->c_peer.nid));
+              libcfs_nidstr(&conn->c_peer.nid));
 
        RETURN(conn);
 }
index 7d4a157..06e4aad 100644 (file)
@@ -219,7 +219,7 @@ void client_bulk_callback(struct lnet_event *ev)
 
        if (ev->type != LNET_EVENT_UNLINK && ev->status == 0) {
                desc->bd_nob_transferred += ev->mlength;
-               desc->bd_sender = ev->sender;
+               desc->bd_sender = lnet_nid_to_nid4(&ev->sender);
        } else {
                /* start reconnect and resend if network error hit */
                spin_lock(&req->rq_lock);
@@ -330,14 +330,13 @@ void request_in_callback(struct lnet_event *ev)
                if (ev->status != 0) /* We moaned above already... */
                        return;
                req = ptlrpc_request_cache_alloc(GFP_ATOMIC);
-                if (req == NULL) {
-                        CERROR("Can't allocate incoming request descriptor: "
-                               "Dropping %s RPC from %s\n",
-                               service->srv_name,
-                               libcfs_id2str(ev->initiator));
-                        return;
-                }
-        }
+               if (req == NULL) {
+                       CERROR("Can't allocate incoming request descriptor: Dropping %s RPC from %s\n",
+                               service->srv_name,
+                               libcfs_idstr(&ev->initiator));
+                       return;
+               }
+       }
 
        ptlrpc_srv_req_init(req);
        /* NB we ABSOLUTELY RELY on req being zeroed, so pointers are NULL,
@@ -349,9 +348,9 @@ void request_in_callback(struct lnet_event *ev)
                req->rq_reqdata_len = ev->mlength;
        ktime_get_real_ts64(&req->rq_arrival_time);
        /* Multi-Rail: keep track of both initiator and source NID. */
-       req->rq_peer = ev->initiator;
-       req->rq_source = ev->source;
-       req->rq_self = ev->target.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_rqbd = rqbd;
        req->rq_phase = RQ_PHASE_NEW;
        if (ev->type == LNET_EVENT_PUT)
@@ -487,7 +486,7 @@ void server_bulk_callback(struct lnet_event *ev)
                 * before the SENT event (oh yes we can), we know we
                 * read/wrote the peer buffer and how much... */
                desc->bd_nob_transferred += ev->mlength;
-               desc->bd_sender = ev->sender;
+               desc->bd_sender = lnet_nid_to_nid4(&ev->sender);
        }
 
        if (ev->status != 0)
index 2da3178..28c4a38 100644 (file)
@@ -862,8 +862,10 @@ struct ptlrpc_cli_ctx * gss_sec_lookup_ctx_kr(struct ptlrpc_sec *sec,
                 sec->ps_id, sec2gsec(sec)->gs_mech->gm_name,
                 vcred->vc_uid, vcred->vc_gid,
                 sec_part_flags, svc_flag, import_to_gss_svc(imp),
-                imp->imp_connection->c_peer.nid, imp->imp_obd->obd_name,
-                LNetPrimaryNID(imp->imp_connection->c_self), caller_pid);
+                lnet_nid_to_nid4(&imp->imp_connection->c_peer.nid),
+                imp->imp_obd->obd_name,
+                LNetPrimaryNID(lnet_nid_to_nid4(&imp->imp_connection->c_self)),
+                caller_pid);
 
        CDEBUG(D_SEC, "requesting key for %s\n", desc);
 
index 3b18d4a..77d9da0 100644 (file)
@@ -529,7 +529,7 @@ static int import_select_connection(struct obd_import *imp)
        list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
                CDEBUG(D_HA, "%s: connect to NID %s last attempt %lld\n",
                       imp->imp_obd->obd_name,
-                      libcfs_nid2str(conn->oic_conn->c_peer.nid),
+                      libcfs_nidstr(&conn->oic_conn->c_peer.nid),
                       conn->oic_last_attempt);
 
                /* If we have not tried this connection since
@@ -602,7 +602,7 @@ static int import_select_connection(struct obd_import *imp)
                               " %.*s (at %s)\n",
                               imp->imp_obd->obd_name,
                               target_len, target_start,
-                              libcfs_nid2str(imp_conn->oic_conn->c_peer.nid));
+                              libcfs_nidstr(&imp_conn->oic_conn->c_peer.nid));
                }
 
                imp->imp_conn_current = imp_conn;
@@ -611,7 +611,7 @@ static int import_select_connection(struct obd_import *imp)
        /* The below message is checked in conf-sanity.sh test_35[ab] */
        CDEBUG(D_HA, "%s: import %p using connection %s/%s\n",
               imp->imp_obd->obd_name, imp, imp_conn->oic_uuid.uuid,
-              libcfs_nid2str(imp_conn->oic_conn->c_peer.nid));
+              libcfs_nidstr(&imp_conn->oic_conn->c_peer.nid));
 
 out_unlock:
        spin_unlock(&imp->imp_lock);
index 604475a..cfd16ff 100644 (file)
@@ -344,9 +344,7 @@ int ptlrpc_register_bulk(struct ptlrpc_request *req)
 
        desc->bd_failure = 0;
 
-       peer.pid = desc->bd_import->imp_connection->c_peer.pid;
-       lnet_nid4_to_nid(desc->bd_import->imp_connection->c_peer.nid,
-                     &peer.nid);
+       peer = desc->bd_import->imp_connection->c_peer;
 
        LASSERT(desc->bd_cbid.cbid_fn == client_bulk_callback);
        LASSERT(desc->bd_cbid.cbid_arg == desc);
@@ -848,8 +846,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
                        request->rq_repmsg = NULL;
                }
 
-               peer.pid = connection->c_peer.pid;
-               lnet_nid4_to_nid(connection->c_peer.nid, &peer.nid);
+               peer = connection->c_peer;
                if (request->rq_bulk &&
                    OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_REPLY_ATTACH)) {
                        reply_me = ERR_PTR(-ENOMEM);
@@ -938,7 +935,8 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
        rc = ptl_send_buf(&request->rq_req_md_h,
                          request->rq_reqbuf, request->rq_reqdata_len,
                          LNET_NOACK_REQ, &request->rq_req_cbid,
-                         LNET_NID_ANY, connection->c_peer,
+                         LNET_NID_ANY,
+                         lnet_pid_to_pid4(&connection->c_peer),
                          request->rq_request_portal,
                          request->rq_xid, 0, &bulk_cookie);
        if (likely(rc == 0))
index a9292a3..841a88a 100644 (file)
@@ -348,8 +348,8 @@ static int nodemap_exports_show(struct seq_file *m, void *data)
        list_for_each_entry(exp, &nodemap->nm_member_list,
                            exp_target_data.ted_nodemap_member) {
                if (exp->exp_connection != NULL)
-                       libcfs_nid2str_r(exp->exp_connection->c_peer.nid,
-                                        nidstr, sizeof(nidstr));
+                       libcfs_nidstr_r(&exp->exp_connection->c_peer.nid,
+                                         nidstr, sizeof(nidstr));
 
                seq_printf(m, " { nid: %s, uuid: %s },",
                           nidstr, exp->exp_client_uuid.uuid);
index 275aaae..e049799 100644 (file)
@@ -181,7 +181,7 @@ void nm_member_reclassify_nodemap(struct lu_nodemap *nodemap)
                /* if no conn assigned to this exp, reconnect will reclassify */
                spin_lock(&exp->exp_lock);
                if (exp->exp_connection) {
-                       nid = exp->exp_connection->c_peer.nid;
+                       nid = lnet_nid_to_nid4(&exp->exp_connection->c_peer.nid);
                } else {
                        spin_unlock(&exp->exp_lock);
                        continue;
index 88831c7..034113a 100644 (file)
@@ -2764,7 +2764,7 @@ void _debug_req(struct ptlrpc_request *req,
 {
        bool req_ok = req->rq_reqmsg != NULL;
        bool rep_ok = false;
-       lnet_nid_t nid = LNET_NID_ANY;
+       struct lnet_nid *nid = NULL;
        struct va_format vaf;
        va_list args;
        int rep_flags = -1;
@@ -2786,9 +2786,9 @@ void _debug_req(struct ptlrpc_request *req,
        spin_unlock(&req->rq_early_free_lock);
 
        if (req->rq_import && req->rq_import->imp_connection)
-               nid = req->rq_import->imp_connection->c_peer.nid;
+               nid = &req->rq_import->imp_connection->c_peer.nid;
        else if (req->rq_export && req->rq_export->exp_connection)
-               nid = req->rq_export->exp_connection->c_peer.nid;
+               nid = &req->rq_export->exp_connection->c_peer.nid;
 
        va_start(args, fmt);
        vaf.fmt = fmt;
@@ -2804,7 +2804,7 @@ void _debug_req(struct ptlrpc_request *req,
                         req->rq_export ?
                         req->rq_export->exp_client_uuid.uuid :
                         "<?>",
-                        libcfs_nid2str(nid),
+                        nid ? libcfs_nidstr(nid) : "<unknown>",
                         req->rq_request_portal, req->rq_reply_portal,
                         req->rq_reqlen, req->rq_replen,
                         req->rq_early_count, (s64)req->rq_timedout,
index 3844760..399ff28 100644 (file)
@@ -305,10 +305,10 @@ void sptlrpc_gc_fini(void);
 
 /* sec_config.c */
 void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,
-                                enum lustre_sec_part to,
-                                struct obd_uuid *target,
-                                lnet_nid_t nid,
-                                struct sptlrpc_flavor *sf);
+                               enum lustre_sec_part to,
+                               struct obd_uuid *target,
+                               struct lnet_nid *nid,
+                               struct sptlrpc_flavor *sf);
 int  sptlrpc_conf_init(void);
 void sptlrpc_conf_fini(void);
 
index 848688b..7a19f5c 100644 (file)
@@ -1476,7 +1476,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                        sptlrpc_conf_choose_flavor(cliobd->cl_sp_me,
                                                   cliobd->cl_sp_to,
                                                   &cliobd->cl_target_uuid,
-                                                  conn->c_self, &sf);
+                                                  &conn->c_self, &sf);
 
                sp = imp->imp_obd->u.cli.cl_sp_me;
        } else {
@@ -1507,7 +1507,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
                CDEBUG(D_SEC, "import %s->%s netid %x: select flavor %s\n",
                       imp->imp_obd->obd_name,
                       obd_uuid2str(&conn->c_remote_uuid),
-                      LNET_NIDNET(conn->c_self),
+                      LNET_NID_NET(&conn->c_self),
                       sptlrpc_flavor2name(&sf, str, sizeof(str)));
        }
 
@@ -2136,7 +2136,7 @@ void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
                 */
                spin_lock(&exp->exp_lock);
                sptlrpc_target_choose_flavor(rset, exp->exp_sp_peer,
-                                            exp->exp_connection->c_peer.nid,
+                                            lnet_nid_to_nid4(&exp->exp_connection->c_peer.nid),
                                             &new_flvr);
                if (exp->exp_flvr_changed ||
                    !flavor_equal(&new_flvr, &exp->exp_flvr)) {
index 3f476ba..a36452e 100644 (file)
@@ -831,46 +831,47 @@ static void inline flavor_set_flags(struct sptlrpc_flavor *sf,
 }
 
 void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,
-                                enum lustre_sec_part to,
-                                struct obd_uuid *target,
-                                lnet_nid_t nid,
-                                struct sptlrpc_flavor *sf)
+                               enum lustre_sec_part to,
+                               struct obd_uuid *target,
+                               struct lnet_nid *nid,
+                               struct sptlrpc_flavor *sf)
 {
-        struct sptlrpc_conf     *conf;
-        struct sptlrpc_conf_tgt *conf_tgt;
-        char                     name[MTI_NAME_MAXLEN];
-        int                      len, rc = 0;
+       struct sptlrpc_conf     *conf;
+       struct sptlrpc_conf_tgt *conf_tgt;
+       char                     name[MTI_NAME_MAXLEN];
+       int                      len, rc = 0;
 
        obd_uuid2fsname(name, target->uuid, sizeof(name));
 
        mutex_lock(&sptlrpc_conf_lock);
 
-        conf = sptlrpc_conf_get(name, 0);
-        if (conf == NULL)
-                goto out;
-
-        /* convert uuid name (supposed end with _UUID) to target name */
-        len = strlen(target->uuid);
-        LASSERT(len > 5);
-        memcpy(name, target->uuid, len - 5);
-        name[len - 5] = '\0';
-
-        conf_tgt = sptlrpc_conf_get_tgt(conf, name, 0);
-        if (conf_tgt) {
-                rc = sptlrpc_rule_set_choose(&conf_tgt->sct_rset,
-                                             from, to, nid, sf);
-                if (rc)
-                        goto out;
-        }
+       conf = sptlrpc_conf_get(name, 0);
+       if (conf == NULL)
+               goto out;
+
+       /* convert uuid name (supposed end with _UUID) to target name */
+       len = strlen(target->uuid);
+       LASSERT(len > 5);
+       memcpy(name, target->uuid, len - 5);
+       name[len - 5] = '\0';
+
+       conf_tgt = sptlrpc_conf_get_tgt(conf, name, 0);
+       if (conf_tgt) {
+               rc = sptlrpc_rule_set_choose(&conf_tgt->sct_rset,
+                                            from, to, lnet_nid_to_nid4(nid), sf);
+               if (rc)
+                       goto out;
+       }
 
-        rc = sptlrpc_rule_set_choose(&conf->sc_rset, from, to, nid, sf);
+       rc = sptlrpc_rule_set_choose(&conf->sc_rset, from, to,
+                                    lnet_nid_to_nid4(nid), sf);
 out:
        mutex_unlock(&sptlrpc_conf_lock);
 
-        if (rc == 0)
-                get_default_flavor(sf);
+       if (rc == 0)
+               get_default_flavor(sf);
 
-        flavor_set_flags(sf, from, to, 1);
+       flavor_set_flags(sf, from, to, 1);
 }
 
 /**
@@ -878,12 +879,12 @@ out:
  * certain peer (from, nid).
  */
 void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
-                                  enum lustre_sec_part from,
-                                  lnet_nid_t nid,
-                                  struct sptlrpc_flavor *sf)
+                                 enum lustre_sec_part from,
+                                 lnet_nid_t nid,
+                                 struct sptlrpc_flavor *sf)
 {
-        if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0)
-                get_default_flavor(sf);
+       if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0)
+               get_default_flavor(sf);
 }
 
 #define SEC_ADAPT_DELAY         (10)
index 5cb73b4..abe24c4 100644 (file)
@@ -2492,7 +2492,7 @@ static int ptlrpc_handle_rs(struct ptlrpc_reply_state *rs)
                CDEBUG(D_HA,
                       "All locks stolen from rs %p x%lld.t%lld o%d NID %s\n",
                       rs, rs->rs_xid, rs->rs_transno, rs->rs_opc,
-                      libcfs_nid2str(exp->exp_connection->c_peer.nid));
+                      libcfs_nidstr(&exp->exp_connection->c_peer.nid));
        }
 
        if ((rs->rs_sent && !rs->rs_unlinked) || nlocks > 0) {
index 5e97949..ce034a1 100644 (file)
@@ -940,9 +940,9 @@ int tgt_connect_check_sptlrpc(struct ptlrpc_request *req, struct obd_export *exp
                 * NID is on the local node, allow any flavor
                 */
                if ((strcmp(exp->exp_obd->obd_type->typ_name,
-                          LUSTRE_MGS_NAME) == 0) &&
-                    (exp->exp_flvr.sf_rpc == SPTLRPC_FLVR_NULL ||
-                     LNetIsPeerLocal(exp->exp_connection->c_peer.nid)))
+                           LUSTRE_MGS_NAME) == 0) &&
+                   (exp->exp_flvr.sf_rpc == SPTLRPC_FLVR_NULL ||
+                    LNetIsPeerLocal(lnet_nid_to_nid4(&exp->exp_connection->c_peer.nid))))
                        exp->exp_flvr.sf_rpc = SPTLRPC_FLVR_ANY;
 
                if (exp->exp_flvr.sf_rpc != SPTLRPC_FLVR_ANY &&