From: Mr NeilBrown Date: Tue, 3 Dec 2019 23:35:02 +0000 (+1100) Subject: LU-12678 lnet: remove lnet_me_alloc/lnet_me_free X-Git-Tag: 2.13.53~168 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;ds=sidebyside;h=e4edafaaa874e56fab1da1149dcc51c2ff448e04;p=fs%2Flustre-release.git LU-12678 lnet: remove lnet_me_alloc/lnet_me_free These functions are simple wrapper that do not benefit readability, so remove them. Move the DEBUJG messages to the places where allocation happens. This introduces only a tiny amount of code duplication. Signed-off-by: Mr NeilBrown Change-Id: Ieb40f8a7547cba30b05c1e5e526c762e354f3c47 Reviewed-on: https://review.whamcloud.com/36910 Tested-by: jenkins Reviewed-by: Shaun Tancheff Reviewed-by: Serguei Smirnov Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index 96aa805..45e5b6d 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, diff --git a/lnet/lnet/lib-me.c b/lnet/lnet/lib-me.c index 1ec83db..aed1c4b 100644 --- a/lnet/lnet/lib-me.c +++ b/lnet/lnet/lib-me.c @@ -85,9 +85,12 @@ LNetMEAttach(unsigned int portal, if (mtable == NULL) /* can't match portal type */ return ERR_PTR(-EPERM); - me = lnet_me_alloc(); - if (me == NULL) + me = kmem_cache_alloc(lnet_mes_cachep, GFP_NOFS | __GFP_ZERO); + if (me == NULL) { + CDEBUG(D_MALLOC, "failed to allocate 'me'\n"); return ERR_PTR(-ENOMEM); + } + CDEBUG(D_MALLOC, "slab-alloced 'me' at %p.\n", me); lnet_res_lock(mtable->mt_cpt); @@ -171,7 +174,8 @@ lnet_me_unlink(struct lnet_me *me) lnet_md_unlink(md); } - lnet_me_free(me); + CDEBUG(D_MALLOC, "slab-freed 'me' at %p.\n", me); + kmem_cache_free(lnet_mes_cachep, me); } #if 0 diff --git a/lnet/lnet/lib-ptl.c b/lnet/lnet/lib-ptl.c index e8f7ef7..560ef06 100644 --- a/lnet/lnet/lib-ptl.c +++ b/lnet/lnet/lib-ptl.c @@ -768,7 +768,10 @@ lnet_ptl_cleanup(struct lnet_portal *ptl) struct lnet_me, me_list); CERROR("Active ME %p on exit\n", me); list_del(&me->me_list); - lnet_me_free(me); + CDEBUG(D_MALLOC, + "slab-freed 'me' at %p in cleanup.\n", + me); + kmem_cache_free(lnet_mes_cachep, me); } } /* the extra entry is for MEs with ignore bits */