Whamcloud - gitweb
LU-12678 lnet: remove lnet_me_alloc/lnet_me_free 10/36910/5
authorMr NeilBrown <neilb@suse.de>
Tue, 3 Dec 2019 23:35:02 +0000 (10:35 +1100)
committerOleg Drokin <green@whamcloud.com>
Sun, 1 Mar 2020 05:35:49 +0000 (05:35 +0000)
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 <neilb@suse.de>
Change-Id: Ieb40f8a7547cba30b05c1e5e526c762e354f3c47
Reviewed-on: https://review.whamcloud.com/36910
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/lib-lnet.h
lnet/lnet/lib-me.c
lnet/lnet/lib-ptl.c

index 96aa805..45e5b6d 100644 (file)
@@ -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,
index 1ec83db..aed1c4b 100644 (file)
@@ -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
index e8f7ef7..560ef06 100644 (file)
@@ -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 */