summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lnet/lnet/router.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2018-01-09 12:19:38 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-09 15:48:45 +0100
commit8d60ecd99c9bafedfb49e7a3bc0cc31887100559 (patch)
tree24ac46d2f98c6cd72d7bff33de328e05e358858f /drivers/staging/lustre/lnet/lnet/router.c
parentd0157f0c7ef02e022a6dc063ddece4a28004c710 (diff)
downloadlinux-0-day-8d60ecd99c9bafedfb49e7a3bc0cc31887100559.tar.gz
linux-0-day-8d60ecd99c9bafedfb49e7a3bc0cc31887100559.tar.xz
staging: lustre: replace LIBCFS_CPT_ALLOC()
LIBCFS_APT_ALLOC() calls kvmalloc_node() with GFP_NOFS which is not permitted. Mostly, a kmalloc_node(GFP_NOFS) is appropriate, though occasionally the allocation is large and GFP_KERNEL is acceptable, so kvmalloc_node() can be used. This patch introduces 4 alternatives to LIBCFS_CPT_ALLOC(): kmalloc_cpt() kzalloc_cpt() kvmalloc_cpt() kvzalloc_cpt(). Each takes a size, gfp flags, and cpt number. Almost every call to LIBCFS_CPT_ALLOC() passes lnet_cpt_table() as the table. This patch embeds that choice in the k*alloc_cpt() macros, and opencode kzalloc_node(..., cfs_cpt_spread_node(..)) in the one case that lnet_cpt_table() isn't used. When LIBCFS_CPT_ALLOC() is replaced, the matching LIBCFS_FREE() is also replaced, with with kfree() or kvfree() as appropriate. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/lnet/router.c')
-rw-r--r--drivers/staging/lustre/lnet/lnet/router.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
index 476d6d2960372..6504761ca598b 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -1296,12 +1296,10 @@ rescan:
void
lnet_destroy_rtrbuf(struct lnet_rtrbuf *rb, int npages)
{
- int sz = offsetof(struct lnet_rtrbuf, rb_kiov[npages]);
-
while (--npages >= 0)
__free_page(rb->rb_kiov[npages].bv_page);
- LIBCFS_FREE(rb, sz);
+ kfree(rb);
}
static struct lnet_rtrbuf *
@@ -1313,7 +1311,7 @@ lnet_new_rtrbuf(struct lnet_rtrbufpool *rbp, int cpt)
struct lnet_rtrbuf *rb;
int i;
- LIBCFS_CPT_ALLOC(rb, lnet_cpt_table(), cpt, sz);
+ rb = kzalloc_cpt(sz, GFP_NOFS, cpt);
if (!rb)
return NULL;
@@ -1327,7 +1325,7 @@ lnet_new_rtrbuf(struct lnet_rtrbufpool *rbp, int cpt)
while (--i >= 0)
__free_page(rb->rb_kiov[i].bv_page);
- LIBCFS_FREE(rb, sz);
+ kfree(rb);
return NULL;
}