X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Finclude%2Flnet%2Flib-lnet.h;h=602bf46a2bda22ea55890fb00bbe2e639a5a8941;hb=6612e57a233fa22af00173366e1121b68bb5524e;hp=f0c551ebd182f30204e495011a79e1a97dcb97ed;hpb=a3ce59ae2c6243667e471e8b9f4d6da0744f8333;p=fs%2Flustre-release.git diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index f0c551e..602bf46 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -273,28 +273,6 @@ lnet_md_free(struct lnet_libmd *md) } } -static inline struct lnet_me * -lnet_me_alloc (void) -{ - struct lnet_me *me; - - me = kmem_cache_alloc(lnet_mes_cachep, GFP_NOFS | __GFP_ZERO); - - if (me) - CDEBUG(D_MALLOC, "slab-alloced 'me' at %p.\n", me); - else - CDEBUG(D_MALLOC, "failed to allocate 'me'\n"); - - return me; -} - -static inline void -lnet_me_free(struct lnet_me *me) -{ - CDEBUG(D_MALLOC, "slab-freed 'me' at %p.\n", me); - kmem_cache_free(lnet_mes_cachep, me); -} - struct lnet_libhandle *lnet_res_lh_lookup(struct lnet_res_container *rec, __u64 cookie); void lnet_res_lh_initialize(struct lnet_res_container *rec, @@ -308,30 +286,6 @@ lnet_res_lh_invalidate(struct lnet_libhandle *lh) } static inline void -lnet_eq2handle(struct lnet_handle_eq *handle, struct lnet_eq *eq) -{ - if (eq == NULL) { - LNetInvalidateEQHandle(handle); - return; - } - - handle->cookie = eq->eq_lh.lh_cookie; -} - -static inline struct lnet_eq * -lnet_handle2eq(struct lnet_handle_eq *handle) -{ - /* ALWAYS called with resource lock held */ - struct lnet_libhandle *lh; - - lh = lnet_res_lh_lookup(&the_lnet.ln_eq_container, handle->cookie); - if (lh == NULL) - return NULL; - - return lh_entry(lh, struct lnet_eq, eq_lh); -} - -static inline void lnet_md2handle(struct lnet_handle_md *handle, struct lnet_libmd *md) { handle->cookie = md->md_lh.lh_cookie; @@ -617,7 +571,7 @@ void lnet_prep_send(struct lnet_msg *msg, int type, unsigned int len); int lnet_send(lnet_nid_t nid, struct lnet_msg *msg, lnet_nid_t rtr_nid); int lnet_send_ping(lnet_nid_t dest_nid, struct lnet_handle_md *mdh, int nnis, - void *user_ptr, struct lnet_handle_eq eqh, bool recovery); + void *user_ptr, struct lnet_eq *eq, bool recovery); void lnet_return_tx_credits_locked(struct lnet_msg *msg); void lnet_return_rx_credits_locked(struct lnet_msg *msg); void lnet_schedule_blocked_locked(struct lnet_rtrbufpool *rbp); @@ -847,7 +801,6 @@ int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout); int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog, struct net *ns); -int lnet_sock_accept(struct socket **newsockp, struct socket *sock); int lnet_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip, int local_port, __u32 peer_ip, int peer_port, struct net *ns); @@ -882,17 +835,14 @@ static inline void lnet_ping_buffer_decref(struct lnet_ping_buffer *pbuf) lnet_ping_buffer_free(pbuf); } -static inline int lnet_ping_buffer_numref(struct lnet_ping_buffer *pbuf) -{ - return atomic_read(&pbuf->pb_refcnt); -} - static inline int lnet_push_target_resize_needed(void) { return the_lnet.ln_push_target->pb_nnis < the_lnet.ln_push_target_nnis; } int lnet_push_target_resize(void); +int lnet_push_target_post(struct lnet_ping_buffer *pbuf, + struct lnet_handle_md *mdh); void lnet_peer_push_event(struct lnet_event *ev); int lnet_parse_ip2nets(char **networksp, char *ip2nets); @@ -1019,9 +969,37 @@ lnet_is_peer_ni_alive(struct lnet_peer_ni *lpni) } static inline void -lnet_set_healthv(atomic_t *healthv, int value) +lnet_update_peer_net_healthv(struct lnet_peer_ni *lpni) +{ + struct lnet_peer_net *lpn; + int best_healthv = 0; + + lpn = lpni->lpni_peer_net; + + list_for_each_entry(lpni, &lpn->lpn_peer_nis, lpni_peer_nis) { + int lpni_healthv = atomic_read(&lpni->lpni_healthv); + if (best_healthv < lpni_healthv) + best_healthv = lpni_healthv; + } + + lpn->lpn_healthv = best_healthv; +} + +static inline void +lnet_set_lpni_healthv_locked(struct lnet_peer_ni *lpni, int value) +{ + if (atomic_read(&lpni->lpni_healthv) == value) + return; + atomic_set(&lpni->lpni_healthv, value); + lnet_update_peer_net_healthv(lpni); +} + +static inline void +lnet_inc_lpni_healthv_locked(struct lnet_peer_ni *lpni) { - atomic_set(healthv, value); + /* only adjust the net health if the lpni health value changed */ + if (atomic_add_unless(&lpni->lpni_healthv, 1, LNET_MAX_HEALTH_VALUE)) + lnet_update_peer_net_healthv(lpni); } static inline void