PFL file could contain uninstantiated component, so it could still
keeps the specified -1 stripe count, lov_mds_md_size() should heed
this case, otherwise its LOVEA size could be errneous big.
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: Iff741b8ebb1b54d9b27859822735b488e645d85c
Reviewed-on: https://review.whamcloud.com/26611
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
size = sizeof(struct lov_comp_md_v1);
for (entry = 0; entry < lsm->lsm_entry_count; entry++) {
+ u16 stripe_count;
+
lsme = lsm->lsm_entries[entry];
+ /**
+ * uninstantiated component could still keep -1 stripe count
+ * and does not have objects
+ */
+ stripe_count = lsme->lsme_stripe_count;
+ if (stripe_count == (u16)-1)
+ stripe_count = 0;
+
size += sizeof(*lsme);
- size += lov_mds_md_size(lsme->lsme_stripe_count,
- lsme->lsme_magic);
+ size += lov_mds_md_size(stripe_count, lsme->lsme_magic);
}
return size;