From: Bobi Jam Date: Thu, 13 Apr 2017 16:37:25 +0000 (+0800) Subject: LU-9335 pfl: calculate PFL file LOVEA correctly X-Git-Tag: 2.9.57~67 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9460ff5f13102c5981f71e0bbffd4485977517ac;p=fs%2Flustre-release.git LU-9335 pfl: calculate PFL file LOVEA correctly 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 Change-Id: Ied4bf4531f0b0ac9fdefc9efef3c97ae5ae449f4 Reviewed-on: https://review.whamcloud.com/26597 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 3afa428..b64c946 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1108,6 +1108,9 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */ 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); diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 529af63..e06e652 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -564,6 +564,9 @@ struct lov_comp_md_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);