Whamcloud - gitweb
LU-9335 pfl: calculate PFL file LOVEA correctly 01/26601/3
authorBobi Jam <bobijam.xu@intel.com>
Thu, 13 Apr 2017 16:37:25 +0000 (00:37 +0800)
committerAndreas Dilger <andreas.dilger@intel.com>
Wed, 19 Apr 2017 21:49:17 +0000 (21:49 +0000)
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>
lustre/include/lustre/lustre_idl.h
lustre/include/lustre/lustre_user.h

index df22acd..cd3ae9e 100644 (file)
@@ -1106,6 +1106,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);
index 5d64f05..a556bb5 100644 (file)
@@ -531,6 +531,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);