staging: lustre: lnet: discard CFS_ALLOC_PTR
authorNeilBrown <neilb@suse.com>
Mon, 18 Dec 2017 00:46:30 +0000 (11:46 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jan 2018 15:03:45 +0000 (16:03 +0100)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
drivers/staging/lustre/lnet/lnet/net_fault.c

index 940200ee632e09395414bab07cd37bc158754a6b..d230c7f7cced6104179372c37aee5b81b1ecf52e 100644 (file)
@@ -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 */
index 0ee7e20ba151c9fc6b458da81f16ff4b4a9a293b..e3468cef273b95c615ff33508e86010ed304ef33 100644 (file)
@@ -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);
        }
 }
 
@@ -739,7 +739,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;
 
@@ -793,7 +793,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;
 }