*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lnet/include/lnet/lib-lnet.h
*
static inline void
lnet_peer_ni_addref_locked(struct lnet_peer_ni *lp)
{
- LASSERT(atomic_read(&lp->lpni_refcount) > 0);
- atomic_inc(&lp->lpni_refcount);
+ kref_get(&lp->lpni_kref);
}
-extern void lnet_destroy_peer_ni_locked(struct lnet_peer_ni *lp);
+extern void lnet_destroy_peer_ni_locked(struct kref *ref);
static inline void
lnet_peer_ni_decref_locked(struct lnet_peer_ni *lp)
{
- LASSERT(atomic_read(&lp->lpni_refcount) > 0);
- if (atomic_dec_and_test(&lp->lpni_refcount))
- lnet_destroy_peer_ni_locked(lp);
+ kref_put(&lp->lpni_kref, lnet_destroy_peer_ni_locked);
}
static inline int
extern int lnet_peer_del_pref_nid(struct lnet_peer_ni *lpni, lnet_nid_t nid);
void lnet_peer_ni_set_selection_priority(struct lnet_peer_ni *lpni,
__u32 priority);
+extern void lnet_ni_add_to_recoveryq_locked(struct lnet_ni *ni,
+ struct list_head *queue,
+ time64_t now);
void lnet_router_debugfs_init(void);
void lnet_router_debugfs_fini(void);
lnet_get_next_recovery_ping(lpni->lpni_ping_count, now);
}
+static inline void
+lnet_ni_set_next_ping(struct lnet_ni *ni, time64_t now)
+{
+ ni->ni_next_ping = lnet_get_next_recovery_ping(ni->ni_ping_count, now);
+}
+
/*
* A peer NI is alive if it satisfies the following two conditions:
* 1. peer NI health >= LNET_MAX_HEALTH_VALUE * router_sensitivity_percentage
void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
struct lnet_element_stats *stats);
+static inline void
+lnet_set_route_aliveness(struct lnet_route *route, bool alive)
+{
+ bool old = atomic_xchg(&route->lr_alive, alive);
+
+ if (old != alive)
+ CERROR("route to %s through %s has gone from %s to %s\n",
+ libcfs_net2str(route->lr_net),
+ libcfs_nid2str(route->lr_gateway->lp_primary_nid),
+ old ? "up" : "down",
+ alive ? "up" : "down");
+}
#endif