• N
    staging: lustre: replace LIBCFS_CPT_ALLOC() · 8d60ecd9
    NeilBrown 提交于
    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: NNeilBrown <neilb@suse.com>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    8d60ecd9
libcfs_private.h 7.4 KB