summaryrefslogtreecommitdiff
path: root/drivers/staging/lustre/lnet/lnet/lib-eq.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2017-12-18 11:46:30 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-08 16:03:45 +0100
commitee3b1e23bd759b57a964dd66ee835350ae4873dd (patch)
tree1332453bc84caea380bfa5091de0aa706c87e2f2 /drivers/staging/lustre/lnet/lnet/lib-eq.c
parent508d5e0f4d45a815a0759c6aea69fef62359cf74 (diff)
staging: lustre: lnet-lib: opencode some alloc/free functions.
These functions just call LIBCFS_ALLOC() which in-turn calls kvmalloc(). In none of these cases is the 'vmalloc' option needed. LIBCFS_ALLOC also produces a warning if NULL is returned, but that can be provided with CONFIG_SLAB_DEBUG. LIBCFS_ALLOC zeros the memory, so we need to use __GFP_ZERO too. So with one exception where the alloc function is not trivial, open-code the alloc and free functions using kmalloc and kfree. Note that the 'size' used in lnet_md_alloc() is limited and less than a page because LNET_MAX_IOV is 256, so kvmalloc is not needed. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/lnet/lib-eq.c')
-rw-r--r--drivers/staging/lustre/lnet/lnet/lib-eq.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/lustre/lnet/lnet/lib-eq.c b/drivers/staging/lustre/lnet/lnet/lib-eq.c
index daf744277003..7a4d1f7a693e 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-eq.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-eq.c
@@ -90,7 +90,7 @@ LNetEQAlloc(unsigned int count, lnet_eq_handler_t callback,
if (!count && callback == LNET_EQ_HANDLER_NONE)
return -EINVAL;
- eq = lnet_eq_alloc();
+ eq = kzalloc(sizeof(*eq), GFP_NOFS);
if (!eq)
return -ENOMEM;
@@ -138,7 +138,7 @@ failed:
if (eq->eq_refs)
cfs_percpt_free(eq->eq_refs);
- lnet_eq_free(eq);
+ kfree(eq);
return -ENOMEM;
}
EXPORT_SYMBOL(LNetEQAlloc);
@@ -197,7 +197,7 @@ LNetEQFree(struct lnet_handle_eq eqh)
lnet_res_lh_invalidate(&eq->eq_lh);
list_del(&eq->eq_list);
- lnet_eq_free(eq);
+ kfree(eq);
out:
lnet_eq_wait_unlock();
lnet_res_unlock(LNET_LOCK_EX);