X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Finclude%2Flnet%2Flib-lnet.h;h=c5310554b9f29273cd2dbaa6f51cff4f9c040d88;hp=9bcf31c9917af43546d1c77a4cf9d536eae96800;hb=e520ee276800362caa652088b56325fac16aef7f;hpb=99d9638d6c074b48f1c21c5c94d6dfe347eed3ee diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index 9bcf31c..c531055 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -375,18 +375,15 @@ lnet_peer_decref_locked(struct lnet_peer *lp) 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 @@ -556,7 +553,9 @@ extern int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, extern int lnet_get_peer_list(__u32 *countp, __u32 *sizep, struct lnet_process_id __user *ids); extern void lnet_peer_ni_set_healthv(lnet_nid_t nid, int value, bool all); -extern void lnet_peer_ni_add_to_recoveryq_locked(struct lnet_peer_ni *lpni); +extern void lnet_peer_ni_add_to_recoveryq_locked(struct lnet_peer_ni *lpni, + struct list_head *queue, + time64_t now); extern int lnet_peer_add_pref_nid(struct lnet_peer_ni *lpni, lnet_nid_t nid); extern void lnet_peer_clr_pref_nids(struct lnet_peer_ni *lpni); extern int lnet_peer_del_pref_nid(struct lnet_peer_ni *lpni, lnet_nid_t nid); @@ -864,8 +863,7 @@ void lnet_peer_push_event(struct lnet_event *ev); int lnet_parse_ip2nets(const char **networksp, const char *ip2nets); int lnet_parse_routes(const char *route_str, int *im_a_router); -int lnet_parse_networks(struct list_head *nilist, const char *networks, - bool use_tcp_bonding); +int lnet_parse_networks(struct list_head *nilist, const char *networks); bool lnet_net_unique(__u32 net_id, struct list_head *nilist, struct lnet_net **net); bool lnet_ni_unique_net(struct list_head *nilist, char *iface); @@ -984,6 +982,28 @@ lnet_peer_needs_push(struct lnet_peer *lp) return false; } +#define LNET_RECOVERY_INTERVAL_MAX 900 +static inline unsigned int +lnet_get_next_recovery_ping(unsigned int ping_count, time64_t now) +{ + unsigned int interval; + + /* 2^9 = 512, 2^10 = 1024 */ + if (ping_count > 9) + interval = LNET_RECOVERY_INTERVAL_MAX; + else + interval = 1 << ping_count; + + return now + interval; +} + +static inline void +lnet_peer_ni_set_next_ping(struct lnet_peer_ni *lpni, time64_t now) +{ + lpni->lpni_next_ping = + lnet_get_next_recovery_ping(lpni->lpni_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