PFL file could contain uninstantiated component, so it could still
keeps the specified -1 stripe count,
lov_mds_md_size()/lov_user_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: Ied4bf4531f0b0ac9fdefc9efef3c97ae5ae449f4
Reviewed-on: https://review.whamcloud.com/26601
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
{
+ if (stripes == (__u16)-1)
+ stripes = 0;
+
if (lmm_magic == LOV_MAGIC_V3)
return sizeof(struct lov_mds_md_v3) +
stripes * sizeof(struct lov_ost_data_v1);
static inline __u32 lov_user_md_size(__u16 stripes, __u32 lmm_magic)
{
+ if (stripes == (__u16)-1)
+ stripes = 0;
+
if (lmm_magic == LOV_USER_MAGIC_V1)
return sizeof(struct lov_user_md_v1) +
stripes * sizeof(struct lov_user_ost_data_v1);