Whamcloud - gitweb
LU-13344 libcfs: Abstract proc_fs with proc_ops
[fs/lustre-release.git] / lustre / include / lustre_lmv.h
index e33cdc1..a3f8ed4 100644 (file)
@@ -150,6 +150,8 @@ static inline void lmv1_le_to_cpu(struct lmv_mds_md_v1 *lmv_dst,
                                le32_to_cpu(lmv_src->lmv_master_mdt_index);
        lmv_dst->lmv_hash_type = le32_to_cpu(lmv_src->lmv_hash_type);
        lmv_dst->lmv_layout_version = le32_to_cpu(lmv_src->lmv_layout_version);
+       if (lmv_src->lmv_stripe_count > LMV_MAX_STRIPE_COUNT)
+               return;
        for (i = 0; i < lmv_src->lmv_stripe_count; i++)
                fid_le_to_cpu(&lmv_dst->lmv_stripe_fids[i],
                              &lmv_src->lmv_stripe_fids[i]);
@@ -444,32 +446,42 @@ insane:
 
 static inline bool lmv_is_splitting(const struct lmv_mds_md_v1 *lmv)
 {
-       LASSERT(lmv_is_sane2(lmv));
+       if (!lmv_is_sane2(lmv))
+               return false;
+
        return lmv_hash_is_splitting(cpu_to_le32(lmv->lmv_hash_type));
 }
 
 static inline bool lmv_is_merging(const struct lmv_mds_md_v1 *lmv)
 {
-       LASSERT(lmv_is_sane2(lmv));
+       if (!lmv_is_sane2(lmv))
+               return false;
+
        return lmv_hash_is_merging(cpu_to_le32(lmv->lmv_hash_type));
 }
 
 static inline bool lmv_is_migrating(const struct lmv_mds_md_v1 *lmv)
 {
-       LASSERT(lmv_is_sane(lmv));
+       if (!lmv_is_sane(lmv))
+               return false;
+
        return lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type));
 }
 
 static inline bool lmv_is_restriping(const struct lmv_mds_md_v1 *lmv)
 {
-       LASSERT(lmv_is_sane2(lmv));
+       if (!lmv_is_sane2(lmv))
+               return false;
+
        return lmv_hash_is_splitting(cpu_to_le32(lmv->lmv_hash_type)) ||
               lmv_hash_is_merging(cpu_to_le32(lmv->lmv_hash_type));
 }
 
 static inline bool lmv_is_layout_changing(const struct lmv_mds_md_v1 *lmv)
 {
-       LASSERT(lmv_is_sane2(lmv));
+       if (!lmv_is_sane2(lmv))
+               return false;
+
        return lmv_hash_is_splitting(cpu_to_le32(lmv->lmv_hash_type)) ||
               lmv_hash_is_merging(cpu_to_le32(lmv->lmv_hash_type)) ||
               lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type));