mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	James Simmons <jsimmons@infradead.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	lustre <lustre-devel@lists.lustre.org>
Subject: [PATCH 02/15] staging: lustre: lnet: discard CFS_ALLOC_PTR
Date: Mon, 18 Dec 2017 11:46:30 +1100	[thread overview]
Message-ID: <151355799026.6200.16032725626950825179.stgit@noble> (raw)
In-Reply-To: <151355781721.6200.2136335532722530242.stgit@noble>

These trivial wrappers hurt readability and
as they use kvmalloc, they are overly generic.

So discard them and use kmalloc/kfree as is
normal in Linux.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 .../lustre/include/linux/libcfs/libcfs_private.h   |    3 ---
 drivers/staging/lustre/lnet/lnet/net_fault.c       |   10 +++++-----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
index 940200ee632e..d230c7f7cced 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
@@ -215,9 +215,6 @@ do {							    \
 #define LASSERT_ATOMIC_ZERO(a)		  LASSERT_ATOMIC_EQ(a, 0)
 #define LASSERT_ATOMIC_POS(a)		   LASSERT_ATOMIC_GT(a, 0)
 
-#define CFS_ALLOC_PTR(ptr)      LIBCFS_ALLOC(ptr, sizeof(*(ptr)))
-#define CFS_FREE_PTR(ptr)       LIBCFS_FREE(ptr, sizeof(*(ptr)))
-
 /* implication */
 #define ergo(a, b) (!(a) || (b))
 /* logical equivalence */
diff --git a/drivers/staging/lustre/lnet/lnet/net_fault.c b/drivers/staging/lustre/lnet/lnet/net_fault.c
index 5a5d1811ffbe..0318e64c413f 100644
--- a/drivers/staging/lustre/lnet/lnet/net_fault.c
+++ b/drivers/staging/lustre/lnet/lnet/net_fault.c
@@ -161,7 +161,7 @@ lnet_drop_rule_add(struct lnet_fault_attr *attr)
 	if (lnet_fault_attr_validate(attr))
 		return -EINVAL;
 
-	CFS_ALLOC_PTR(rule);
+	rule = kzalloc(sizeof(*rule), GFP_NOFS);
 	if (!rule)
 		return -ENOMEM;
 
@@ -223,7 +223,7 @@ lnet_drop_rule_del(lnet_nid_t src, lnet_nid_t dst)
 		       rule->dr_attr.u.drop.da_interval);
 
 		list_del(&rule->dr_link);
-		CFS_FREE_PTR(rule);
+		kfree(rule);
 		n++;
 	}
 
@@ -452,7 +452,7 @@ delay_rule_decref(struct lnet_delay_rule *rule)
 		LASSERT(list_empty(&rule->dl_msg_list));
 		LASSERT(list_empty(&rule->dl_link));
 
-		CFS_FREE_PTR(rule);
+		kfree(rule);
 	}
 }
 
@@ -738,7 +738,7 @@ lnet_delay_rule_add(struct lnet_fault_attr *attr)
 	if (lnet_fault_attr_validate(attr))
 		return -EINVAL;
 
-	CFS_ALLOC_PTR(rule);
+	rule = kzalloc(sizeof(*rule), GFP_NOFS);
 	if (!rule)
 		return -ENOMEM;
 
@@ -792,7 +792,7 @@ lnet_delay_rule_add(struct lnet_fault_attr *attr)
 	return 0;
 failed:
 	mutex_unlock(&delay_dd.dd_mutex);
-	CFS_FREE_PTR(rule);
+	kfree(rule);
 	return rc;
 }
 

  parent reply	other threads:[~2017-12-18  0:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  0:46 [PATCH SERIES 1: 00/15] staging:lustre: convert most LIBCFS*ALLOC to k*malloc NeilBrown
2017-12-18  0:46 ` [PATCH 07/15] staging: lustre: change some LIBCFS_ALLOC calls to k?alloc(GFP_KERNEL) NeilBrown
2017-12-18  0:46 ` [PATCH 09/15] staging: lustre: more LIBCFS_ALLOC conversions to GFP_KERNEL allocations NeilBrown
2017-12-18  0:46 ` [PATCH 03/15] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc NeilBrown
2017-12-20  4:12   ` kbuild test robot
2017-12-20  7:14   ` kbuild test robot
2017-12-21  9:40   ` kbuild test robot
2017-12-21  9:40   ` [PATCH] staging: lustre: fix ifnullfree.cocci warnings kbuild test robot
2018-01-08 14:51   ` [PATCH 03/15] staging: lustre: replace simple cases of LIBCFS_ALLOC with kzalloc Greg Kroah-Hartman
2018-01-08 21:39     ` NeilBrown
2017-12-18  0:46 ` [PATCH 04/15] staging: lustre: lnet: switch to cpumask_var_t NeilBrown
2017-12-18  0:46 ` [PATCH 06/15] staging: lustre: lnet: use kmalloc/kvmalloc in router_proc NeilBrown
2017-12-18  0:46 ` [PATCH 01/15] staging: lustre: lnet-lib: opencode some alloc/free functions NeilBrown
2017-12-18  0:46 ` [PATCH 05/15] staging: lustre: lnet: selftest: don't allocate small strings NeilBrown
2017-12-18  0:46 ` NeilBrown [this message]
2017-12-18  0:46 ` [PATCH 13/15] staging: lustre: cfs_percpt_alloc: use kvmalloc(GFP_KERNEL) NeilBrown
2017-12-18  0:46 ` [PATCH 11/15] staging: lustre: lnet-route: use kmalloc for small allocation NeilBrown
2017-12-18  0:46 ` [PATCH 12/15] staging: lustre: use kmalloc for allocating ksock_tx NeilBrown
2017-12-18  0:46 ` [PATCH 15/15] staging: lustre: remove LIBCFS_ALLOC and LIBCFS_ALLOC_ATOMIC NeilBrown
2017-12-18  0:46 ` [PATCH 10/15] staging: lustre: more conversions to GFP_KERNEL allocations NeilBrown
2017-12-18  0:46 ` [PATCH 08/15] staging: lustre: Convert more LIBCFS_ALLOC allocation to direct GFP_KERNEL NeilBrown
2017-12-18  7:13   ` [lustre-devel] " NeilBrown
2017-12-18  0:46 ` [PATCH 14/15] staging: lustre: opencode LIBCFS_ALLOC_ATOMIC calls NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=151355799026.6200.16032725626950825179.stgit@noble \
    --to=neilb@suse.com \
    --cc=andreas.dilger@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®