Commit eb26ebb8 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/lclient: Adjust NULL comparison codestyle

All instances of "x == NULL" are changed to "!x" and
"x != NULL" to "x"
Signed-off-by: default avatarOleg Drokin <green@linuxhacker.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ac49ca5
...@@ -117,7 +117,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key) ...@@ -117,7 +117,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)
struct ccc_thread_info *info; struct ccc_thread_info *info;
info = kmem_cache_alloc(ccc_thread_kmem, GFP_NOFS | __GFP_ZERO); info = kmem_cache_alloc(ccc_thread_kmem, GFP_NOFS | __GFP_ZERO);
if (info == NULL) if (!info)
info = ERR_PTR(-ENOMEM); info = ERR_PTR(-ENOMEM);
return info; return info;
} }
...@@ -136,7 +136,7 @@ void *ccc_session_key_init(const struct lu_context *ctx, ...@@ -136,7 +136,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,
struct ccc_session *session; struct ccc_session *session;
session = kmem_cache_alloc(ccc_session_kmem, GFP_NOFS | __GFP_ZERO); session = kmem_cache_alloc(ccc_session_kmem, GFP_NOFS | __GFP_ZERO);
if (session == NULL) if (!session)
session = ERR_PTR(-ENOMEM); session = ERR_PTR(-ENOMEM);
return session; return session;
} }
...@@ -173,7 +173,7 @@ int ccc_device_init(const struct lu_env *env, struct lu_device *d, ...@@ -173,7 +173,7 @@ int ccc_device_init(const struct lu_env *env, struct lu_device *d,
vdv = lu2ccc_dev(d); vdv = lu2ccc_dev(d);
vdv->cdv_next = lu2cl_dev(next); vdv->cdv_next = lu2cl_dev(next);
LASSERT(d->ld_site != NULL && next->ld_type != NULL); LASSERT(d->ld_site && next->ld_type);
next->ld_site = d->ld_site; next->ld_site = d->ld_site;
rc = next->ld_type->ldt_ops->ldto_device_init( rc = next->ld_type->ldt_ops->ldto_device_init(
env, next, next->ld_type->ldt_name, NULL); env, next, next->ld_type->ldt_name, NULL);
...@@ -211,12 +211,12 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env, ...@@ -211,12 +211,12 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env,
vdv->cdv_cl.cd_ops = clops; vdv->cdv_cl.cd_ops = clops;
site = kzalloc(sizeof(*site), GFP_NOFS); site = kzalloc(sizeof(*site), GFP_NOFS);
if (site != NULL) { if (site) {
rc = cl_site_init(site, &vdv->cdv_cl); rc = cl_site_init(site, &vdv->cdv_cl);
if (rc == 0) if (rc == 0)
rc = lu_site_init_finish(&site->cs_lu); rc = lu_site_init_finish(&site->cs_lu);
else { else {
LASSERT(lud->ld_site == NULL); LASSERT(!lud->ld_site);
CERROR("Cannot init lu_site, rc %d.\n", rc); CERROR("Cannot init lu_site, rc %d.\n", rc);
kfree(site); kfree(site);
} }
...@@ -236,7 +236,7 @@ struct lu_device *ccc_device_free(const struct lu_env *env, ...@@ -236,7 +236,7 @@ struct lu_device *ccc_device_free(const struct lu_env *env,
struct cl_site *site = lu2cl_site(d->ld_site); struct cl_site *site = lu2cl_site(d->ld_site);
struct lu_device *next = cl2lu_dev(vdv->cdv_next); struct lu_device *next = cl2lu_dev(vdv->cdv_next);
if (d->ld_site != NULL) { if (d->ld_site) {
cl_site_fini(site); cl_site_fini(site);
kfree(site); kfree(site);
} }
...@@ -252,7 +252,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev, ...@@ -252,7 +252,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,
int result; int result;
vrq = kmem_cache_alloc(ccc_req_kmem, GFP_NOFS | __GFP_ZERO); vrq = kmem_cache_alloc(ccc_req_kmem, GFP_NOFS | __GFP_ZERO);
if (vrq != NULL) { if (vrq) {
cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops); cl_req_slice_add(req, &vrq->crq_cl, dev, &ccc_req_ops);
result = 0; result = 0;
} else } else
...@@ -304,7 +304,7 @@ int ccc_global_init(struct lu_device_type *device_type) ...@@ -304,7 +304,7 @@ int ccc_global_init(struct lu_device_type *device_type)
void ccc_global_fini(struct lu_device_type *device_type) void ccc_global_fini(struct lu_device_type *device_type)
{ {
if (ccc_inode_fini_env != NULL) { if (ccc_inode_fini_env) {
cl_env_put(ccc_inode_fini_env, &dummy_refcheck); cl_env_put(ccc_inode_fini_env, &dummy_refcheck);
ccc_inode_fini_env = NULL; ccc_inode_fini_env = NULL;
} }
...@@ -328,7 +328,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env, ...@@ -328,7 +328,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
struct lu_object *obj; struct lu_object *obj;
vob = kmem_cache_alloc(ccc_object_kmem, GFP_NOFS | __GFP_ZERO); vob = kmem_cache_alloc(ccc_object_kmem, GFP_NOFS | __GFP_ZERO);
if (vob != NULL) { if (vob) {
struct cl_object_header *hdr; struct cl_object_header *hdr;
obj = ccc2lu(vob); obj = ccc2lu(vob);
...@@ -365,7 +365,7 @@ int ccc_object_init(const struct lu_env *env, struct lu_object *obj, ...@@ -365,7 +365,7 @@ int ccc_object_init(const struct lu_env *env, struct lu_object *obj,
under = &dev->cdv_next->cd_lu_dev; under = &dev->cdv_next->cd_lu_dev;
below = under->ld_ops->ldo_object_alloc(env, obj->lo_header, under); below = under->ld_ops->ldo_object_alloc(env, obj->lo_header, under);
if (below != NULL) { if (below) {
const struct cl_object_conf *cconf; const struct cl_object_conf *cconf;
cconf = lu2cl_conf(conf); cconf = lu2cl_conf(conf);
...@@ -397,7 +397,7 @@ int ccc_lock_init(const struct lu_env *env, ...@@ -397,7 +397,7 @@ int ccc_lock_init(const struct lu_env *env,
CLOBINVRNT(env, obj, ccc_object_invariant(obj)); CLOBINVRNT(env, obj, ccc_object_invariant(obj));
clk = kmem_cache_alloc(ccc_lock_kmem, GFP_NOFS | __GFP_ZERO); clk = kmem_cache_alloc(ccc_lock_kmem, GFP_NOFS | __GFP_ZERO);
if (clk != NULL) { if (clk) {
cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops); cl_lock_slice_add(lock, &clk->clk_cl, obj, lkops);
result = 0; result = 0;
} else } else
...@@ -660,7 +660,7 @@ void ccc_io_update_iov(const struct lu_env *env, ...@@ -660,7 +660,7 @@ void ccc_io_update_iov(const struct lu_env *env,
{ {
size_t size = io->u.ci_rw.crw_count; size_t size = io->u.ci_rw.crw_count;
if (!cl_is_normalio(env, io) || cio->cui_iter == NULL) if (!cl_is_normalio(env, io) || !cio->cui_iter)
return; return;
iov_iter_truncate(cio->cui_iter, size); iov_iter_truncate(cio->cui_iter, size);
...@@ -749,7 +749,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj, ...@@ -749,7 +749,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
*/ */
ccc_object_size_unlock(obj); ccc_object_size_unlock(obj);
result = cl_glimpse_lock(env, io, inode, obj, 0); result = cl_glimpse_lock(env, io, inode, obj, 0);
if (result == 0 && exceed != NULL) { if (result == 0 && exceed) {
/* If objective page index exceed end-of-file /* If objective page index exceed end-of-file
* page index, return directly. Do not expect * page index, return directly. Do not expect
* kernel will check such case correctly. * kernel will check such case correctly.
...@@ -1022,7 +1022,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) ...@@ -1022,7 +1022,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md)
fid = &lli->lli_fid; fid = &lli->lli_fid;
LASSERT(fid_is_sane(fid)); LASSERT(fid_is_sane(fid));
if (lli->lli_clob == NULL) { if (!lli->lli_clob) {
/* clob is slave of inode, empty lli_clob means for new inode, /* clob is slave of inode, empty lli_clob means for new inode,
* there is no clob in cache with the given fid, so it is * there is no clob in cache with the given fid, so it is
* unnecessary to perform lookup-alloc-lookup-insert, just * unnecessary to perform lookup-alloc-lookup-insert, just
...@@ -1098,7 +1098,7 @@ void cl_inode_fini(struct inode *inode) ...@@ -1098,7 +1098,7 @@ void cl_inode_fini(struct inode *inode)
int refcheck; int refcheck;
int emergency; int emergency;
if (clob != NULL) { if (clob) {
void *cookie; void *cookie;
cookie = cl_env_reenter(); cookie = cl_env_reenter();
...@@ -1106,7 +1106,7 @@ void cl_inode_fini(struct inode *inode) ...@@ -1106,7 +1106,7 @@ void cl_inode_fini(struct inode *inode)
emergency = IS_ERR(env); emergency = IS_ERR(env);
if (emergency) { if (emergency) {
mutex_lock(&ccc_inode_fini_guard); mutex_lock(&ccc_inode_fini_guard);
LASSERT(ccc_inode_fini_env != NULL); LASSERT(ccc_inode_fini_env);
cl_env_implant(ccc_inode_fini_env, &refcheck); cl_env_implant(ccc_inode_fini_env, &refcheck);
env = ccc_inode_fini_env; env = ccc_inode_fini_env;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment