diff options
author | NeilBrown <neilb@suse.com> | 2018-01-09 12:19:38 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-09 15:39:28 +0100 |
commit | 3c88bdbbf919c1181d6ae14afa6c3a9b0de57b34 (patch) | |
tree | be363ec739afc9b09338fc260f33ef94418efa50 /drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | |
parent | 9ab7bc50a8b0564aac43c9fa1f8c3bcf12536c05 (diff) | |
download | op-kernel-dev-3c88bdbbf919c1181d6ae14afa6c3a9b0de57b34.zip op-kernel-dev-3c88bdbbf919c1181d6ae14afa6c3a9b0de57b34.tar.gz |
staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc.
All usages of the form
LIBCFS_ALLOC(variable, sizeof(variable))
or
LIBCFS_ALLOC(variable, sizeof(variable's-type))
are changed to
variable = kzalloc(sizeof(...), GFP_NOFS);
Similarly, all
LIBCFS_FREE(variable, sizeof(variable))
become
kfree(variable);
None of these need the vmalloc option, or any of the other minor
benefits of LIBCFS_ALLOC().
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c')
-rw-r--r-- | drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c index 2f5d8f3..9679bd7 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c @@ -102,11 +102,7 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab) for (i = 0; cptab->ctb_parts && i < cptab->ctb_nparts; i++) { struct cfs_cpu_partition *part = &cptab->ctb_parts[i]; - if (part->cpt_nodemask) { - LIBCFS_FREE(part->cpt_nodemask, - sizeof(*part->cpt_nodemask)); - } - + kfree(part->cpt_nodemask); if (part->cpt_cpumask) LIBCFS_FREE(part->cpt_cpumask, cpumask_size()); } @@ -116,12 +112,11 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab) cptab->ctb_nparts * sizeof(cptab->ctb_parts[0])); } - if (cptab->ctb_nodemask) - LIBCFS_FREE(cptab->ctb_nodemask, sizeof(*cptab->ctb_nodemask)); + kfree(cptab->ctb_nodemask); if (cptab->ctb_cpumask) LIBCFS_FREE(cptab->ctb_cpumask, cpumask_size()); - LIBCFS_FREE(cptab, sizeof(*cptab)); + kfree(cptab); } EXPORT_SYMBOL(cfs_cpt_table_free); @@ -131,14 +126,15 @@ cfs_cpt_table_alloc(unsigned int ncpt) struct cfs_cpt_table *cptab; int i; - LIBCFS_ALLOC(cptab, sizeof(*cptab)); + cptab = kzalloc(sizeof(*cptab), GFP_NOFS); if (!cptab) return NULL; cptab->ctb_nparts = ncpt; LIBCFS_ALLOC(cptab->ctb_cpumask, cpumask_size()); - LIBCFS_ALLOC(cptab->ctb_nodemask, sizeof(*cptab->ctb_nodemask)); + cptab->ctb_nodemask = kzalloc(sizeof(*cptab->ctb_nodemask), + GFP_NOFS); if (!cptab->ctb_cpumask || !cptab->ctb_nodemask) goto failed; @@ -159,7 +155,8 @@ cfs_cpt_table_alloc(unsigned int ncpt) struct cfs_cpu_partition *part = &cptab->ctb_parts[i]; LIBCFS_ALLOC(part->cpt_cpumask, cpumask_size()); - LIBCFS_ALLOC(part->cpt_nodemask, sizeof(*part->cpt_nodemask)); + part->cpt_nodemask = kzalloc(sizeof(*part->cpt_nodemask), + GFP_NOFS); if (!part->cpt_cpumask || !part->cpt_nodemask) goto failed; } |