Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752287AbbECOQR (ORCPT ); Sun, 3 May 2015 10:16:17 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:20843 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751015AbbECOP7 (ORCPT ); Sun, 3 May 2015 10:15:59 -0400 X-IronPort-AV: E=Sophos;i="5.13,360,1427752800"; d="scan'208";a="138719314" From: Julia Lawall To: Oleg Drokin Cc: kernel-janitors@vger.kernel.org, Andreas Dilger , Greg Kroah-Hartman , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3 v2] staging: lustre: ptlrpc: nrs: Replace OBD_CPT_ALLOC etc by kzalloc_node Date: Sun, 3 May 2015 16:07:17 +0200 Message-Id: <1430662039-26557-2-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1430662039-26557-1-git-send-email-Julia.Lawall@lip6.fr> References: <1430662039-26557-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2305 Lines: 61 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/). // @@ expression ptr,cptab,cpt,size; @@ - OBD_CPT_ALLOC(ptr, cptab, cpt, size) + ptr = kzalloc_node(size, GFP_NOFS, cfs_cpt_spread_node(cptab, cpt)) // 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 --- v2: improve the subject line drivers/staging/lustre/lustre/ptlrpc/nrs.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 68c754f..63a05f4 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -746,8 +746,9 @@ static int nrs_policy_register(struct ptlrpc_nrs *nrs, LASSERT(desc->pd_ops->op_req_dequeue != NULL); LASSERT(desc->pd_compat != NULL); - OBD_CPT_ALLOC_GFP(policy, svcpt->scp_service->srv_cptable, - svcpt->scp_cpt, sizeof(*policy), GFP_NOFS); + policy = kzalloc_node(sizeof(*policy), GFP_NOFS, + cfs_cpt_spread_node(svcpt->scp_service->srv_cptable, + svcpt->scp_cpt)); if (policy == NULL) return -ENOMEM; @@ -961,9 +962,10 @@ static int nrs_svcpt_setup_locked(struct ptlrpc_service_part *svcpt) if (svcpt->scp_service->srv_ops.so_hpreq_handler == NULL) goto out; - OBD_CPT_ALLOC_PTR(svcpt->scp_nrs_hp, - svcpt->scp_service->srv_cptable, - svcpt->scp_cpt); + svcpt->scp_nrs_hp = + kzalloc_node(sizeof(*svcpt->scp_nrs_hp), GFP_NOFS, + cfs_cpt_spread_node(svcpt->scp_service->srv_cptable, + svcpt->scp_cpt)); if (svcpt->scp_nrs_hp == NULL) { rc = -ENOMEM; goto out; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/