drivers: staging: lustre: lustre: Replace OBD_CPT_ALLOC etc by kzalloc_node
authorJulia Lawall <Julia.Lawall@lip6.fr>
Sun, 3 May 2015 13:21:43 +0000 (15:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 07:23:57 +0000 (09:23 +0200)
Replace OBD_CPT_ALLOC, OBD_CPT_ALLOC_PTR, and OBD_CPT_ALLOC_GFP by
corresponding calls to kzalloc_node.  The semantic patch for the
OBD_CPT_ALLOC case is as follows: (http://coccinelle.lip6.fr/).

// <smpl>
@@ expression ptr,cptab,cpt,size; @@
- OBD_CPT_ALLOC(ptr, cptab, cpt, size)
+ ptr = kzalloc_node(size, GFP_NOFS, cfs_cpt_spread_node(cptab, cpt))
// </smpl>

Note that the original OBD macros would check if the cptab argument was
NULL and fall back on kzalloc in that case.  Oleg Drokin argues that this
test is not needed because the code containing these calls is only invoked
after initialization has been completed, in which case the possible cptab
arguments are not NULL.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c

index 2eefa25f464de75e00e57dbf352b6c8e1a6be2f1..6a61c85cfb11c1bca301c908a79420f6af0c9fc4 100644 (file)
@@ -80,7 +80,9 @@ static int nrs_fifo_start(struct ptlrpc_nrs_policy *policy)
 {
        struct nrs_fifo_head *head;
 
-       OBD_CPT_ALLOC_PTR(head, nrs_pol2cptab(policy), nrs_pol2cptid(policy));
+       head = kzalloc_node(sizeof(*head), GFP_NOFS,
+                           cfs_cpt_spread_node(nrs_pol2cptab(policy),
+                                               nrs_pol2cptid(policy)));
        if (head == NULL)
                return -ENOMEM;
 
This page took 0.054522 seconds and 5 git commands to generate.