- if (lmm_bytes < sizeof(*lmm)) {
- CERROR("lov_mds_md too small: %d, need at least %d\n",
- lmm_bytes, (int)sizeof(*lmm));
- return -EINVAL;
- }
-
- if (lmm->lmm_magic != le32_to_cpu(LOV_MAGIC_V1)) {
- CERROR("bad disk LOV MAGIC: 0x%08X\n",
- le32_to_cpu(*(__u32 *)lmm));
- return -EINVAL;
- }
-
- *stripe_count = le32_to_cpu(lmm->lmm_stripe_count);
-
- if (*stripe_count == 0) {
- CERROR("bad stripe count %d\n", *stripe_count);
- lov_dump_lmm_v1(D_WARNING, lmm);
- return -EINVAL;
- }
-
- if (lmm_bytes < lov_mds_md_v1_size(*stripe_count)) {
- CERROR("LOV EA too small: %d, need %d\n",
- lmm_bytes, lov_mds_md_v1_size(*stripe_count));
- lov_dump_lmm_v1(D_WARNING, lmm);
- return -EINVAL;
- }
-
- if (lmm->lmm_object_id == 0) {
- CERROR("zero object id\n");
- lov_dump_lmm_v1(D_WARNING, lmm);
- return -EINVAL;
- }
-
- if (lmm->lmm_pattern != cpu_to_le32(LOV_PATTERN_RAID0)) {
- CERROR("bad striping pattern\n");
- lov_dump_lmm_v1(D_WARNING, lmm);
- return -EINVAL;
- }