From: Arshad Hussain Date: Sun, 21 Oct 2018 18:16:30 +0000 (+0530) Subject: LU-6142 lov: Fix style issues for lov_ea.c X-Git-Tag: 2.12.0-RC1~85 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=5e7c387b13b0566c218605ef030401d54420492f LU-6142 lov: Fix style issues for lov_ea.c This patch fixes issues reported by checkpatch for file lustre/lov/lov_ea.c Change-Id: Iaaba150663e980d1d9d8f06b8c41731b90b84c77 Test-Parameters: trivial Signed-off-by: Arshad Hussain Reviewed-on: https://review.whamcloud.com/33535 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Ben Evans Reviewed-by: John L. Hammond --- diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 92b00da..b44cbd1 100644 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -50,8 +50,10 @@ lu_extent_le_to_cpu(struct lu_extent *dst, const struct lu_extent *src) dst->e_end = le64_to_cpu(src->e_end); } -/* Find minimum stripe maxbytes value. For inactive or - * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. */ +/* + * Find minimum stripe maxbytes value. For inactive or + * reconnecting targets use LUSTRE_EXT3_STRIPE_MAXBYTES. + */ static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt) { struct obd_import *imp; @@ -61,7 +63,7 @@ static loff_t lov_tgt_maxbytes(struct lov_tgt_desc *tgt) return maxbytes; imp = tgt->ltd_obd->u.cli.cl_import; - if (imp == NULL) + if (!imp) return maxbytes; spin_lock(&imp->imp_lock); @@ -183,7 +185,7 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, lsme_size = offsetof(typeof(*lsme), lsme_oinfo[stripe_count]); OBD_ALLOC_LARGE(lsme, lsme_size); - if (lsme == NULL) + if (!lsme) RETURN(ERR_PTR(-ENOMEM)); lsme->lsme_magic = magic; @@ -194,7 +196,7 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, lsme->lsme_stripe_count = le16_to_cpu(lmm->lmm_stripe_count); lsme->lsme_layout_gen = le16_to_cpu(lmm->lmm_layout_gen); - if (pool_name != NULL) { + if (pool_name) { size_t pool_name_len; pool_name_len = strlcpy(lsme->lsme_pool_name, pool_name, @@ -214,7 +216,7 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, struct lov_tgt_desc *ltd; OBD_SLAB_ALLOC_PTR_GFP(loi, lov_oinfo_slab, GFP_NOFS); - if (loi == NULL) + if (!loi) GOTO(out_lsme, rc = -ENOMEM); lsme->lsme_oinfo[i] = loi; @@ -235,7 +237,7 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, } ltd = lov->lov_tgts[loi->loi_ost_idx]; - if (ltd == NULL) { + if (!ltd) { CERROR("%s: OST index %d missing\n", (char*)lov->desc.ld_uuid.uuid, loi->loi_ost_idx); lov_dump_lmm_v1(D_WARNING, lmm); @@ -253,7 +255,7 @@ lsme_unpack(struct lov_obd *lov, struct lov_mds_md *lmm, size_t buf_size, lov_bytes = min_stripe_maxbytes * stripe_count; out_dom: - if (maxbytes != NULL) { + if (maxbytes) { if (lov_bytes < min_stripe_maxbytes) /* handle overflow */ *maxbytes = MAX_LFS_FILESIZE; else @@ -266,7 +268,7 @@ out_lsme: for (i = 0; i < stripe_count; i++) { struct lov_oinfo *loi = lsme->lsme_oinfo[i]; - if (loi != NULL) + if (loi) OBD_SLAB_FREE_PTR(lsme->lsme_oinfo[i], lov_oinfo_slab); } OBD_FREE_LARGE(lsme, lsme_size); @@ -299,7 +301,7 @@ lov_stripe_md *lsm_unpackmd_v1v3(struct lov_obd *lov, struct lov_mds_md *lmm, lsm_size = offsetof(typeof(*lsm), lsm_entries[1]); OBD_ALLOC(lsm, lsm_size); - if (lsm == NULL) + if (!lsm) GOTO(out_lsme, rc = -ENOMEM); atomic_set(&lsm->lsm_refc, 1); @@ -434,7 +436,7 @@ lsm_unpackmd_comp_md_v1(struct lov_obd *lov, void *buf, size_t buf_size) lsm_size = offsetof(typeof(*lsm), lsm_entries[entry_count]); OBD_ALLOC(lsm, lsm_size); - if (lsm == NULL) + if (!lsm) return ERR_PTR(-ENOMEM); atomic_set(&lsm->lsm_refc, 1); @@ -480,8 +482,10 @@ lsm_unpackmd_comp_md_v1(struct lov_obd *lov, void *buf, size_t buf_size) if (i == entry_count - 1) { lsm->lsm_maxbytes = (loff_t)lsme->lsme_extent.e_start + maxbytes; - /* the last component hasn't been defined, or - * lsm_maxbytes overflowed. */ + /* + * the last component hasn't been defined, or + * lsm_maxbytes overflowed. + */ if (!lsme_is_dom(lsme) && (lsme->lsme_extent.e_end != LUSTRE_EOF || lsm->lsm_maxbytes < @@ -494,7 +498,7 @@ lsm_unpackmd_comp_md_v1(struct lov_obd *lov, void *buf, size_t buf_size) out_lsm: for (i = 0; i < entry_count; i++) - if (lsm->lsm_entries[i] != NULL) + if (lsm->lsm_entries[i]) lsme_free(lsm->lsm_entries[i]); OBD_FREE(lsm, lsm_size);