OSDN Git Service

staging: lustre: change some LIBCFS_ALLOC calls to k?alloc(GFP_KERNEL)
authorNeilBrown <neilb@suse.com>
Tue, 9 Jan 2018 01:19:38 +0000 (12:19 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 14:41:56 +0000 (15:41 +0100)
commit12e46c461cb901a4034b08e99b448a2b3e48333d
tree6264558832d09bb803c4e34c1495902fcd7d91ea
parent2aa8b1b728da158d8c55f0bd589468183e7865c1
staging: lustre: change some LIBCFS_ALLOC calls to k?alloc(GFP_KERNEL)

When an allocation happens from process context rather than
filesystem context, it is best to use GFP_KERNEL rather than
LIBCFS_ALLOC() which always uses GFP_NOFS.
This include initialization during, or prior to, mount,
and code run from separate worker threads.

So for some of these cases, switch to kmalloc, kvmalloc, or
kvmalloc_array() as appropriate.
In some cases we preserve __GFP_ZERO (via kzalloc/kvzalloc), but in
others it is clear that allocated memory is immediately initialized.

In each case, the matching LIBCFS_FREE() is converted to
kfree() or kvfree()

This is just a subset of locations that need changing.
As there are quite a lot, I've broken them up into several
ad-hoc sets to avoid review-fatigue.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
drivers/staging/lustre/lnet/libcfs/hash.c
drivers/staging/lustre/lnet/libcfs/libcfs_mem.c
drivers/staging/lustre/lnet/libcfs/libcfs_string.c
drivers/staging/lustre/lnet/lnet/config.c