Whamcloud - gitweb
LU-9335 pfl: calculate PFL file LOVEA correctly 97/26597/11
authorBobi Jam <bobijam.xu@intel.com>
Thu, 13 Apr 2017 16:37:25 +0000 (00:37 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 26 Apr 2017 03:36:51 +0000 (03:36 +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/26597
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustre_idl.h
lustre/include/lustre/lustre_user.h

index 3afa428..b64c946 100644 (file)
@@ -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);
index 529af63..e06e652 100644 (file)
@@ -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);