X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_internal.h;h=5a16cec1a9607e1628a7b6f0cf7346df30a24f50;hp=79eaf99f618b01c6792944b48c4e9514b72f24d4;hb=44a721b8c10631b52f9ee2fbac1eee8cb775d148;hpb=cedbb25e984ceb85a66bc5a315fbfa05c5bcb423 diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 79eaf99f..5a16cec 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -676,6 +676,7 @@ static inline int mdt_lmm_dom_entry(struct lov_mds_md *lmm) struct lov_comp_md_v1 *comp_v1; struct lov_mds_md *v1; __u32 off; + bool has_dom = true; int i; if (le32_to_cpu(lmm->lmm_magic) != LOV_MAGIC_COMP_V1) @@ -686,15 +687,20 @@ static inline int mdt_lmm_dom_entry(struct lov_mds_md *lmm) v1 = (struct lov_mds_md *)((char *)comp_v1 + off); /* DoM entry is the first entry always */ - if (lov_pattern(le32_to_cpu(v1->lmm_pattern)) != LOV_PATTERN_MDT) + if (lov_pattern(le32_to_cpu(v1->lmm_pattern)) != LOV_PATTERN_MDT && + le16_to_cpu(comp_v1->lcm_mirror_count) == 0) return LMM_NO_DOM; - for (i = 1; i < le16_to_cpu(comp_v1->lcm_entry_count); i++) { + for (i = 0; i < le16_to_cpu(comp_v1->lcm_entry_count); i++) { int j; off = le32_to_cpu(comp_v1->lcm_entries[i].lcme_offset); v1 = (struct lov_mds_md *)((char *)comp_v1 + off); + if (lov_pattern(le32_to_cpu(v1->lmm_pattern)) == + LOV_PATTERN_MDT) + has_dom = true; + for (j = 0; j < le16_to_cpu(v1->lmm_stripe_count); j++) { /* if there is any object on OST */ if (le32_to_cpu(v1->lmm_objects[j].l_ost_idx) != @@ -702,7 +708,7 @@ static inline int mdt_lmm_dom_entry(struct lov_mds_md *lmm) return LMM_DOM_OST; } } - return LMM_DOM_ONLY; + return has_dom ? LMM_DOM_ONLY : LMM_NO_DOM; } static inline bool mdt_lmm_is_flr(struct lov_mds_md *lmm)