struct lov_session *ses;
ses = lu_context_key_get(env->le_ses, &lov_session_key);
- LASSERT(ses != NULL);
+ LASSERT(ses);
return ses;
}
const struct cl_lock_slice *slice;
slice = cl_lock_at(lock, &lovsub_device_type);
- LASSERT(slice != NULL);
+ LASSERT(slice);
return cl2lovsub_lock(slice);
}
struct lov_thread_info *info;
info = lu_context_key_get(&env->le_ctx, &lov_key);
- LASSERT(info != NULL);
+ LASSERT(info);
return info;
}
struct lov_thread_info *info;
info = kmem_cache_alloc(lov_thread_kmem, GFP_NOFS | __GFP_ZERO);
- if (info != NULL)
+ if (info)
INIT_LIST_HEAD(&info->lti_closure.clc_list);
else
info = ERR_PTR(-ENOMEM);
struct lov_session *info;
info = kmem_cache_alloc(lov_session_kmem, GFP_NOFS | __GFP_ZERO);
- if (info == NULL)
+ if (!info)
info = ERR_PTR(-ENOMEM);
return info;
}
int i;
struct lov_device *ld = lu2lov_dev(d);
- LASSERT(ld->ld_lov != NULL);
- if (ld->ld_target == NULL)
+ LASSERT(ld->ld_lov);
+ if (!ld->ld_target)
return NULL;
lov_foreach_target(ld, i) {
struct lovsub_device *lsd;
lsd = ld->ld_target[i];
- if (lsd != NULL) {
+ if (lsd) {
cl_stack_fini(env, lovsub2cl_dev(lsd));
ld->ld_target[i] = NULL;
}
int i;
int rc = 0;
- LASSERT(d->ld_site != NULL);
- if (ld->ld_target == NULL)
+ LASSERT(d->ld_site);
+ if (!ld->ld_target)
return rc;
lov_foreach_target(ld, i) {
struct lov_tgt_desc *desc;
desc = ld->ld_lov->lov_tgts[i];
- if (desc == NULL)
+ if (!desc)
continue;
cl = cl_type_setup(env, d->ld_site, &lovsub_device_type,
int result;
lr = kmem_cache_alloc(lov_req_kmem, GFP_NOFS | __GFP_ZERO);
- if (lr != NULL) {
+ if (lr) {
cl_req_slice_add(req, &lr->lr_cl, dev, &lov_req_ops);
result = 0;
} else
struct lov_device_emerg *em;
em = emrg[i];
- if (em != NULL) {
+ if (em) {
LASSERT(em->emrg_page_list.pl_nr == 0);
- if (em->emrg_env != NULL)
+ if (em->emrg_env)
cl_env_put(em->emrg_env, &em->emrg_refcheck);
kfree(em);
}
cl_device_fini(lu2cl_dev(d));
kfree(ld->ld_target);
- if (ld->ld_emrg != NULL)
+ if (ld->ld_emrg)
lov_emerg_free(ld->ld_emrg, nr);
kfree(ld);
return NULL;
{
struct lov_device *ld = lu2lov_dev(dev);
- if (ld->ld_target[index] != NULL) {
+ if (ld->ld_target[index]) {
cl_stack_fini(env, lovsub2cl_dev(ld->ld_target[index]));
ld->ld_target[index] = NULL;
}
int result;
emerg = kcalloc(nr, sizeof(emerg[0]), GFP_NOFS);
- if (emerg == NULL)
+ if (!emerg)
return ERR_PTR(-ENOMEM);
for (result = i = 0; i < nr && result == 0; i++) {
struct lov_device_emerg *em;
em = kzalloc(sizeof(*em), GFP_NOFS);
- if (em != NULL) {
+ if (em) {
emerg[i] = em;
cl_page_list_init(&em->emrg_page_list);
em->emrg_env = cl_env_alloc(&em->emrg_refcheck,
return PTR_ERR(emerg);
newd = kcalloc(tgt_size, sz, GFP_NOFS);
- if (newd != NULL) {
+ if (newd) {
mutex_lock(&dev->ld_mutex);
if (sub_size > 0) {
memcpy(newd, dev->ld_target, sub_size * sz);
dev->ld_target = newd;
dev->ld_target_nr = tgt_size;
- if (dev->ld_emrg != NULL)
+ if (dev->ld_emrg)
lov_emerg_free(dev->ld_emrg, sub_size);
dev->ld_emrg = emerg;
mutex_unlock(&dev->ld_mutex);
obd_getref(obd);
tgt = obd->u.lov.lov_tgts[index];
- LASSERT(tgt != NULL);
- LASSERT(tgt->ltd_obd != NULL);
if (!tgt->ltd_obd->obd_set_up) {
CERROR("Target %s not set up\n", obd_uuid2str(&tgt->ltd_uuid));
rc = lov_expand_targets(env, ld);
if (rc == 0 && ld->ld_flags & LOV_DEV_INITIALIZED) {
- LASSERT(dev->ld_site != NULL);
+ LASSERT(dev->ld_site);
cl = cl_type_setup(env, dev->ld_site, &lovsub_device_type,
tgt->ltd_obd->obd_lu_dev);
/* setup the LOV OBD */
obd = class_name2obd(lustre_cfg_string(cfg, 0));
- LASSERT(obd != NULL);
+ LASSERT(obd);
rc = lov_setup(obd, cfg);
if (rc) {
lov_device_free(env, d);
for (i = 0; i < stripe_count; i++) {
loi = kmem_cache_alloc(lov_oinfo_slab, GFP_NOFS | __GFP_ZERO);
- if (loi == NULL)
+ if (!loi)
goto err;
lsm->lsm_oinfo[i] = loi;
}
{
struct obd_import *imp = tgt->ltd_obd->u.cli.cl_import;
- if (imp == NULL || !tgt->ltd_active) {
+ if (!imp || !tgt->ltd_active) {
*stripe_maxbytes = LUSTRE_STRIPE_MAXBYTES;
return;
}
static inline void lov_get_reqset(struct lov_request_set *set)
{
- LASSERT(set != NULL);
LASSERT(atomic_read(&set->set_refcount) > 0);
atomic_inc(&set->set_refcount);
}
static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio,
struct lov_io_sub *sub)
{
- if (sub->sub_io != NULL) {
+ if (sub->sub_io) {
if (sub->sub_io_initialized) {
lov_sub_enter(sub);
cl_io_fini(sub->sub_env, sub->sub_io);
kfree(sub->sub_io);
sub->sub_io = NULL;
}
- if (sub->sub_env != NULL && !IS_ERR(sub->sub_env)) {
+ if (!IS_ERR_OR_NULL(sub->sub_env)) {
if (!sub->sub_borrowed)
cl_env_put(sub->sub_env, &sub->sub_refcheck);
sub->sub_env = NULL;
int stripe = sub->sub_stripe;
int result;
- LASSERT(sub->sub_io == NULL);
- LASSERT(sub->sub_env == NULL);
+ LASSERT(!sub->sub_io);
+ LASSERT(!sub->sub_env);
LASSERT(sub->sub_stripe < lio->lis_stripe_count);
- if (unlikely(lov_r0(lov)->lo_sub[stripe] == NULL))
+ if (unlikely(!lov_r0(lov)->lo_sub[stripe]))
return -EIO;
result = 0;
subobj = lu2lovsub(
lu_object_locate(page->cp_child->cp_obj->co_lu.lo_header,
&lovsub_device_type));
- LASSERT(subobj != NULL);
return subobj->lso_index;
}
struct cl_page *page = slice->cpl_page;
int stripe;
- LASSERT(lio->lis_cl.cis_io != NULL);
+ LASSERT(lio->lis_cl.cis_io);
LASSERT(cl2lov(slice->cpl_obj) == lio->lis_object);
- LASSERT(lsm != NULL);
+ LASSERT(lsm);
LASSERT(lio->lis_nr_subios > 0);
stripe = lov_page_stripe(page);
struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;
int result;
- LASSERT(lio->lis_object != NULL);
+ LASSERT(lio->lis_object);
/*
* Need to be optimized, we can't afford to allocate a piece of memory
libcfs_kvzalloc(lsm->lsm_stripe_count *
sizeof(lio->lis_subs[0]),
GFP_NOFS);
- if (lio->lis_subs != NULL) {
+ if (lio->lis_subs) {
lio->lis_nr_subios = lio->lis_stripe_count;
lio->lis_single_subio_index = -1;
lio->lis_active_subios = 0;
io->ci_result = 0;
lio->lis_object = obj;
- LASSERT(obj->lo_lsm != NULL);
lio->lis_stripe_count = obj->lo_lsm->lsm_stripe_count;
switch (io->ci_type) {
struct lov_object *lov = cl2lov(ios->cis_obj);
int i;
- if (lio->lis_subs != NULL) {
+ if (lio->lis_subs) {
for (i = 0; i < lio->lis_nr_subios; i++)
lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
kvfree(lio->lis_subs);
endpos, &start, &end))
continue;
- if (unlikely(lov_r0(lio->lis_object)->lo_sub[stripe] == NULL)) {
+ if (unlikely(!lov_r0(lio->lis_object)->lo_sub[stripe])) {
if (ios->cis_io->ci_type == CIT_READ ||
ios->cis_io->ci_type == CIT_WRITE ||
ios->cis_io->ci_type == CIT_FAULT)
return rc;
}
- LASSERT(lio->lis_subs != NULL);
+ LASSERT(lio->lis_subs);
if (alloc) {
stripes_qin =
libcfs_kvzalloc(sizeof(*stripes_qin) *
lio->lis_nr_subios,
GFP_NOFS);
- if (stripes_qin == NULL)
+ if (!stripes_qin)
return -ENOMEM;
for (stripe = 0; stripe < lio->lis_nr_subios; stripe++)
struct lov_io *lio = lov_env_io(env);
int result;
- LASSERT(lov->lo_lsm != NULL);
+ LASSERT(lov->lo_lsm);
lio->lis_object = lov;
switch (io->ci_type) {
/*
* check that sub-lock doesn't have lock link to this top-lock.
*/
- LASSERT(lov_lock_link_find(env, lck, lsl) == NULL);
+ LASSERT(!lov_lock_link_find(env, lck, lsl));
LASSERT(idx < lck->lls_nr);
lck->lls_sub[idx].sub_lock = lsl;
LASSERT(idx < lck->lls_nr);
link = kmem_cache_alloc(lov_lock_link_kmem, GFP_NOFS | __GFP_ZERO);
- if (link != NULL) {
+ if (link) {
struct lov_sublock_env *subenv;
struct lov_lock_sub *lls;
struct cl_lock_descr *descr;
LASSERT(!(lls->sub_flags & LSF_HELD));
link = lov_lock_link_find(env, lck, sublock);
- LASSERT(link != NULL);
+ LASSERT(link);
lov_lock_unlink(env, link, sublock);
lov_sublock_unlock(env, sublock, closure, NULL);
lck->lls_cancel_race = 1;
* XXX for wide striping smarter algorithm is desirable,
* breaking out of the loop, early.
*/
- if (likely(r0->lo_sub[i] != NULL) &&
+ if (likely(r0->lo_sub[i]) &&
lov_stripe_intersects(loo->lo_lsm, i,
file_start, file_end, &start, &end))
nr++;
}
LASSERT(nr > 0);
lck->lls_sub = libcfs_kvzalloc(nr * sizeof(lck->lls_sub[0]), GFP_NOFS);
- if (lck->lls_sub == NULL)
+ if (!lck->lls_sub)
return -ENOMEM;
lck->lls_nr = nr;
* top-lock.
*/
for (i = 0, nr = 0; i < r0->lo_nr; ++i) {
- if (likely(r0->lo_sub[i] != NULL) &&
+ if (likely(r0->lo_sub[i]) &&
lov_stripe_intersects(loo->lo_lsm, i,
file_start, file_end, &start, &end)) {
struct cl_lock_descr *descr;
descr = &lck->lls_sub[nr].sub_descr;
- LASSERT(descr->cld_obj == NULL);
+ LASSERT(!descr->cld_obj);
descr->cld_obj = lovsub2cl(r0->lo_sub[i]);
descr->cld_start = cl_index(descr->cld_obj, start);
descr->cld_end = cl_index(descr->cld_obj, end);
struct cl_lock *sublock;
int dying;
- LASSERT(lck->lls_sub[i].sub_lock != NULL);
sublock = lck->lls_sub[i].sub_lock->lss_cl.cls_lock;
LASSERT(cl_lock_is_mutexed(sublock));
if (!(lck->lls_sub[i].sub_flags & LSF_HELD)) {
struct cl_lock *sublock;
- LASSERT(lck->lls_sub[i].sub_lock != NULL);
sublock = lck->lls_sub[i].sub_lock->lss_cl.cls_lock;
LASSERT(cl_lock_is_mutexed(sublock));
LASSERT(sublock->cll_state != CLS_FREEING);
lck = cl2lov_lock(slice);
LASSERT(lck->lls_nr_filled == 0);
- if (lck->lls_sub != NULL) {
+ if (lck->lls_sub) {
for (i = 0; i < lck->lls_nr; ++i)
/*
* No sub-locks exists at this point, as sub-lock has
* a reference on its parent.
*/
- LASSERT(lck->lls_sub[i].sub_lock == NULL);
+ LASSERT(!lck->lls_sub[i].sub_lock);
kvfree(lck->lls_sub);
}
kmem_cache_free(lov_lock_kmem, lck);
if (!IS_ERR(sublock)) {
cl_lock_get_trust(sublock);
if (parent->cll_state == CLS_QUEUING &&
- lck->lls_sub[idx].sub_lock == NULL) {
+ !lck->lls_sub[idx].sub_lock) {
lov_sublock_adopt(env, lck, sublock, idx, link);
} else {
kmem_cache_free(lov_lock_link_kmem, link);
* Sub-lock might have been canceled, while top-lock was
* cached.
*/
- if (sub == NULL) {
+ if (!sub) {
result = lov_sublock_fill(env, lock, io, lck, i);
/* lov_sublock_fill() released @lock mutex,
* restart. */
break;
}
} else {
- LASSERT(sublock->cll_conflict == NULL);
+ LASSERT(!sublock->cll_conflict);
lov_sublock_unlock(env, sub, closure, subenv);
}
}
LASSERT(slice->cls_lock->cll_state == CLS_INTRANSIT);
lls = &lck->lls_sub[i];
sub = lls->sub_lock;
- if (sub == NULL)
+ if (!sub)
continue;
sublock = sub->lss_cl.cls_lock;
* to the completion. */
lls = &lck->lls_sub[i];
sub = lls->sub_lock;
- if (sub == NULL)
+ if (!sub)
continue;
sublock = sub->lss_cl.cls_lock;
lls = &lck->lls_sub[i];
sub = lls->sub_lock;
- LASSERT(sub != NULL);
sublock = sub->lss_cl.cls_lock;
rc = lov_sublock_lock(env, lck, lls, closure, &subenv);
if (rc == 0) {
lls = &lck->lls_sub[i];
sub = lls->sub_lock;
- if (sub == NULL) {
+ if (!sub) {
/*
* Sub-lock might have been canceled, while top-lock was
* cached.
idx = lov_stripe_number(lsm, start);
if (idx == stripe ||
- unlikely(lov_r0(lov)->lo_sub[idx] == NULL)) {
+ unlikely(!lov_r0(lov)->lo_sub[idx])) {
idx = lov_stripe_number(lsm, end);
if (idx == stripe ||
- unlikely(lov_r0(lov)->lo_sub[idx] == NULL))
+ unlikely(!lov_r0(lov)->lo_sub[idx]))
result = 1;
}
}
struct lov_lock_sub *lls = &lck->lls_sub[i];
struct lovsub_lock *lsl = lls->sub_lock;
- if (lsl == NULL) /* already removed */
+ if (!lsl) /* already removed */
continue;
rc = lov_sublock_lock(env, lck, lls, closure, NULL);
lov_sublock_release(env, lck, i, 1, 0);
link = lov_lock_link_find(env, lck, lsl);
- LASSERT(link != NULL);
+ LASSERT(link);
lov_lock_unlink(env, link, lsl);
- LASSERT(lck->lls_sub[i].sub_lock == NULL);
+ LASSERT(!lck->lls_sub[i].sub_lock);
lov_sublock_unlock(env, lsl, closure, NULL);
}
sub = &lck->lls_sub[i];
(*p)(env, cookie, " %d %x: ", i, sub->sub_flags);
- if (sub->sub_lock != NULL)
+ if (sub->sub_lock)
cl_lock_print(env, cookie, p,
sub->sub_lock->lss_cl.cls_lock);
else
int result;
lck = kmem_cache_alloc(lov_lock_kmem, GFP_NOFS | __GFP_ZERO);
- if (lck != NULL) {
+ if (lck) {
cl_lock_slice_add(lock, &lck->lls_cl, obj, &lov_lock_ops);
result = lov_lock_sub_init(env, lck, io);
} else
int result = -ENOMEM;
lck = kmem_cache_alloc(lov_lock_kmem, GFP_NOFS | __GFP_ZERO);
- if (lck != NULL) {
+ if (lck) {
cl_lock_slice_add(lock, &lck->lls_cl, obj, &lov_empty_lock_ops);
lck->lls_orig = lock->cll_descr;
result = 0;
* LU-642, initially inactive OSC could miss the obd_connect,
* we make up for it here.
*/
- if (ev == OBD_NOTIFY_ACTIVATE && tgt->ltd_exp == NULL &&
+ if (ev == OBD_NOTIFY_ACTIVATE && !tgt->ltd_exp &&
obd_uuid_equals(uuid, &tgt->ltd_uuid)) {
struct obd_uuid lov_osc_uuid = {"LOV_OSC_UUID"};
tgt_obd = class_find_client_obd(uuidp, LUSTRE_OSC_NAME,
&obd->obd_uuid);
- if (tgt_obd == NULL)
+ if (!tgt_obd)
return -EINVAL;
mutex_lock(&lov->lov_lock);
- if ((index < lov->lov_tgt_size) && (lov->lov_tgts[index] != NULL)) {
+ if ((index < lov->lov_tgt_size) && lov->lov_tgts[index]) {
tgt = lov->lov_tgts[index];
CERROR("UUID %s already assigned at LOV target index %d\n",
obd_uuid2str(&tgt->ltd_uuid), index);
while (newsize < index + 1)
newsize <<= 1;
newtgts = kcalloc(newsize, sizeof(*newtgts), GFP_NOFS);
- if (newtgts == NULL) {
+ if (!newtgts) {
mutex_unlock(&lov->lov_lock);
return -ENOMEM;
}
goto out;
}
- if (lov->lov_cache != NULL) {
+ if (lov->lov_cache) {
rc = obd_set_info_async(NULL, tgt->ltd_exp,
sizeof(KEY_CACHE_SET), KEY_CACHE_SET,
sizeof(struct cl_client_cache), lov->lov_cache,
ost_idx = src_oa->o_nlink;
lsm = *ea;
- if (lsm == NULL) {
+ if (!lsm) {
rc = -EINVAL;
goto out;
}
struct lov_obd *lov;
int rc = 0;
- LASSERT(ea != NULL);
- if (exp == NULL)
+ LASSERT(ea);
+ if (!exp)
return -EINVAL;
if ((src_oa->o_valid & OBD_MD_FLFLAGS) &&
#define ASSERT_LSM_MAGIC(lsmp) \
do { \
- LASSERT((lsmp) != NULL); \
+ LASSERT((lsmp)); \
LASSERTF(((lsmp)->lsm_magic == LOV_MAGIC_V1 || \
(lsmp)->lsm_magic == LOV_MAGIC_V3), \
"%p->lsm_magic=%x\n", (lsmp), (lsmp)->lsm_magic); \
}
}
- if (rc == 0) {
- LASSERT(lsm_op_find(lsm->lsm_magic) != NULL);
+ if (rc == 0)
rc = lsm_op_find(lsm->lsm_magic)->lsm_destroy(lsm, oa, md_exp);
- }
+
err = lov_fini_destroy_set(set);
out:
obd_putref(exp->exp_obd);
if (!list_empty(&rqset->set_requests)) {
LASSERT(rc == 0);
- LASSERT(rqset->set_interpret == NULL);
+ LASSERT(!rqset->set_interpret);
rqset->set_interpret = lov_getattr_interpret;
rqset->set_arg = (void *)lovset;
return rc;
return rc ? rc : err;
}
- LASSERT(rqset->set_interpret == NULL);
+ LASSERT(!rqset->set_interpret);
rqset->set_interpret = lov_setattr_interpret;
rqset->set_arg = (void *)set;
struct lov_obd *lov;
int rc = 0;
- LASSERT(oinfo != NULL);
- LASSERT(oinfo->oi_osfs != NULL);
+ LASSERT(oinfo->oi_osfs);
lov = &obd->u.lov;
rc = lov_prep_statfs_set(obd, oinfo, &set);
return rc ? rc : err;
}
- LASSERT(rqset->set_interpret == NULL);
+ LASSERT(!rqset->set_interpret);
rqset->set_interpret = lov_statfs_interpret;
rqset->set_arg = (void *)set;
return 0;
/* for obdclass we forbid using obd_statfs_rqset, but prefer using async
* statfs requests */
set = ptlrpc_prep_set();
- if (set == NULL)
+ if (!set)
return -ENOMEM;
oinfo.oi_osfs = osfs;
&qctl->obd_uuid))
continue;
- if (tgt->ltd_exp == NULL)
+ if (!tgt->ltd_exp)
return -EINVAL;
break;
buffer_size = fiemap_count_to_size(fm_key->fiemap.fm_extent_count);
fm_local = libcfs_kvzalloc(buffer_size, GFP_NOFS);
- if (fm_local == NULL) {
+ if (!fm_local) {
rc = -ENOMEM;
goto out;
}
unsigned next_id = 0, mds_con = 0;
incr = check_uuid = do_inactive = no_set = 0;
- if (set == NULL) {
+ if (!set) {
no_set = 1;
set = ptlrpc_prep_set();
if (!set)
} else if (KEY_IS(KEY_MDS_CONN)) {
mds_con = 1;
} else if (KEY_IS(KEY_CACHE_SET)) {
- LASSERT(lov->lov_cache == NULL);
+ LASSERT(!lov->lov_cache);
lov->lov_cache = val;
do_inactive = 1;
}
lov_oinfo_slab = kmem_cache_create("lov_oinfo",
sizeof(struct lov_oinfo),
0, SLAB_HWCACHE_ALIGN, NULL);
- if (lov_oinfo_slab == NULL) {
+ if (!lov_oinfo_slab) {
lu_kmem_fini(lov_caches);
return -ENOMEM;
}
/* reuse ->coh_attr_guard to protect coh_parent change */
spin_lock(&subhdr->coh_attr_guard);
parent = subhdr->coh_parent;
- if (parent == NULL) {
+ if (!parent) {
subhdr->coh_parent = hdr;
spin_unlock(&subhdr->coh_attr_guard);
subhdr->coh_nesting = hdr->coh_nesting + 1;
spin_unlock(&subhdr->coh_attr_guard);
old_obj = lu_object_locate(&parent->coh_lu, &lov_device_type);
- LASSERT(old_obj != NULL);
+ LASSERT(old_obj);
old_lov = cl2lov(lu2cl(old_obj));
if (old_lov->lo_layout_invalid) {
/* the object's layout has already changed but isn't
LOV_MAGIC_V1, LOV_MAGIC_V3, lsm->lsm_magic);
}
- LASSERT(lov->lo_lsm == NULL);
+ LASSERT(!lov->lo_lsm);
lov->lo_lsm = lsm_addref(lsm);
r0->lo_nr = lsm->lsm_stripe_count;
LASSERT(r0->lo_nr <= lov_targets_nr(dev));
r0->lo_sub = libcfs_kvzalloc(r0->lo_nr * sizeof(r0->lo_sub[0]),
GFP_NOFS);
- if (r0->lo_sub != NULL) {
+ if (r0->lo_sub) {
result = 0;
subconf->coc_inode = conf->coc_inode;
spin_lock_init(&r0->lo_sub_lock);
subdev = lovsub2cl_dev(dev->ld_target[ost_idx]);
subconf->u.coc_oinfo = oinfo;
- LASSERTF(subdev != NULL, "not init ost %d\n", ost_idx);
+ LASSERTF(subdev, "not init ost %d\n", ost_idx);
/* In the function below, .hs_keycmp resolves to
* lu_obj_hop_keycmp() */
/* coverity[overrun-buffer-val] */
{
struct lov_stripe_md *lsm = conf->u.coc_md->lsm;
- LASSERT(lsm != NULL);
+ LASSERT(lsm);
LASSERT(lsm_is_released(lsm));
- LASSERT(lov->lo_lsm == NULL);
+ LASSERT(!lov->lo_lsm);
lov->lo_lsm = lsm_addref(lsm);
return 0;
}
remove_wait_queue(&bkt->lsb_marche_funebre, waiter);
}
- LASSERT(r0->lo_sub[idx] == NULL);
+ LASSERT(!r0->lo_sub[idx]);
}
static int lov_delete_raid0(const struct lu_env *env, struct lov_object *lov,
dump_lsm(D_INODE, lsm);
lov_layout_wait(env, lov);
- if (r0->lo_sub != NULL) {
+ if (r0->lo_sub) {
for (i = 0; i < r0->lo_nr; ++i) {
struct lovsub_object *los = r0->lo_sub[i];
- if (los != NULL) {
+ if (los) {
cl_locks_prune(env, &los->lso_cl, 1);
/*
* If top-level object is to be evicted from
{
struct lov_layout_raid0 *r0 = &state->raid0;
- if (r0->lo_sub != NULL) {
+ if (r0->lo_sub) {
kvfree(r0->lo_sub);
r0->lo_sub = NULL;
}
for (i = 0; i < r0->lo_nr; ++i) {
struct lu_object *sub;
- if (r0->lo_sub[i] != NULL) {
+ if (r0->lo_sub[i]) {
sub = lovsub2lu(r0->lo_sub[i]);
lu_object_print(env, cookie, p, sub);
} else {
*/
static enum lov_layout_type lov_type(struct lov_stripe_md *lsm)
{
- if (lsm == NULL)
+ if (!lsm)
return LLT_EMPTY;
if (lsm_is_released(lsm))
return LLT_RELEASED;
{
LASSERT(lov->lo_owner != current);
down_write(&lov->lo_type_guard);
- LASSERT(lov->lo_owner == NULL);
+ LASSERT(!lov->lo_owner);
lov->lo_owner = current;
}
LASSERT(0 <= lov->lo_type && lov->lo_type < ARRAY_SIZE(lov_dispatch));
- if (conf->u.coc_md != NULL)
+ if (conf->u.coc_md)
llt = lov_type(conf->u.coc_md->lsm);
LASSERT(0 <= llt && llt < ARRAY_SIZE(lov_dispatch));
old_ops->llo_fini(env, lov, &lov->u);
LASSERT(atomic_read(&lov->lo_active_ios) == 0);
- LASSERT(hdr->coh_tree.rnode == NULL);
+ LASSERT(!hdr->coh_tree.rnode);
LASSERT(hdr->coh_pages == 0);
lov->lo_type = LLT_EMPTY;
LASSERT(conf->coc_opc == OBJECT_CONF_SET);
- if (conf->u.coc_md != NULL)
+ if (conf->u.coc_md)
lsm = conf->u.coc_md->lsm;
- if ((lsm == NULL && lov->lo_lsm == NULL) ||
- ((lsm != NULL && lov->lo_lsm != NULL) &&
+ if ((!lsm && !lov->lo_lsm) ||
+ ((lsm && lov->lo_lsm) &&
(lov->lo_lsm->lsm_layout_gen == lsm->lsm_layout_gen) &&
(lov->lo_lsm->lsm_pattern == lsm->lsm_pattern))) {
/* same version of layout */
struct lu_object *obj;
lov = kmem_cache_alloc(lov_object_kmem, GFP_NOFS | __GFP_ZERO);
- if (lov != NULL) {
+ if (lov) {
obj = lov2lu(lov);
lu_object_init(obj, NULL, dev);
lov->lo_cl.co_ops = &lov_ops;
struct lov_stripe_md *lsm = NULL;
lov_conf_freeze(lov);
- if (lov->lo_lsm != NULL) {
+ if (lov->lo_lsm) {
lsm = lsm_addref(lov->lo_lsm);
CDEBUG(D_INODE, "lsm %p addref %d/%d by %p.\n",
lsm, atomic_read(&lsm->lsm_refc),
struct lu_object *luobj;
struct lov_stripe_md *lsm = NULL;
- if (clobj == NULL)
+ if (!clobj)
return NULL;
luobj = lu_object_locate(&cl_object_header(clobj)->coh_lu,
&lov_device_type);
- if (luobj != NULL)
+ if (luobj)
lsm = lov_lsm_addref(lu2lov(luobj));
return lsm;
}
void lov_lsm_put(struct cl_object *unused, struct lov_stripe_md *lsm)
{
- if (lsm != NULL)
+ if (lsm)
lov_free_memmd(&lsm);
}
EXPORT_SYMBOL(lov_lsm_put);
luobj = lu_object_locate(&cl_object_header(clob)->coh_lu,
&lov_device_type);
- if (luobj != NULL) {
+ if (luobj) {
struct lov_object *lov = lu2lov(luobj);
lov_conf_freeze(lov);
int i;
lsm = lov->lo_lsm;
- LASSERT(lsm != NULL);
for (i = 0; i < lsm->lsm_stripe_count; i++) {
struct lov_oinfo *loi = lsm->lsm_oinfo[i];
if (ost_size == 0)
return 0;
- LASSERT(lsm_op_find(magic) != NULL);
lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, NULL, &swidth);
/* lov_do_div64(a, b) returns a % b, and a = a / b */
return 0;
}
- LASSERT(lsm_op_find(magic) != NULL);
-
lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, &lov_off,
&swidth);
if (file_size == OBD_OBJECT_EOF)
return OBD_OBJECT_EOF;
- LASSERT(lsm_op_find(magic) != NULL);
lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, &file_size,
&swidth);
u64 stripe_off, swidth;
int magic = lsm->lsm_magic;
- LASSERT(lsm_op_find(magic) != NULL);
lsm_op_find(magic)->lsm_stripe_by_offset(lsm, NULL, &lov_off, &swidth);
stripe_off = lov_do_div64(lov_off, swidth);
{
int rc;
- if (lsm_op_find(le32_to_cpu(*(__u32 *)lmm)) == NULL) {
+ if (!lsm_op_find(le32_to_cpu(*(__u32 *)lmm))) {
CERROR("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n",
le32_to_cpu(*(__u32 *)lmm), lmm_bytes);
CERROR("%*phN\n", lmm_bytes, lmm);
*lsmp = NULL;
LASSERT(atomic_read(&lsm->lsm_refc) > 0);
refc = atomic_dec_return(&lsm->lsm_refc);
- if (refc == 0) {
- LASSERT(lsm_op_find(lsm->lsm_magic) != NULL);
+ if (refc == 0)
lsm_op_find(lsm->lsm_magic)->lsm_free(lsm);
- }
+
return refc;
}
if (!lmm)
return lsm_size;
- LASSERT(lsm_op_find(magic) != NULL);
rc = lsm_op_find(magic)->lsm_unpackmd(lov, *lsmp, lmm);
if (rc) {
lov_free_memmd(lsmp);
const struct cl_page *page = slice->cpl_page;
const struct cl_page *sub = lov_sub_page(slice);
- return ergo(sub != NULL,
+ return ergo(sub,
page->cp_child == sub &&
sub->cp_parent == page &&
page->cp_state == sub->cp_state);
LINVRNT(lov_page_invariant(slice));
- if (sub != NULL) {
+ if (sub) {
LASSERT(sub->cp_state == CPS_FREEING);
lu_ref_del(&sub->cp_reference, "lov", sub->cp_parent);
sub->cp_parent = NULL;
static void lov_empty_page_fini(const struct lu_env *env,
struct cl_page_slice *slice)
{
- LASSERT(slice->cpl_page->cp_child == NULL);
+ LASSERT(!slice->cpl_page->cp_child);
}
int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
if (atomic_dec_and_test(&pool->pool_refcount)) {
LASSERT(hlist_unhashed(&pool->pool_hash));
LASSERT(list_empty(&pool->pool_list));
- LASSERT(pool->pool_debugfs_entry == NULL);
+ LASSERT(!pool->pool_debugfs_entry);
lov_ost_pool_free(&(pool->pool_rr.lqr_pool));
lov_ost_pool_free(&(pool->pool_obds));
kfree(pool);
i = 0;
do {
ptr = pool_proc_next(s, &iter, &i);
- } while ((i < *pos) && (ptr != NULL));
+ } while ((i < *pos) && ptr);
return ptr;
}
return iter;
struct lov_tgt_desc *tgt;
LASSERTF(iter->magic == POOL_IT_MAGIC, "%08X", iter->magic);
- LASSERT(iter->pool != NULL);
+ LASSERT(iter->pool);
LASSERT(iter->idx <= pool_tgt_count(iter->pool));
down_read(&pool_tgt_rw_sem(iter->pool));
init_rwsem(&op->op_rw_sem);
op->op_size = count;
op->op_array = kcalloc(op->op_size, sizeof(op->op_array[0]), GFP_NOFS);
- if (op->op_array == NULL) {
+ if (!op->op_array) {
op->op_size = 0;
return -ENOMEM;
}
new_size = max(min_count, 2 * op->op_size);
new = kcalloc(new_size, sizeof(op->op_array[0]), GFP_NOFS);
- if (new == NULL)
+ if (!new)
return -ENOMEM;
/* copy old array to new one */
/* lookup and kill hash reference */
pool = cfs_hash_del_key(lov->lov_pools_hash_body, poolname);
- if (pool == NULL)
+ if (!pool)
return -ENOENT;
if (!IS_ERR_OR_NULL(pool->pool_debugfs_entry)) {
lov = &(obd->u.lov);
pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname);
- if (pool == NULL)
+ if (!pool)
return -ENOENT;
obd_str2uuid(&ost_uuid, ostname);
lov = &(obd->u.lov);
pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname);
- if (pool == NULL)
+ if (!pool)
return -ENOENT;
obd_str2uuid(&ost_uuid, ostname);
pool = NULL;
if (poolname[0] != '\0') {
pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname);
- if (pool == NULL)
+ if (!pool)
CWARN("Request for an unknown pool ("LOV_POOLNAMEF")\n",
poolname);
- if ((pool != NULL) && (pool_tgt_count(pool) == 0)) {
+ if (pool && (pool_tgt_count(pool) == 0)) {
CWARN("Request for an empty pool ("LOV_POOLNAMEF")\n",
poolname);
/* pool is ignored, so we remove ref on it */
tgt = lov->lov_tgts[ost_idx];
- if (unlikely(tgt == NULL)) {
+ if (unlikely(!tgt)) {
rc = 0;
goto out;
}
cfs_time_seconds(1), NULL, NULL);
rc = l_wait_event(waitq, lov_check_set(lov, ost_idx), &lwi);
- if (tgt != NULL && tgt->ltd_active)
+ if (tgt && tgt->ltd_active)
return 1;
return 0;
struct obdo *tmp_oa;
int rc = 0, attrset = 0;
- LASSERT(set->set_oi != NULL);
-
- if (set->set_oi->oi_oa == NULL)
+ if (!set->set_oi->oi_oa)
return 0;
if (!atomic_read(&set->set_success))
return -EIO;
tmp_oa = kmem_cache_alloc(obdo_cachep, GFP_NOFS | __GFP_ZERO);
- if (tmp_oa == NULL) {
+ if (!tmp_oa) {
rc = -ENOMEM;
goto out;
}
{
int rc = 0;
- if (set == NULL)
+ if (!set)
return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes))
req->rq_oi.oi_oa = kmem_cache_alloc(obdo_cachep,
GFP_NOFS | __GFP_ZERO);
- if (req->rq_oi.oi_oa == NULL) {
+ if (!req->rq_oi.oi_oa) {
kfree(req);
rc = -ENOMEM;
goto out_set;
int lov_fini_destroy_set(struct lov_request_set *set)
{
- if (set == NULL)
+ if (!set)
return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
set->set_oi->oi_md = lsm;
set->set_oi->oi_oa = src_oa;
set->set_oti = oti;
- if (oti != NULL && src_oa->o_valid & OBD_MD_FLCOOKIE)
+ if (oti && src_oa->o_valid & OBD_MD_FLCOOKIE)
set->set_cookies = oti->oti_logcookies;
for (i = 0; i < lsm->lsm_stripe_count; i++) {
req->rq_oi.oi_oa = kmem_cache_alloc(obdo_cachep,
GFP_NOFS | __GFP_ZERO);
- if (req->rq_oi.oi_oa == NULL) {
+ if (!req->rq_oi.oi_oa) {
kfree(req);
rc = -ENOMEM;
goto out_set;
{
int rc = 0;
- if (set == NULL)
+ if (!set)
return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
set->set_exp = exp;
set->set_oti = oti;
set->set_oi = oinfo;
- if (oti != NULL && oinfo->oi_oa->o_valid & OBD_MD_FLCOOKIE)
+ if (oti && oinfo->oi_oa->o_valid & OBD_MD_FLCOOKIE)
set->set_cookies = oti->oti_logcookies;
for (i = 0; i < oinfo->oi_md->lsm_stripe_count; i++) {
req->rq_oi.oi_oa = kmem_cache_alloc(obdo_cachep,
GFP_NOFS | __GFP_ZERO);
- if (req->rq_oi.oi_oa == NULL) {
+ if (!req->rq_oi.oi_oa) {
kfree(req);
rc = -ENOMEM;
goto out_set;
{
int rc = 0;
- if (set == NULL)
+ if (!set)
return 0;
if (atomic_read(&set->set_completes)) {
for (i = 0; i < lov->desc.ld_tgt_count; i++) {
struct lov_request *req;
- if (lov->lov_tgts[i] == NULL ||
+ if (!lov->lov_tgts[i] ||
(!lov_check_and_wait_active(lov, i) &&
(oinfo->oi_flags & OBD_STATFS_NODELAY))) {
CDEBUG(D_HA, "lov idx %d inactive\n", i);
next->ld_site = d->ld_site;
ldt = next->ld_type;
- LASSERT(ldt != NULL);
rc = ldt->ldt_ops->ldto_device_init(env, next, ldt->ldt_name, NULL);
if (rc) {
next->ld_site = NULL;
int result;
lsr = kmem_cache_alloc(lovsub_req_kmem, GFP_NOFS | __GFP_ZERO);
- if (lsr != NULL) {
+ if (lsr) {
cl_req_slice_add(req, &lsr->lsrq_cl, dev, &lovsub_req_ops);
result = 0;
} else
struct lovsub_device *lsd;
lsd = kzalloc(sizeof(*lsd), GFP_NOFS);
- if (lsd != NULL) {
+ if (lsd) {
int result;
result = cl_device_init(&lsd->acid_cl, t);
list_for_each_entry(scan, &sub->lss_parents, lll_list) {
lov = scan->lll_super;
(*p)(env, cookie, "[%d %p ", scan->lll_idx, lov);
- if (lov != NULL)
+ if (lov)
cl_lock_descr_print(env, cookie, p,
&lov->lls_cl.cls_lock->cll_descr);
(*p)(env, cookie, "] ");
int result;
lsk = kmem_cache_alloc(lovsub_lock_kmem, GFP_NOFS | __GFP_ZERO);
- if (lsk != NULL) {
+ if (lsk) {
INIT_LIST_HEAD(&lsk->lss_parents);
cl_lock_slice_add(lock, &lsk->lss_cl, obj, &lovsub_lock_ops);
result = 0;
under = &dev->acid_next->cd_lu_dev;
below = under->ld_ops->ldo_object_alloc(env, obj->lo_header, under);
- if (below != NULL) {
+ if (below) {
lu_object_add(obj, below);
cl_object_page_init(lu2cl(obj), sizeof(struct lovsub_page));
result = 0;
struct lu_object *obj;
los = kmem_cache_alloc(lovsub_object_kmem, GFP_NOFS | __GFP_ZERO);
- if (los != NULL) {
+ if (los) {
struct cl_object_header *hdr;
obj = lovsub2lu(los);
struct obd_device *dev = (struct obd_device *)m->private;
struct lov_desc *desc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
seq_printf(m, "%llu\n", desc->ld_default_stripe_size);
return 0;
__u64 val;
int rc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
rc = lprocfs_write_u64_helper(buffer, count, &val);
if (rc)
struct obd_device *dev = (struct obd_device *)m->private;
struct lov_desc *desc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
seq_printf(m, "%llu\n", desc->ld_default_stripe_offset);
return 0;
__u64 val;
int rc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
rc = lprocfs_write_u64_helper(buffer, count, &val);
if (rc)
struct obd_device *dev = (struct obd_device *)m->private;
struct lov_desc *desc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
seq_printf(m, "%u\n", desc->ld_pattern);
return 0;
struct lov_desc *desc;
int val, rc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
rc = lprocfs_write_helper(buffer, count, &val);
if (rc)
struct obd_device *dev = (struct obd_device *)m->private;
struct lov_desc *desc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
seq_printf(m, "%d\n", (__s16)(desc->ld_default_stripe_count + 1) - 1);
return 0;
struct lov_desc *desc;
int val, rc;
- LASSERT(dev != NULL);
+ LASSERT(dev);
desc = &dev->u.lov.desc;
rc = lprocfs_write_helper(buffer, count, &val);
if (rc)
struct obd_device *dev = (struct obd_device *)m->private;
struct lov_obd *lov;
- LASSERT(dev != NULL);
+ LASSERT(dev);
lov = &dev->u.lov;
seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid);
return 0;