summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2016-02-16 00:46:47 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 14:33:11 -0800
commit44b53f18cac7b9b5c3d309f98d4f6a1da344aad2 (patch)
tree2eff984809415585bef400e8c5a407b1349c67a4 /drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
parent6e16818b2438f5cb36500e2df26e9e1d11849cbe (diff)
downloadop-kernel-dev-44b53f18cac7b9b5c3d309f98d4f6a1da344aad2.zip
op-kernel-dev-44b53f18cac7b9b5c3d309f98d4f6a1da344aad2.tar.gz
staging/lustre/ldlm: Adjust NULL comparison codestyle
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x" Also remove some redundant assertions. Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lustre/ldlm/ldlm_resource.c')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_resource.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 0ae6100..6ae8c60 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -380,7 +380,7 @@ static void ldlm_namespace_debugfs_unregister(struct ldlm_namespace *ns)
else
ldebugfs_remove(&ns->ns_debugfs_entry);
- if (ns->ns_stats != NULL)
+ if (ns->ns_stats)
lprocfs_free_stats(&ns->ns_stats);
}
@@ -400,7 +400,7 @@ static int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns)
"%s", ldlm_ns_name(ns));
ns->ns_stats = lprocfs_alloc_stats(LDLM_NSS_LAST, 0);
- if (ns->ns_stats == NULL) {
+ if (!ns->ns_stats) {
kobject_put(&ns->ns_kobj);
return -ENOMEM;
}
@@ -420,7 +420,7 @@ static int ldlm_namespace_debugfs_register(struct ldlm_namespace *ns)
} else {
ns_entry = debugfs_create_dir(ldlm_ns_name(ns),
ldlm_ns_debugfs_dir);
- if (ns_entry == NULL)
+ if (!ns_entry)
return -ENOMEM;
ns->ns_debugfs_entry = ns_entry;
}
@@ -631,7 +631,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
int idx;
int rc;
- LASSERT(obd != NULL);
+ LASSERT(obd);
rc = ldlm_get_ref();
if (rc) {
@@ -664,7 +664,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,
CFS_HASH_BIGNAME |
CFS_HASH_SPIN_BKTLOCK |
CFS_HASH_NO_ITEMREF);
- if (ns->ns_rs_hash == NULL)
+ if (!ns->ns_rs_hash)
goto out_ns;
cfs_hash_for_each_bucket(ns->ns_rs_hash, &bd, idx) {
@@ -763,7 +763,7 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,
break;
}
- if (lock == NULL) {
+ if (!lock) {
unlock_res(res);
break;
}
@@ -837,7 +837,7 @@ static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd,
*/
int ldlm_namespace_cleanup(struct ldlm_namespace *ns, __u64 flags)
{
- if (ns == NULL) {
+ if (!ns) {
CDEBUG(D_INFO, "NULL ns, skipping cleanup\n");
return ELDLM_OK;
}
@@ -1032,7 +1032,7 @@ static struct ldlm_resource *ldlm_resource_new(void)
int idx;
res = kmem_cache_alloc(ldlm_resource_slab, GFP_NOFS | __GFP_ZERO);
- if (res == NULL)
+ if (!res)
return NULL;
INIT_LIST_HEAD(&res->lr_granted);
@@ -1073,14 +1073,13 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
__u64 version;
int ns_refcount = 0;
- LASSERT(ns != NULL);
- LASSERT(parent == NULL);
- LASSERT(ns->ns_rs_hash != NULL);
+ LASSERT(!parent);
+ LASSERT(ns->ns_rs_hash);
LASSERT(name->name[0] != 0);
cfs_hash_bd_get_and_lock(ns->ns_rs_hash, (void *)name, &bd, 0);
hnode = cfs_hash_bd_lookup_locked(ns->ns_rs_hash, &bd, (void *)name);
- if (hnode != NULL) {
+ if (hnode) {
cfs_hash_bd_unlock(ns->ns_rs_hash, &bd, 0);
res = hlist_entry(hnode, struct ldlm_resource, lr_hash);
/* Synchronize with regard to resource creation. */
@@ -1117,7 +1116,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
hnode = (version == cfs_hash_bd_version_get(&bd)) ? NULL :
cfs_hash_bd_lookup_locked(ns->ns_rs_hash, &bd, (void *)name);
- if (hnode != NULL) {
+ if (hnode) {
/* Someone won the race and already added the resource. */
cfs_hash_bd_unlock(ns->ns_rs_hash, &bd, 1);
/* Clean lu_ref for failed resource. */
OpenPOWER on IntegriCloud