Whamcloud - gitweb
LU-8998 pfl: enhance PFID EA for PFL
authorFan Yong <fan.yong@intel.com>
Thu, 6 Apr 2017 00:05:05 +0000 (08:05 +0800)
committerJinshan Xiong <jinshan.xiong@intel.com>
Thu, 6 Apr 2017 04:52:59 +0000 (21:52 -0700)
This is a misc patch that contains some adjustments to
store more stripe information in the OST-object's PFID
EA (XATTR_NAME_FID), including:

1) For regular file, store the stripe count and stripe
   size information in its OST-object's PFID EA. These
   information are necessary for the LFSCK to recover
   the MDT-object layout EA from orphan OST-object(s).

2) In addition, for PFL file, store the FPL component
   ID and extent information in its OST-object's PFID
   EA also. These information are also necessary for
   the LFSCK to recover the MDT-object PFL layout EA
   from orphan OST-object(s).

3) For ldiskfs backend, there may be not enough space
   in inode body (256 bytes by default) to hold the
   enlarged PFID EA. To avoid performance trouble if
   store the enlarged PFID EA in separated block, we
   make some hack (for the device with 256 bytes or
   smaller inode) inside osd-ldiskfs via merging the
   PFID EA into the LMA EA (XATTR_NAME_LMA) to save
   EA entry space, then allows both the original LMA
   EA and the PFID EA to be filled in the inode body
   without performance trouble. For that, introduce
   two compat flags: LMAC_STRIPE and LMAC_PFL.

4) It is client duty to transfer the stripe and PFL
   information to the OST via the write, setattr and
   punch RPC. Then OST will store these information
   in the PFID EA.

5) On the other hand, to recover the lost or crashed
   MDT-object's layout EA from orphan OST-object(s),
   the LFSCK on the OST needs to return the orphan's
   stripe and PFL (if have) information to the MDT.
   Originally, we only returned the MDT-object's FID
   (and owner) information. Now, we need to return
   related layout information also. For such purpose,
   new structure 'lu_orphan_rec_v2' replaces the old
   'lu_orphan_rec', and the idx_info::ii_recsize is
   used to indicates whether new 'lu_orphan_rec_v2'
   or old ''lu_orphan_rec' is used.

Reviewed-on: https://review.whamcloud.com/24882

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I5a69dbe91b1f83eeb394ce54453352d84a285193
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
32 files changed:
lustre/include/cl_object.h
lustre/include/lustre/lustre_fid.h
lustre/include/lustre/lustre_idl.h
lustre/include/lustre/lustre_user.h
lustre/include/lustre_lfsck.h
lustre/include/lustre_swab.h
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_layout.c
lustre/lod/lod_internal.h
lustre/lod/lod_object.c
lustre/lov/lov_internal.h
lustre/lov/lov_io.c
lustre/lov/lovsub_object.c
lustre/obdclass/dt_object.c
lustre/obdclass/md_attrs.c
lustre/ofd/ofd_internal.h
lustre/ofd/ofd_io.c
lustre/osc/osc_io.c
lustre/osd-ldiskfs/osd_compat.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_oi.c
lustre/osd-ldiskfs/osd_scrub.c
lustre/osp/osp_internal.h
lustre/osp/osp_object.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/wiretest.c
lustre/quota/lquota_internal.h
lustre/tests/sanity.sh
lustre/utils/ll_decode_filter_fid.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index ad9d769..655eafb 100644 (file)
@@ -1770,6 +1770,7 @@ struct cl_io {
                        unsigned int             sa_attr_flags;
                        unsigned int             sa_valid;
                        int                      sa_stripe_index;
+                       struct ost_layout        sa_layout;
                        const struct lu_fid     *sa_parent_fid;
                } ci_setattr;
                struct cl_data_version_io {
index 1180140..2a2ff97 100644 (file)
@@ -324,11 +324,36 @@ static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)
        dst->f_ver = __be32_to_cpu(fid_ver(src));
 }
 
+static inline void ost_layout_cpu_to_le(struct ost_layout *dst,
+                                       const struct ost_layout *src)
+{
+       dst->ol_stripe_size = __cpu_to_le32(src->ol_stripe_size);
+       dst->ol_stripe_count = __cpu_to_le32(src->ol_stripe_count);
+       dst->ol_comp_start = __cpu_to_le64(src->ol_comp_start);
+       dst->ol_comp_end = __cpu_to_le64(src->ol_comp_end);
+       dst->ol_comp_id = __cpu_to_le32(src->ol_comp_id);
+}
+
+static inline void ost_layout_le_to_cpu(struct ost_layout *dst,
+                                       const struct ost_layout *src)
+{
+       dst->ol_stripe_size = __le32_to_cpu(src->ol_stripe_size);
+       dst->ol_stripe_count = __le32_to_cpu(src->ol_stripe_count);
+       dst->ol_comp_start = __le64_to_cpu(src->ol_comp_start);
+       dst->ol_comp_end = __le64_to_cpu(src->ol_comp_end);
+       dst->ol_comp_id = __le32_to_cpu(src->ol_comp_id);
+}
+
 static inline void filter_fid_cpu_to_le(struct filter_fid *dst,
                                        const struct filter_fid *src, int size)
 {
        fid_cpu_to_le(&dst->ff_parent, &src->ff_parent);
 
+       if (size < sizeof(struct filter_fid))
+               memset(&dst->ff_layout, 0, sizeof(dst->ff_layout));
+       else
+               ost_layout_cpu_to_le(&dst->ff_layout, &src->ff_layout);
+
        /* XXX: Add more if filter_fid is enlarged in the future. */
 }
 
@@ -337,6 +362,11 @@ static inline void filter_fid_le_to_cpu(struct filter_fid *dst,
 {
        fid_le_to_cpu(&dst->ff_parent, &src->ff_parent);
 
+       if (size < sizeof(struct filter_fid))
+               memset(&dst->ff_layout, 0, sizeof(dst->ff_layout));
+       else
+               ost_layout_le_to_cpu(&dst->ff_layout, &src->ff_layout);
+
        /* XXX: Add more if filter_fid is enlarged in the future. */
 }
 
index 53e9629..d3f0f75 100644 (file)
@@ -168,39 +168,15 @@ struct lu_seq_range_array {
 /** \defgroup lu_fid lu_fid
  * @{ */
 
-/**
- * Flags for lustre_mdt_attrs::lma_compat and lustre_mdt_attrs::lma_incompat.
- * Deprecated since HSM and SOM attributes are now stored in separate on-disk
- * xattr.
- */
-enum lma_compat {
-       LMAC_HSM        = 0x00000001,
-/*     LMAC_SOM        = 0x00000002, obsolete since 2.8.0 */
-       LMAC_NOT_IN_OI  = 0x00000004, /* the object does NOT need OI mapping */
-       LMAC_FID_ON_OST = 0x00000008, /* For OST-object, its OI mapping is
-                                      * under /O/<seq>/d<x>. */
-};
-
-/**
- * Masks for all features that should be supported by a Lustre version to
- * access a specific file.
- * This information is stored in lustre_mdt_attrs::lma_incompat.
- */
-enum lma_incompat {
-       LMAI_RELEASED           = 0x00000001, /* file is released */
-       LMAI_AGENT              = 0x00000002, /* agent inode */
-       LMAI_REMOTE_PARENT      = 0x00000004, /* the parent of the object
-                                                is on the remote MDT */
-       LMAI_STRIPED            = 0x00000008, /* striped directory inode */
-       LMAI_ORPHAN             = 0x00000010, /* inode is orphan */
-       LMA_INCOMPAT_SUPP       = (LMAI_AGENT | LMAI_REMOTE_PARENT | \
-                                  LMAI_STRIPED | LMAI_ORPHAN)
-};
-
 extern void lustre_lma_swab(struct lustre_mdt_attrs *lma);
 extern void lustre_lma_init(struct lustre_mdt_attrs *lma,
                            const struct lu_fid *fid,
                            __u32 compat, __u32 incompat);
+extern void lustre_loa_swab(struct lustre_ost_attrs *loa,
+                           bool to_cpu);
+extern void lustre_loa_init(struct lustre_ost_attrs *loa,
+                           const struct lu_fid *fid,
+                           __u32 compat, __u32 incompat);
 
 /* copytool uses a 32b bitmask field to encode archive-Ids during register
  * with MDT thru kuc.
@@ -401,6 +377,18 @@ struct lu_orphan_ent {
        struct lu_orphan_rec    loe_rec;
 };
 
+struct lu_orphan_rec_v2 {
+       struct lu_orphan_rec    lor_rec;
+       struct ost_layout       lor_layout;
+       __u32                   lor_padding;
+};
+
+struct lu_orphan_ent_v2 {
+       /* The orphan OST-object's FID */
+       struct lu_fid           loe_key;
+       struct lu_orphan_rec_v2 loe_rec;
+};
+
 /** @} lu_fid */
 
 /** \defgroup lu_dir lu_dir
@@ -1209,6 +1197,7 @@ lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic)
                                                              executed */
 
 #define OBD_MD_DEFAULT_MEA   (0x0040000000000000ULL) /* default MEA */
+#define OBD_MD_FLOSTLAYOUT   (0x0080000000000000ULL) /* contain ost_layout */
 
 #define OBD_MD_FLGETATTR (OBD_MD_FLID    | OBD_MD_FLATIME | OBD_MD_FLMTIME | \
                           OBD_MD_FLCTIME | OBD_MD_FLSIZE  | OBD_MD_FLBLKSZ | \
@@ -2841,8 +2830,15 @@ struct obdo {
        __u32                   o_parent_ver;
        struct lustre_handle    o_handle;       /* brw: lock handle to prolong
                                                 * locks */
-       struct llog_cookie      o_lcookie;      /* destroy: unlink cookie from
-                                                * MDS, obsolete in 2.8 */
+       /* Originally, the field is llog_cookie for destroy with unlink cookie
+        * from MDS, it is obsolete in 2.8. Then reuse it by client to transfer
+        * layout and PFL information in IO, setattr RPCs. Since llog_cookie is
+        * not used on wire any longer, remove it from the obdo, then it can be
+        * enlarged freely in the further without affect related RPCs.
+        *
+        * sizeof(ost_layout) + sieof(__u32) == sizeof(llog_cookie). */
+       struct ost_layout       o_layout;
+       __u32                   o_padding_3;
        __u32                   o_uid_h;
        __u32                   o_gid_h;
 
@@ -2877,9 +2873,11 @@ struct lfsck_request {
        __u32           lr_flags2;
        struct lu_fid   lr_fid;
        struct lu_fid   lr_fid2;
-       struct lu_fid   lr_fid3;
+       __u32           lr_comp_id;
+       __u32           lr_padding_0;
        __u64           lr_padding_1;
        __u64           lr_padding_2;
+       __u64           lr_padding_3;
 };
 
 struct lfsck_reply {
index 31ea745..5d64f05 100644 (file)
@@ -159,9 +159,13 @@ static inline bool fid_is_zero(const struct lu_fid *fid)
  * parent MDT-object's layout EA. */
 #define f_stripe_idx f_ver
 
-struct filter_fid {
-       struct lu_fid   ff_parent;  /* ff_parent.f_ver == file stripe number */
-};
+struct ost_layout {
+       __u32   ol_stripe_size;
+       __u32   ol_stripe_count;
+       __u64   ol_comp_start;
+       __u64   ol_comp_end;
+       __u32   ol_comp_id;
+} __attribute__((packed));
 
 /* keep this one for compatibility */
 struct filter_fid_old {
@@ -170,11 +174,43 @@ struct filter_fid_old {
        __u64           ff_seq;
 };
 
+struct filter_fid {
+       struct lu_fid           ff_parent;
+       struct ost_layout       ff_layout;
+} __attribute__((packed));
+
 /* Userspace should treat lu_fid as opaque, and only use the following methods
  * to print or parse them.  Other functions (e.g. compare, swab) could be moved
  * here from lustre_idl.h if needed. */
 typedef struct lu_fid lustre_fid;
 
+enum lma_compat {
+       LMAC_HSM         = 0x00000001,
+/*     LMAC_SOM         = 0x00000002, obsolete since 2.8.0 */
+       LMAC_NOT_IN_OI   = 0x00000004, /* the object does NOT need OI mapping */
+       LMAC_FID_ON_OST  = 0x00000008, /* For OST-object, its OI mapping is
+                                      * under /O/<seq>/d<x>. */
+       LMAC_STRIPE_INFO = 0x00000010, /* stripe info in the LMA EA. */
+       LMAC_COMP_INFO   = 0x00000020, /* Component info in the LMA EA. */
+};
+
+/**
+ * Masks for all features that should be supported by a Lustre version to
+ * access a specific file.
+ * This information is stored in lustre_mdt_attrs::lma_incompat.
+ */
+enum lma_incompat {
+       LMAI_RELEASED           = 0x00000001, /* file is released */
+       LMAI_AGENT              = 0x00000002, /* agent inode */
+       LMAI_REMOTE_PARENT      = 0x00000004, /* the parent of the object
+                                                is on the remote MDT */
+       LMAI_STRIPED            = 0x00000008, /* striped directory inode */
+       LMAI_ORPHAN             = 0x00000010, /* inode is orphan */
+       LMA_INCOMPAT_SUPP       = (LMAI_AGENT | LMAI_REMOTE_PARENT | \
+                                  LMAI_STRIPED | LMAI_ORPHAN)
+};
+
+
 /**
  * Following struct for object attributes, that will be kept inode's EA.
  * Introduced in 2.0 release (please see b15993, for details)
@@ -196,6 +232,25 @@ struct lustre_mdt_attrs {
        struct lu_fid  lma_self_fid;
 };
 
+struct lustre_ost_attrs {
+       /* Use lustre_mdt_attrs directly for now, need a common header
+        * structure if want to change lustre_mdt_attrs in future. */
+       struct lustre_mdt_attrs loa_lma;
+
+       /* Below five elements are for OST-object's PFID EA, the
+        * lma_parent_fid::f_ver is composed of the stripe_count (high 16 bits)
+        * and the stripe_index (low 16 bits), the size should not exceed
+        * 5 * sizeof(__u64)) to be accessable by old Lustre. If the flag
+        * LMAC_STRIPE_INFO is set, then loa_parent_fid and loa_stripe_size
+        * are valid; if the flag LMAC_COMP_INFO is set, then the next three
+        * loa_comp_* elements are valid. */
+       struct lu_fid   loa_parent_fid;
+       __u32           loa_stripe_size;
+       __u32           loa_comp_id;
+       __u64           loa_comp_start;
+       __u64           loa_comp_end;
+};
+
 /**
  * Prior to 2.4, the LMA structure also included SOM attributes which has since
  * been moved to a dedicated xattr
index 43faaad..8dabe50 100644 (file)
@@ -63,8 +63,8 @@ struct lfsck_req_local {
        __u16           lrl_padding0;
        __u32           lrl_padding1;
        struct lu_fid   lrl_fid;
-       struct lu_fid   lrl_fid2;
-       struct lu_fid   lrl_fid3;
+       struct filter_fid lrl_ff_client;
+       struct filter_fid lrl_ff_local;
 };
 
 typedef int (*lfsck_out_notify)(const struct lu_env *env, void *data,
index 55ffe14..8f8b375 100644 (file)
@@ -51,6 +51,7 @@
 #include <lustre/lustre_idl.h>
 
 void lustre_swab_orphan_ent(struct lu_orphan_ent *ent);
+void lustre_swab_orphan_ent_v2(struct lu_orphan_ent_v2 *ent);
 void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
 void lustre_swab_connect(struct obd_connect_data *ocd);
 void lustre_swab_hsm_user_state(struct hsm_user_state *hus);
index 313407f..7d59d4c 100644 (file)
@@ -786,6 +786,7 @@ struct lfsck_layout_req {
        struct dt_object                *llr_child;
        __u32                            llr_ost_idx;
        __u32                            llr_lov_idx; /* offset in LOV EA */
+       __u32                            llr_comp_id;
 };
 
 struct lfsck_assistant_operations {
@@ -878,11 +879,7 @@ struct lfsck_thread_info {
        struct lu_attr          lti_la;
        struct lu_attr          lti_la2;
        struct ost_id           lti_oi;
-       union {
-               struct lustre_mdt_attrs lti_lma;
-               /* old LMA for compatibility */
-               char                    lti_lma_old[LMA_OLD_SIZE];
-       };
+       struct lustre_ost_attrs lti_loa;
        struct dt_object_format lti_dof;
        /* There will be '\0' at the end of the name. */
        char            lti_key[sizeof(struct lu_dirent) + NAME_MAX + 1];
@@ -896,12 +893,9 @@ struct lfsck_thread_info {
        union ldlm_policy_data  lti_policy;
        struct ldlm_enqueue_info lti_einfo;
        struct ldlm_res_id      lti_resid;
-       union {
-               struct filter_fid_old   lti_old_pfid;
-               struct filter_fid       lti_new_pfid;
-       };
+       struct filter_fid       lti_ff;
        struct dt_allocation_hint lti_hint;
-       struct lu_orphan_rec    lti_rec;
+       struct lu_orphan_rec_v2 lti_rec;
        struct lov_user_md      lti_lum;
        struct dt_insert_rec    lti_dt_rec;
        struct lu_object_conf   lti_conf;
index b4bb877..ddc8da9 100644 (file)
@@ -983,7 +983,7 @@ static int fid_is_for_ostobj(const struct lu_env *env,
 {
        struct seq_server_site  *ss     = lfsck_dev_site(lfsck);
        struct lu_seq_range     *range  = &lfsck_env_info(env)->lti_range;
-       struct lustre_mdt_attrs *lma;
+       struct lustre_ost_attrs *loa;
        int                      rc;
 
        fld_range_set_any(range);
@@ -995,13 +995,13 @@ static int fid_is_for_ostobj(const struct lu_env *env,
                return 0;
        }
 
-       lma = &lfsck_env_info(env)->lti_lma;
-       rc = dt_xattr_get(env, obj, lfsck_buf_get(env, lma, sizeof(*lma)),
+       loa = &lfsck_env_info(env)->lti_loa;
+       rc = dt_xattr_get(env, obj, lfsck_buf_get(env, loa, sizeof(*loa)),
                          XATTR_NAME_LMA);
-       if (rc == sizeof(*lma)) {
-               lustre_lma_swab(lma);
+       if (rc >= sizeof(struct lustre_mdt_attrs)) {
+               lustre_lma_swab(&loa->loa_lma);
 
-               return lma->lma_compat & LMAC_FID_ON_OST ? 1 : 0;
+               return loa->loa_lma.lma_compat & LMAC_FID_ON_OST ? 1 : 0;
        }
 
        rc = dt_xattr_get(env, obj, &LU_BUF_NULL, XATTR_NAME_FID);
@@ -1693,7 +1693,7 @@ static int __lfsck_layout_update_pfid(const struct lu_env *env,
                                      const struct lu_fid *pfid, __u32 offset)
 {
        struct dt_device        *dev    = lfsck_obj2dev(child);
-       struct filter_fid       *ff     = &lfsck_env_info(env)->lti_new_pfid;
+       struct filter_fid       *ff     = &lfsck_env_info(env)->lti_ff;
        struct thandle          *handle;
        struct lu_buf            buf    = { NULL };
        int                      rc;
@@ -1812,7 +1812,7 @@ static int lfsck_layout_update_pfid(const struct lu_env *env,
 static int lfsck_layout_recreate_parent(const struct lu_env *env,
                                        struct lfsck_component *com,
                                        struct lfsck_tgt_desc *ltd,
-                                       struct lu_orphan_rec *rec,
+                                       struct lu_orphan_rec_v2 *rec,
                                        struct lu_fid *cfid,
                                        const char *infix,
                                        const char *type,
@@ -1824,7 +1824,7 @@ static int lfsck_layout_recreate_parent(const struct lu_env *env,
        struct lu_attr                  *la     = &info->lti_la2;
        struct dt_object_format         *dof    = &info->lti_dof;
        struct lfsck_instance           *lfsck  = com->lc_lfsck;
-       struct lu_fid                   *pfid   = &rec->lor_fid;
+       struct lu_fid                   *pfid   = &rec->lor_rec.lor_fid;
        struct lu_fid                   *tfid   = &info->lti_fid3;
        struct dt_device                *dev    = lfsck->li_bottom;
        struct dt_object                *lpf    = lfsck->li_lpf_obj;
@@ -1874,8 +1874,8 @@ static int lfsck_layout_recreate_parent(const struct lu_env *env,
        LASSERT(type != NULL);
 
        memset(la, 0, sizeof(*la));
-       la->la_uid = rec->lor_uid;
-       la->la_gid = rec->lor_gid;
+       la->la_uid = rec->lor_rec.lor_uid;
+       la->la_gid = rec->lor_rec.lor_gid;
        la->la_mode = S_IFREG | S_IRUSR;
        la->la_valid = LA_MODE | LA_UID | LA_GID;
 
@@ -2182,7 +2182,7 @@ put:
 static int lfsck_layout_conflict_create(const struct lu_env *env,
                                        struct lfsck_component *com,
                                        struct lfsck_tgt_desc *ltd,
-                                       struct lu_orphan_rec *rec,
+                                       struct lu_orphan_rec_v2 *rec,
                                        struct dt_object *parent,
                                        struct lu_fid *cfid,
                                        struct lu_buf *ea_buf,
@@ -2226,7 +2226,7 @@ static int lfsck_layout_conflict_create(const struct lu_env *env,
                /* No need the layout lock on the original parent. */
                lfsck_ibits_unlock(&lh, LCK_EX);
 
-               fid_zero(&rec->lor_fid);
+               fid_zero(&rec->lor_rec.lor_fid);
                snprintf(info->lti_tmpbuf, sizeof(info->lti_tmpbuf),
                         "-"DFID"-%x", PFID(lu_object_fid(&parent->do_lu)),
                         ea_off);
@@ -2285,7 +2285,7 @@ out:
 static int lfsck_layout_recreate_lovea(const struct lu_env *env,
                                       struct lfsck_component *com,
                                       struct lfsck_tgt_desc *ltd,
-                                      struct lu_orphan_rec *rec,
+                                      struct lu_orphan_rec_v2 *rec,
                                       struct dt_object *parent,
                                       struct lu_fid *cfid,
                                       __u32 ost_idx, __u32 ea_off)
@@ -2557,11 +2557,11 @@ unlock_layout:
 static int lfsck_layout_scan_orphan_one(const struct lu_env *env,
                                        struct lfsck_component *com,
                                        struct lfsck_tgt_desc *ltd,
-                                       struct lu_orphan_rec *rec,
+                                       struct lu_orphan_rec_v2 *rec,
                                        struct lu_fid *cfid)
 {
        struct lfsck_layout     *lo     = com->lc_file_ram;
-       struct lu_fid           *pfid   = &rec->lor_fid;
+       struct lu_fid           *pfid   = &rec->lor_rec.lor_fid;
        struct dt_object        *parent = NULL;
        __u32                    ea_off = pfid->f_stripe_idx;
        int                      rc     = 0;
@@ -2699,7 +2699,7 @@ static int lfsck_layout_scan_orphan(const struct lu_env *env,
 
        do {
                struct dt_key           *key;
-               struct lu_orphan_rec    *rec = &info->lti_rec;
+               struct lu_orphan_rec_v2 *rec = &info->lti_rec;
 
                if (CFS_FAIL_TIMEOUT(OBD_FAIL_LFSCK_DELAY3, cfs_fail_val) &&
                    unlikely(!thread_is_running(&lfsck->li_thread)))
@@ -2766,7 +2766,7 @@ static int __lfsck_layout_repair_dangling(const struct lu_env *env,
                                          __u32 ea_off, __u32 ost_idx, bool log)
 {
        struct lfsck_thread_info *info = lfsck_env_info(env);
-       struct filter_fid *ff = &info->lti_new_pfid;
+       struct filter_fid *ff = &info->lti_ff;
        struct dt_object_format *dof = &info->lti_dof;
        struct lu_attr *la = &info->lti_la;
        struct lfsck_instance *lfsck = com->lc_lfsck;
@@ -2989,7 +2989,7 @@ static int lfsck_layout_repair_unmatched_pair(const struct lu_env *env,
                                              struct lu_attr *la)
 {
        struct lfsck_thread_info        *info   = lfsck_env_info(env);
-       struct filter_fid               *pfid   = &info->lti_new_pfid;
+       struct filter_fid               *pfid   = &info->lti_ff;
        struct dt_object                *child  = llr->llr_child;
        struct dt_device                *dev    = lfsck_obj2dev(child);
        const struct lu_fid             *tfid   = lu_object_fid(&parent->do_lu);
@@ -3484,7 +3484,7 @@ static int lfsck_layout_assistant_handler_p1(const struct lu_env *env,
        struct lfsck_assistant_object        *lso    = lar->lar_parent;
        struct lfsck_layout                  *lo     = com->lc_file_ram;
        struct lfsck_thread_info             *info   = lfsck_env_info(env);
-       struct filter_fid_old                *pea    = &info->lti_old_pfid;
+       struct filter_fid                    *pea    = &info->lti_ff;
        struct lu_fid                        *pfid   = &info->lti_fid;
        struct lu_buf                         buf    = { NULL };
        struct dt_object                     *parent = NULL;
@@ -3519,10 +3519,9 @@ static int lfsck_layout_assistant_handler_p1(const struct lu_env *env,
        if (rc != 0)
                GOTO(out, rc);
 
-       lfsck_buf_init(&buf, pea, sizeof(struct filter_fid_old));
+       lfsck_buf_init(&buf, pea, sizeof(struct filter_fid));
        rc = dt_xattr_get(env, child, &buf, XATTR_NAME_FID);
-       if (unlikely(rc > 0 && rc != sizeof(struct filter_fid_old) &&
-                    rc != sizeof(struct filter_fid))) {
+       if (unlikely(rc > 0 && rc < sizeof(struct lu_fid))) {
                type = LLIT_UNMATCHED_PAIR;
                goto repair;
        }
@@ -4282,8 +4281,8 @@ static int lfsck_layout_slave_repair_pfid(const struct lu_env *env,
                     lfsck_is_dead_obj(obj)))
                GOTO(unlock, rc = 0);
 
-       rc = __lfsck_layout_update_pfid(env, obj, &lrl->lrl_fid2,
-                                       lrl->lrl_fid2.f_ver);
+       rc = __lfsck_layout_update_pfid(env, obj, &lrl->lrl_ff_client.ff_parent,
+                                       lrl->lrl_ff_client.ff_parent.f_ver);
 
        GOTO(unlock, rc);
 
@@ -4294,7 +4293,7 @@ unlock:
 log:
        CDEBUG(D_LFSCK, "%s: layout LFSCK slave repaired pfid for "DFID
               ", parent "DFID": rc = %d\n", lfsck_lfsck2name(com->lc_lfsck),
-              PFID(&lrl->lrl_fid), PFID(&lrl->lrl_fid2), rc);
+              PFID(&lrl->lrl_fid), PFID(&lrl->lrl_ff_client.ff_parent), rc);
 
        return rc;
 }
@@ -4594,8 +4593,7 @@ static int lfsck_layout_scan_stripes(const struct lu_env *env,
        __u16                            count;
        ENTRY;
 
-       lfsck_buf_init(&buf, &info->lti_old_pfid,
-                      sizeof(struct filter_fid_old));
+       lfsck_buf_init(&buf, &info->lti_ff, sizeof(struct filter_fid));
        count = le16_to_cpu(lmm->lmm_stripe_count);
        /* Currently, we only support LOV_MAGIC_V1/LOV_MAGIC_V3 which has
         * been verified in lfsck_layout_verify_header() already. If some
@@ -5708,7 +5706,7 @@ static int lfsck_layout_slave_in_notify_local(const struct lu_env *env,
                 * local stored PFID xattr recognizes the OST-object, then it
                 * must be that the client given PFID is wrong. */
                rc = lfsck_layout_slave_check_pairs(env, com, &lrl->lrl_fid,
-                                                   &lrl->lrl_fid3);
+                                               &lrl->lrl_ff_local.ff_parent);
                if (rc <= 0)
                        RETURN(0);
 
@@ -5718,7 +5716,7 @@ static int lfsck_layout_slave_in_notify_local(const struct lu_env *env,
                 * given PFID information recognizes the OST-object or not. If
                 * matches, then need to update the OST-object's PFID xattr. */
                rc = lfsck_layout_slave_check_pairs(env, com, &lrl->lrl_fid,
-                                                   &lrl->lrl_fid2);
+                                               &lrl->lrl_ff_client.ff_parent);
                /* For rc < 0 case:
                 * We are not sure whether the client given PFID information
                 * is correct or not, do nothing to avoid improper fixing.
@@ -6132,7 +6130,7 @@ struct lfsck_orphan_it {
        struct lfsck_rbtree_node         *loi_lrn;
        struct lfsck_layout_slave_target *loi_llst;
        struct lu_fid                     loi_key;
-       struct lu_orphan_rec              loi_rec;
+       struct lu_orphan_rec_v2           loi_rec;
        __u64                             loi_hash;
        unsigned int                      loi_over:1;
 };
@@ -6384,11 +6382,11 @@ static int lfsck_orphan_it_next(const struct lu_env *env,
                                struct dt_it *di)
 {
        struct lfsck_thread_info        *info   = lfsck_env_info(env);
-       struct filter_fid_old           *pfid   = &info->lti_old_pfid;
+       struct filter_fid               *pfid   = &info->lti_ff;
        struct lu_attr                  *la     = &info->lti_la;
        struct lfsck_orphan_it          *it     = (struct lfsck_orphan_it *)di;
        struct lu_fid                   *key    = &it->loi_key;
-       struct lu_orphan_rec            *rec    = &it->loi_rec;
+       struct lu_orphan_rec_v2         *rec    = &it->loi_rec;
        struct lfsck_component          *com    = it->loi_com;
        struct lfsck_instance           *lfsck  = com->lc_lfsck;
        struct lfsck_layout_slave_data  *llsd   = com->lc_data;
@@ -6524,9 +6522,9 @@ again1:
                } else if (idx == 0) {
                        /* If the orphan OST-object has no parent information,
                         * regard it as referenced by the MDT-object on MDT0. */
-                       fid_zero(&rec->lor_fid);
-                       rec->lor_uid = la->la_uid;
-                       rec->lor_gid = la->la_gid;
+                       fid_zero(&rec->lor_rec.lor_fid);
+                       rec->lor_rec.lor_uid = la->la_uid;
+                       rec->lor_rec.lor_gid = la->la_gid;
                        GOTO(out, rc = 0);
                }
 
@@ -6536,20 +6534,16 @@ again1:
                goto again1;
        }
 
-       if (rc < 0)
-               GOTO(out, rc);
-
-       if (rc != sizeof(struct filter_fid) &&
-           rc != sizeof(struct filter_fid_old))
-               GOTO(out, rc = -EINVAL);
+       if (rc < sizeof(struct lu_fid))
+               GOTO(out, rc = (rc < 0 ? rc : -EINVAL));
 
-       fid_le_to_cpu(&rec->lor_fid, &pfid->ff_parent);
+       fid_le_to_cpu(&rec->lor_rec.lor_fid, &pfid->ff_parent);
        /* Currently, the filter_fid::ff_parent::f_ver is not the real parent
         * MDT-object's FID::f_ver, instead it is the OST-object index in its
         * parent MDT-object's layout EA. */
-       save = rec->lor_fid.f_stripe_idx;
-       rec->lor_fid.f_ver = 0;
-       rc = lfsck_fid_match_idx(env, lfsck, &rec->lor_fid, idx);
+       save = rec->lor_rec.lor_fid.f_stripe_idx;
+       rec->lor_rec.lor_fid.f_ver = 0;
+       rc = lfsck_fid_match_idx(env, lfsck, &rec->lor_rec.lor_fid, idx);
        /* If the orphan OST-object does not claim the MDT, then next.
         *
         * If we do not know whether it matches or not, then return it
@@ -6561,13 +6555,14 @@ again1:
                goto again1;
        }
 
-       rec->lor_fid.f_stripe_idx = save;
-       rec->lor_uid = la->la_uid;
-       rec->lor_gid = la->la_gid;
+       rec->lor_rec.lor_fid.f_stripe_idx = save;
+       rec->lor_rec.lor_uid = la->la_uid;
+       rec->lor_rec.lor_gid = la->la_gid;
 
        CDEBUG(D_LFSCK, "%s: return orphan "DFID", PFID "DFID", owner %u:%u\n",
-              lfsck_lfsck2name(com->lc_lfsck), PFID(key), PFID(&rec->lor_fid),
-              rec->lor_uid, rec->lor_gid);
+              lfsck_lfsck2name(com->lc_lfsck), PFID(key),
+              PFID(&rec->lor_rec.lor_fid), rec->lor_rec.lor_uid,
+              rec->lor_rec.lor_gid);
 
        GOTO(out, rc = 0);
 
@@ -6630,7 +6625,7 @@ static int lfsck_orphan_it_rec(const struct lu_env *env,
 {
        struct lfsck_orphan_it *it = (struct lfsck_orphan_it *)di;
 
-       *(struct lu_orphan_rec *)rec = it->loi_rec;
+       *(struct lu_orphan_rec_v2 *)rec = it->loi_rec;
 
        return 0;
 }
index 90f25f7..7b2c9a6 100644 (file)
@@ -381,6 +381,7 @@ struct lod_thread_info {
        struct lustre_cfg               lti_lustre_cfg;
        /* used to store parent default striping in create */
        struct lod_default_striping     lti_def_striping;
+       struct filter_fid lti_ff;
 };
 
 extern const struct lu_device_operations lod_lu_ops;
index f0d467c..fa1bd91 100644 (file)
@@ -2039,21 +2039,23 @@ lod_obj_stripe_replace_parent_fid_cb(const struct lu_env *env,
                                     int stripe_idx,
                                     struct lod_obj_stripe_cb_data *data)
 {
-       struct lod_thread_info  *info = lod_env_info(env);
-       struct dt_object        *obj = &lo->ldo_obj;
-       struct lu_buf   *buf = &info->lti_buf;
-       struct filter_fid *ff = buf->lb_buf;
+       struct lod_thread_info *info = lod_env_info(env);
+       struct filter_fid *ff = &info->lti_ff;
+       struct lu_buf *buf = &info->lti_buf;
        int rc;
 
+       buf->lb_buf = ff;
+       buf->lb_len = sizeof(*ff);
        rc = dt_xattr_get(env, dt, buf, XATTR_NAME_FID);
-       if (rc < 0)
+       if (rc == -ENODATA)
                return 0;
 
-       fid_le_to_cpu(&ff->ff_parent, &ff->ff_parent);
-       ff->ff_parent.f_seq = lu_object_fid(&obj->do_lu)->f_seq;
-       ff->ff_parent.f_oid = lu_object_fid(&obj->do_lu)->f_oid;
-       fid_cpu_to_le(&ff->ff_parent, &ff->ff_parent);
+       if (rc < 0)
+               return rc;
 
+       ff->ff_parent = *lu_object_fid(&lo->ldo_obj.do_lu);
+       ff->ff_parent.f_ver = stripe_idx;
+       fid_cpu_to_le(&ff->ff_parent, &ff->ff_parent);
        if (data->locd_declare)
                rc = lod_sub_object_declare_xattr_set(env, dt, buf,
                                                      XATTR_NAME_FID,
index 83b0ff8..b6a21c4 100644 (file)
@@ -312,4 +312,20 @@ static inline struct obd_device *lov2obd(const struct lov_obd *lov)
        return container_of0(lov, struct obd_device, u.lov);
 }
 
+static inline void lov_lsm2layout(struct lov_stripe_md *lsm,
+                                 struct lov_stripe_md_entry *lsme,
+                                 struct ost_layout *ol)
+{
+       ol->ol_stripe_size = lsme->lsme_stripe_size;
+       ol->ol_stripe_count = lsme->lsme_stripe_count;
+       if (lsm->lsm_magic == LOV_MAGIC_COMP_V1) {
+               ol->ol_comp_start = lsme->lsme_extent.e_start;
+               ol->ol_comp_end = lsme->lsme_extent.e_end;
+               ol->ol_comp_id = lsme->lsme_id;
+       } else {
+               ol->ol_comp_start = 0;
+               ol->ol_comp_end = 0;
+               ol->ol_comp_id = 0;
+       }
+}
 #endif
index b8c529f..2e21bfb 100644 (file)
@@ -324,6 +324,8 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio,
                                                      stripe);
                        io->u.ci_setattr.sa_attr.lvb_size = new_size;
                }
+               lov_lsm2layout(lsm, lsm->lsm_entries[index],
+                              &io->u.ci_setattr.sa_layout);
                break;
        }
        case CIT_DATA_VERSION: {
index 976bf3d..1471de7 100644 (file)
@@ -135,7 +135,7 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj,
                                struct cl_req_attr *attr)
 {
        struct lovsub_object *subobj = cl2lovsub(obj);
-
+       struct lov_stripe_md *lsm = subobj->lso_super->lo_lsm;
        ENTRY;
        cl_req_attr_set(env, &subobj->lso_super->lo_cl, attr);
 
@@ -144,6 +144,9 @@ static void lovsub_req_attr_set(const struct lu_env *env, struct cl_object *obj,
         * unconditionally. It never changes anyway.
         */
        attr->cra_oa->o_stripe_idx = lov_comp_stripe(subobj->lso_index);
+       lov_lsm2layout(lsm, lsm->lsm_entries[lov_comp_entry(subobj->lso_index)],
+                      &attr->cra_oa->o_layout);
+       attr->cra_oa->o_valid |= OBD_MD_FLOSTLAYOUT;
        EXIT;
 }
 
index 3f164f0..2b3a450 100644 (file)
@@ -584,8 +584,8 @@ const struct dt_index_features dt_lfsck_layout_orphan_features = {
        .dif_flags              = 0,
        .dif_keysize_min        = sizeof(struct lu_fid),
        .dif_keysize_max        = sizeof(struct lu_fid),
-       .dif_recsize_min        = sizeof(struct lu_orphan_rec),
-       .dif_recsize_max        = sizeof(struct lu_orphan_rec),
+       .dif_recsize_min        = sizeof(struct lu_orphan_rec_v2),
+       .dif_recsize_max        = sizeof(struct lu_orphan_rec_v2),
        .dif_ptrsize            = 4
 };
 EXPORT_SYMBOL(dt_lfsck_layout_orphan_features);
index 979c52d..8500393 100644 (file)
@@ -53,7 +53,7 @@ void lustre_lma_init(struct lustre_mdt_attrs *lma, const struct lu_fid *fid,
        LASSERT(sizeof(*lma) ==
                (offsetof(struct lustre_mdt_attrs, lma_self_fid) +
                 sizeof(lma->lma_self_fid)));
-};
+}
 EXPORT_SYMBOL(lustre_lma_init);
 
 /**
@@ -68,9 +68,52 @@ void lustre_lma_swab(struct lustre_mdt_attrs *lma)
        __swab32s(&lma->lma_incompat);
        lustre_swab_lu_fid(&lma->lma_self_fid);
 #endif
-};
+}
 EXPORT_SYMBOL(lustre_lma_swab);
 
+void lustre_loa_init(struct lustre_ost_attrs *loa, const struct lu_fid *fid,
+                    __u32 compat, __u32 incompat)
+{
+       CLASSERT(sizeof(*loa) == LMA_OLD_SIZE);
+
+       memset(&loa->loa_parent_fid, 0,
+              sizeof(*loa) - offsetof(typeof(*loa), loa_parent_fid));
+       lustre_lma_init(&loa->loa_lma, fid, compat, incompat);
+}
+EXPORT_SYMBOL(lustre_loa_init);
+
+/**
+ * Swab, if needed, LOA (for OST-object only) structure with LMA EA and PFID EA
+ * combined together are stored on-disk in little-endian order.
+ *
+ * \param[in] loa      - the pointer to the LOA structure to be swabbed.
+ * \param[in] to_cpu   - to indicate swab for CPU order or not.
+ */
+void lustre_loa_swab(struct lustre_ost_attrs *loa, bool to_cpu)
+{
+       struct lustre_mdt_attrs *lma = &loa->loa_lma;
+#ifdef __BIG_ENDIAN
+       __u32 compat = lma->lma_compat;
+#endif
+
+       lustre_lma_swab(lma);
+#ifdef __BIG_ENDIAN
+       if (to_cpu)
+               compat = lma->lma_compat;
+
+       if (compat & LMAC_STRIPE_INFO) {
+               lustre_swab_lu_fid(&loa->loa_parent_fid);
+               __swab32s(&loa->loa_stripe_size);
+       }
+       if (compat & LMAC_COMP_INFO) {
+               __swab32s(&loa->loa_comp_id);
+               __swab64s(&loa->loa_comp_start);
+               __swab64s(&loa->loa_comp_end);
+       }
+#endif
+}
+EXPORT_SYMBOL(lustre_loa_swab);
+
 /**
  * Swab, if needed, HSM structure which is stored on-disk in little-endian
  * order.
@@ -85,7 +128,7 @@ void lustre_hsm_swab(struct hsm_attrs *attrs)
        __swab64s(&attrs->hsm_arch_id);
        __swab64s(&attrs->hsm_arch_ver);
 #endif
-};
+}
 
 /*
  * Swab and extract HSM attributes from on-disk xattr.
index db15b4f..ab477fb 100644 (file)
@@ -298,10 +298,7 @@ struct ofd_thread_info {
        struct lu_attr                   fti_attr;
        struct lu_attr                   fti_attr2;
        struct ldlm_res_id               fti_resid;
-       union {
-               struct filter_fid        fti_mds_fid;
-               struct filter_fid_old    fti_mds_fid_old;
-       };
+       struct filter_fid                fti_mds_fid;
        struct ost_id                    fti_ostid;
        struct ofd_object               *fti_obj;
        union {
@@ -573,6 +570,10 @@ static inline void ofd_prepare_fidea(struct filter_fid *ff,
        /* XXX: we are ignoring o_parent_ver here, since this should
         *      be the same for all objects in this fileset. */
        ff->ff_parent.f_ver = cpu_to_le32(oa->o_stripe_idx);
+       if (oa->o_valid & OBD_MD_FLOSTLAYOUT)
+               ost_layout_cpu_to_le(&ff->ff_layout, &oa->o_layout);
+       else
+               memset(&ff->ff_layout, 0, sizeof(ff->ff_layout));
 }
 
 static inline int ofd_validate_seq(struct obd_export *exp, __u64 seq)
index 0a8cf2e..4893e4c 100644 (file)
@@ -76,8 +76,8 @@ static void ofd_inconsistency_verify_one(const struct lu_env *env,
        LASSERT(!fo->ofo_pfid_verified);
 
        lrl->lrl_fid = fo->ofo_header.loh_fid; /* OST-object itself FID. */
-       lrl->lrl_fid2 = client_ff->ff_parent; /* client given PFID. */
-       lrl->lrl_fid3 = local_ff->ff_parent; /* OST local stored PFID. */
+       lrl->lrl_ff_client = *client_ff; /* client given PFID. */
+       lrl->lrl_ff_local = *local_ff; /* OST local stored PFID. */
 
        rc = lfsck_in_notify_local(env, ofd->ofd_osd, lrl, NULL);
        ofd_write_lock(env, fo);
@@ -342,6 +342,7 @@ static void ofd_add_inconsistency_item(const struct lu_env *env,
        ff->ff_parent.f_seq = oa->o_parent_seq;
        ff->ff_parent.f_oid = oa->o_parent_oid;
        ff->ff_parent.f_stripe_idx = oa->o_stripe_idx;
+       ff->ff_layout = oa->o_layout;
 
        spin_lock(&ofd->ofd_inconsistency_lock);
        if (fo->ofo_pfid_checking || fo->ofo_pfid_verified) {
index bae03f3..b7b10a0 100644 (file)
@@ -538,7 +538,9 @@ static int osc_io_setattr_start(const struct lu_env *env,
                oa->o_oi = loi->loi_oi;
                obdo_set_parent_fid(oa, io->u.ci_setattr.sa_parent_fid);
                oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index;
-               oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP;
+               oa->o_layout = io->u.ci_setattr.sa_layout;
+               oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
+                       OBD_MD_FLOSTLAYOUT;
                if (ia_valid & ATTR_CTIME) {
                        oa->o_valid |= OBD_MD_FLCTIME;
                        oa->o_ctime = attr->cat_ctime;
index be3b347..a6e313e 100644 (file)
@@ -219,7 +219,7 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
 {
        struct osd_mdobj_map    *omm = osd->od_mdt_map;
        struct osd_thread_info  *oti = osd_oti_get(env);
-       struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
+       struct lustre_mdt_attrs *lma = &oti->oti_ost_attrs.loa_lma;
        char                    *name = oti->oti_name;
        struct osd_thread_info  *info = osd_oti_get(env);
        struct dentry           *dentry;
@@ -228,15 +228,16 @@ int osd_add_to_remote_parent(const struct lu_env *env, struct osd_device *osd,
 
        /* Set REMOTE_PARENT in lma, so other process like unlink or lfsck
         * can identify this object quickly */
-       rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry, lma);
-       if (rc != 0)
+       rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry,
+                        &oti->oti_ost_attrs);
+       if (rc)
                RETURN(rc);
 
        lma->lma_incompat |= LMAI_REMOTE_PARENT;
        lustre_lma_swab(lma);
        rc = __osd_xattr_set(oti, obj->oo_inode, XATTR_NAME_LMA, lma,
                             sizeof(*lma), XATTR_REPLACE);
-       if (rc != 0)
+       if (rc)
                RETURN(rc);
 
        parent = omm->omm_remote_parent;
@@ -261,7 +262,7 @@ int osd_delete_from_remote_parent(const struct lu_env *env,
 {
        struct osd_mdobj_map       *omm = osd->od_mdt_map;
        struct osd_thread_info     *oti = osd_oti_get(env);
-       struct lustre_mdt_attrs    *lma = &oti->oti_mdt_attrs;
+       struct lustre_mdt_attrs    *lma = &oti->oti_ost_attrs.loa_lma;
        char                       *name = oti->oti_name;
        struct dentry              *dentry;
        struct dentry              *parent;
@@ -270,7 +271,8 @@ int osd_delete_from_remote_parent(const struct lu_env *env,
        int                        rc;
 
        /* Check lma to see whether it is remote object */
-       rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry, lma);
+       rc = osd_get_lma(oti, obj->oo_inode, &oti->oti_obj_dentry,
+                        &oti->oti_ost_attrs);
        if (rc != 0) {
                /* No LMA if the directory is created before 2.0 */
                if (rc == -ENODATA)
@@ -542,7 +544,7 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
        struct inode               *inode;
        struct dentry              *dentry = &info->oti_obj_dentry;
        struct osd_inode_id        *oi_id  = &info->oti_id3;
-       struct lustre_mdt_attrs    *lma    = &info->oti_mdt_attrs;
+       struct lustre_mdt_attrs    *lma    = &info->oti_ost_attrs.loa_lma;
        struct lu_fid              *oi_fid = &lma->lma_self_fid;
        int                         rc;
        ENTRY;
@@ -581,7 +583,7 @@ static int osd_obj_update_entry(struct osd_thread_info *info,
                goto update;
        }
 
-       rc = osd_get_lma(info, inode, dentry, lma);
+       rc = osd_get_lma(info, inode, dentry, &info->oti_ost_attrs);
        if (rc == -ENODATA) {
                rc = osd_get_idif(info, inode, dentry, oi_fid);
                if (rc > 0 || rc == -ENODATA) {
index 552f834..8266ac3 100644 (file)
@@ -78,6 +78,9 @@
 
 #include <lustre_linkea.h>
 
+#define PFID_STRIPE_IDX_BITS   16
+#define PFID_STRIPE_COUNT_MASK ((1 << PFID_STRIPE_IDX_BITS) - 1)
+
 int ldiskfs_pdo = 1;
 module_param(ldiskfs_pdo, int, 0644);
 MODULE_PARM_DESC(ldiskfs_pdo, "ldiskfs with parallel directory operations");
@@ -351,18 +354,20 @@ static struct lu_object *osd_object_alloc(const struct lu_env *env,
 }
 
 int osd_get_lma(struct osd_thread_info *info, struct inode *inode,
-               struct dentry *dentry, struct lustre_mdt_attrs *lma)
+               struct dentry *dentry, struct lustre_ost_attrs *loa)
 {
        int rc;
 
-       CLASSERT(LMA_OLD_SIZE >= sizeof(*lma));
        rc = __osd_xattr_get(inode, dentry, XATTR_NAME_LMA,
-                            info->oti_mdt_attrs_old, LMA_OLD_SIZE);
+                            (void *)loa, sizeof(*loa));
        if (rc > 0) {
-               if ((void *)lma != (void *)info->oti_mdt_attrs_old)
-                       memcpy(lma, info->oti_mdt_attrs_old, sizeof(*lma));
+               struct lustre_mdt_attrs *lma = &loa->loa_lma;
+
+               if (rc < sizeof(*lma))
+                       return -EINVAL;
+
                rc = 0;
-               lustre_lma_swab(lma);
+               lustre_loa_swab(loa, true);
                /* Check LMA compatibility */
                if (lma->lma_incompat & ~LMA_INCOMPAT_SUPP) {
                        CWARN("%.16s: unsupported incompat LMA feature(s) %#x "
@@ -442,13 +447,13 @@ int osd_ldiskfs_add_entry(struct osd_thread_info *info, struct osd_device *osd,
 
        rc = __ldiskfs_add_entry(handle, child, inode, hlock);
        if (rc == -ENOBUFS || rc == -ENOSPC) {
-               struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+               struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
                struct inode *parent = child->d_parent->d_inode;
                struct lu_fid *fid = NULL;
 
-               rc2 = osd_get_lma(info, parent, child->d_parent, lma);
-               if (rc2 == 0) {
-                       fid = &lma->lma_self_fid;
+               rc2 = osd_get_lma(info, parent, child->d_parent, loa);
+               if (!rc2) {
+                       fid = &loa->loa_lma.lma_self_fid;
                } else if (rc2 == -ENODATA) {
                        if (unlikely(parent == inode->i_sb->s_root->d_inode)) {
                                fid = &info->oti_fid3;
@@ -484,17 +489,17 @@ static struct inode *
 osd_iget_fid(struct osd_thread_info *info, struct osd_device *dev,
             struct osd_inode_id *id, struct lu_fid *fid)
 {
-       struct lustre_mdt_attrs *lma   = &info->oti_mdt_attrs;
-       struct inode            *inode;
-       int                      rc;
+       struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+       struct inode *inode;
+       int rc;
 
        inode = osd_iget(info, dev, id);
        if (IS_ERR(inode))
                return inode;
 
-       rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
-       if (rc == 0) {
-               *fid = lma->lma_self_fid;
+       rc = osd_get_lma(info, inode, &info->oti_obj_dentry, loa);
+       if (!rc) {
+               *fid = loa->loa_lma.lma_self_fid;
        } else if (rc == -ENODATA) {
                if (unlikely(inode == osd_sb(dev)->s_root->d_inode))
                        lu_local_obj_fid(fid, OSD_FS_ROOT_OID);
@@ -712,7 +717,8 @@ static int osd_check_lma(const struct lu_env *env, struct osd_object *obj)
 {
        struct osd_thread_info  *info   = osd_oti_get(env);
        struct osd_device       *osd    = osd_obj2dev(obj);
-       struct lustre_mdt_attrs *lma    = &info->oti_mdt_attrs;
+       struct lustre_ost_attrs *loa    = &info->oti_ost_attrs;
+       struct lustre_mdt_attrs *lma    = &loa->loa_lma;
        struct inode            *inode  = obj->oo_inode;
        struct dentry           *dentry = &info->oti_obj_dentry;
        struct lu_fid           *fid    = NULL;
@@ -720,9 +726,8 @@ static int osd_check_lma(const struct lu_env *env, struct osd_object *obj)
        int                      rc;
        ENTRY;
 
-       CLASSERT(LMA_OLD_SIZE >= sizeof(*lma));
        rc = __osd_xattr_get(inode, dentry, XATTR_NAME_LMA,
-                            info->oti_mdt_attrs_old, LMA_OLD_SIZE);
+                            (void *)loa, sizeof(*loa));
        if (rc == -ENODATA && !fid_is_igif(rfid) && osd->od_check_ff) {
                fid = &lma->lma_self_fid;
                rc = osd_get_idif(info, inode, dentry, fid);
@@ -1277,16 +1282,16 @@ static int osd_object_init(const struct lu_env *env, struct lu_object *l,
        obj->oo_dt.do_body_ops = &osd_body_ops_new;
        if (result == 0 && obj->oo_inode != NULL) {
                struct osd_thread_info *oti = osd_oti_get(env);
-               struct lustre_mdt_attrs *lma = &oti->oti_mdt_attrs;
+               struct lustre_ost_attrs *loa = &oti->oti_ost_attrs;
 
                osd_object_init0(obj);
                result = osd_get_lma(oti, obj->oo_inode,
-                                    &oti->oti_obj_dentry, lma);
-               if (result == 0) {
+                                    &oti->oti_obj_dentry, loa);
+               if (!result) {
                        /* Convert LMAI flags to lustre LMA flags
                         * and cache it to oo_lma_flags */
                        obj->oo_lma_flags =
-                               lma_to_lustre_flags(lma->lma_incompat);
+                               lma_to_lustre_flags(loa->loa_lma.lma_incompat);
                } else if (result == -ENODATA) {
                        result = 0;
                }
@@ -2678,10 +2683,11 @@ static int osd_attr_set(const struct lu_env *env,
        /* Let's check if there are extra flags need to be set into LMA */
        if (attr->la_flags & LUSTRE_LMA_FL_MASKS) {
                struct osd_thread_info *info = osd_oti_get(env);
-               struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+               struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
 
-               rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
-               if (rc != 0)
+               rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+                                &info->oti_ost_attrs);
+               if (rc)
                        GOTO(out, rc);
 
                lma->lma_incompat |=
@@ -3259,8 +3265,9 @@ static int osd_object_destroy(const struct lu_env *env,
 int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode,
                   const struct lu_fid *fid, __u32 compat, __u32 incompat)
 {
-       struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
-       int                      rc;
+       struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+       struct lustre_mdt_attrs *lma = &loa->loa_lma;
+       int rc;
        ENTRY;
 
        if (OBD_FAIL_CHECK(OBD_FAIL_FID_INLMA))
@@ -3269,33 +3276,50 @@ int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode,
        if (OBD_FAIL_CHECK(OBD_FAIL_OSD_OST_EA_FID_SET))
                rc = -ENOMEM;
 
-       lustre_lma_init(lma, fid, compat, incompat);
-       lustre_lma_swab(lma);
-
-       rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma, sizeof(*lma),
-                            XATTR_CREATE);
+       lustre_loa_init(loa, fid, compat, incompat);
+       lustre_loa_swab(loa, false);
+
+       /* For the OST device with 256 bytes inode size by default,
+        * the PFID EA will be stored together with LMA EA to avoid
+        * performance trouble. Otherwise the PFID EA can be stored
+        * independently. LU-8998 */
+       if ((compat & LMAC_FID_ON_OST) &&
+           LDISKFS_INODE_SIZE(inode->i_sb) <= 256)
+               rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, loa,
+                                    sizeof(*loa), XATTR_CREATE);
+       else
+               rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+                                    sizeof(*lma), XATTR_CREATE);
        /* LMA may already exist, but we need to check that all the
         * desired compat/incompat flags have been added. */
        if (unlikely(rc == -EEXIST)) {
-               if (compat == 0 && incompat == 0)
-                       RETURN(0);
-
                rc = __osd_xattr_get(inode, &info->oti_obj_dentry,
-                                    XATTR_NAME_LMA, info->oti_mdt_attrs_old,
-                                    LMA_OLD_SIZE);
-               if (rc <= 0)
+                                    XATTR_NAME_LMA, (void *)loa, sizeof(*loa));
+               if (rc < 0)
+                       RETURN(rc);
+
+               if (rc < sizeof(*lma))
                        RETURN(-EINVAL);
 
-               lustre_lma_swab(lma);
-               if (!(~lma->lma_compat & compat) &&
-                   !(~lma->lma_incompat & incompat))
+               lustre_loa_swab(loa, true);
+               if (lu_fid_eq(fid, &lma->lma_self_fid) &&
+                   ((compat == 0 && incompat == 0) ||
+                    (!(~lma->lma_compat & compat) &&
+                     !(~lma->lma_incompat & incompat))))
                        RETURN(0);
 
+               lma->lma_self_fid = *fid;
                lma->lma_compat |= compat;
                lma->lma_incompat |= incompat;
-               lustre_lma_swab(lma);
-               rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
-                                    sizeof(*lma), XATTR_REPLACE);
+               if (rc == sizeof(*lma)) {
+                       lustre_lma_swab(lma);
+                       rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+                                            sizeof(*lma), XATTR_REPLACE);
+               } else {
+                       lustre_loa_swab(loa, false);
+                       rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, loa,
+                                            sizeof(*loa), XATTR_REPLACE);
+               }
        }
 
        RETURN(rc);
@@ -3745,20 +3769,6 @@ static int osd_object_ref_del(const struct lu_env *env, struct dt_object *dt,
 }
 
 /*
- * Get the 64-bit version for an inode.
- */
-static int osd_object_version_get(const struct lu_env *env,
-                                  struct dt_object *dt, dt_obj_version_t *ver)
-{
-        struct inode *inode = osd_dt_obj(dt)->oo_inode;
-
-       CDEBUG(D_INODE, "Get version %#llx for inode %lu\n",
-               LDISKFS_I(inode)->i_fs_version, inode->i_ino);
-        *ver = LDISKFS_I(inode)->i_fs_version;
-        return 0;
-}
-
-/*
  * Concurrency: @dt is read locked.
  */
 static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
@@ -3771,8 +3781,12 @@ static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
        bool                    cache_xattr = false;
        int                     rc;
 
+       LASSERT(buf);
+
        /* version get is not real XATTR but uses xattr API */
        if (strcmp(name, XATTR_NAME_VERSION) == 0) {
+               dt_obj_version_t *ver = buf->lb_buf;
+
                /* for version we are just using xattr API but change inode
                 * field instead */
                if (buf->lb_len == 0)
@@ -3781,7 +3795,10 @@ static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
                if (buf->lb_len < sizeof(dt_obj_version_t))
                        return -ERANGE;
 
-               osd_object_version_get(env, dt, buf->lb_buf);
+               CDEBUG(D_INODE, "Get version %#llx for inode %lu\n",
+                      LDISKFS_I(inode)->i_fs_version, inode->i_ino);
+
+               *ver = LDISKFS_I(inode)->i_fs_version;
 
                return sizeof(dt_obj_version_t);
        }
@@ -3804,6 +3821,49 @@ static int osd_xattr_get(const struct lu_env *env, struct dt_object *dt,
        }
 
        rc = __osd_xattr_get(inode, dentry, name, buf->lb_buf, buf->lb_len);
+       if (rc == -ENODATA && strcmp(name, XATTR_NAME_FID) == 0) {
+               struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+               struct lustre_mdt_attrs *lma = &loa->loa_lma;
+               struct filter_fid *ff;
+               struct ost_layout *ol;
+
+               LASSERT(osd_dev(dt->do_lu.lo_dev)->od_is_ost);
+
+               rc = osd_get_lma(info, inode, &info->oti_obj_dentry, loa);
+               if (rc)
+                       return rc;
+
+               if (!(lma->lma_compat & LMAC_STRIPE_INFO)) {
+                       rc = -ENODATA;
+                       goto cache;
+               }
+
+               rc = sizeof(*ff);
+               if (buf->lb_len == 0 || !buf->lb_buf)
+                       return rc;
+
+               if (buf->lb_len < rc)
+                       return -ERANGE;
+
+               ff = buf->lb_buf;
+               ol = &ff->ff_layout;
+               ol->ol_stripe_count = cpu_to_le32(loa->loa_parent_fid.f_ver >>
+                                                 PFID_STRIPE_IDX_BITS);
+               ol->ol_stripe_size = cpu_to_le32(loa->loa_stripe_size);
+               loa->loa_parent_fid.f_ver &= PFID_STRIPE_COUNT_MASK;
+               fid_cpu_to_le(&ff->ff_parent, &loa->loa_parent_fid);
+               if (lma->lma_compat & LMAC_COMP_INFO) {
+                       ol->ol_comp_start = cpu_to_le64(loa->loa_comp_start);
+                       ol->ol_comp_end = cpu_to_le64(loa->loa_comp_end);
+                       ol->ol_comp_id = cpu_to_le32(loa->loa_comp_id);
+               } else {
+                       ol->ol_comp_start = 0;
+                       ol->ol_comp_end = 0;
+                       ol->ol_comp_id = 0;
+               }
+       }
+
+cache:
        if (cache_xattr) {
                if (rc == -ENOENT || rc == -ENODATA)
                        osd_oxc_add(obj, name, NULL, 0);
@@ -3820,7 +3880,7 @@ static int osd_declare_xattr_set(const struct lu_env *env,
                                  int fl, struct thandle *handle)
 {
        struct osd_thandle *oh;
-       int credits;
+       int credits = 0;
        struct super_block *sb = osd_sb(osd_dev(dt->do_lu.lo_dev));
 
        LASSERT(handle != NULL);
@@ -3832,17 +3892,25 @@ static int osd_declare_xattr_set(const struct lu_env *env,
                /* For non-upgrading case, the LMA is set first and
                 * usually fit inode. But for upgrade case, the LMA
                 * may be in another separated EA block. */
-               if (!dt_object_exists(dt))
-                       credits = 0;
-               else if (fl == LU_XATTR_REPLACE)
-                       credits = 1;
-               else
-                       goto upgrade;
+               if (dt_object_exists(dt)) {
+                       if (fl == LU_XATTR_REPLACE)
+                               credits = 1;
+                       else
+                               goto upgrade;
+               }
        } else if (strcmp(name, XATTR_NAME_VERSION) == 0) {
                credits = 1;
+       } else if (strcmp(name, XATTR_NAME_FID) == 0) {
+               /* We may need to delete the old PFID EA. */
+               credits = LDISKFS_MAXQUOTAS_DEL_BLOCKS(sb);
+               if (fl == LU_XATTR_REPLACE)
+                       credits += 1;
+               else
+                       goto upgrade;
        } else {
+
 upgrade:
-               credits = osd_dto_credits_noquota[DTO_XATTR_SET];
+               credits += osd_dto_credits_noquota[DTO_XATTR_SET];
 
                if (buf != NULL) {
                        ssize_t buflen;
@@ -3880,51 +3948,48 @@ upgrade:
 }
 
 /*
- * Set the 64-bit version for object
- */
-static void osd_object_version_set(const struct lu_env *env,
-                                   struct dt_object *dt,
-                                   dt_obj_version_t *new_version)
-{
-        struct inode *inode = osd_dt_obj(dt)->oo_inode;
-
-       CDEBUG(D_INODE, "Set version %#llx (old %#llx) for inode %lu\n",
-               *new_version, LDISKFS_I(inode)->i_fs_version, inode->i_ino);
-
-        LDISKFS_I(inode)->i_fs_version = *new_version;
-        /** Version is set after all inode operations are finished,
-         *  so we should mark it dirty here */
-       ll_dirty_inode(inode, I_DIRTY_DATASYNC);
-}
-
-/*
  * Concurrency: @dt is write locked.
  */
 static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
                         const struct lu_buf *buf, const char *name, int fl,
                         struct thandle *handle)
 {
-       struct osd_object      *obj      = osd_dt_obj(dt);
-       struct inode           *inode    = obj->oo_inode;
-       struct osd_thread_info *info     = osd_oti_get(env);
-       int                     fs_flags = 0;
-       int                     rc;
+       struct osd_object *obj = osd_dt_obj(dt);
+       struct inode *inode = obj->oo_inode;
+       struct osd_thread_info *info = osd_oti_get(env);
+       struct lustre_ost_attrs *loa = &info->oti_ost_attrs;
+       struct lustre_mdt_attrs *lma = &loa->loa_lma;
+       int fs_flags = 0;
+       int len;
+       int rc;
        ENTRY;
 
-       LASSERT(handle != NULL);
+       LASSERT(handle);
+       LASSERT(buf);
 
        /* version set is not real XATTR */
        if (strcmp(name, XATTR_NAME_VERSION) == 0) {
+               dt_obj_version_t *version = buf->lb_buf;
+
                /* for version we are just using xattr API but change inode
                 * field instead */
                LASSERT(buf->lb_len == sizeof(dt_obj_version_t));
-               osd_object_version_set(env, dt, buf->lb_buf);
-               return sizeof(dt_obj_version_t);
+
+               CDEBUG(D_INODE, "Set version %#llx (old %#llx) for inode %lu\n",
+                      *version, LDISKFS_I(inode)->i_fs_version, inode->i_ino);
+
+               LDISKFS_I(inode)->i_fs_version = *version;
+               /* Version is set after all inode operations are finished,
+                * so we should mark it dirty here */
+               ll_dirty_inode(inode, I_DIRTY_DATASYNC);
+
+               RETURN(0);
        }
 
        CDEBUG(D_INODE, DFID" set xattr '%s' with size %zu\n",
               PFID(lu_object_fid(&dt->do_lu)), name, buf->lb_len);
 
+       len = buf->lb_len;
        osd_trans_exec_op(env, handle, OSD_OT_XATTR_SET);
        if (fl & LU_XATTR_REPLACE)
                fs_flags |= XATTR_REPLACE;
@@ -3932,11 +3997,72 @@ static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
        if (fl & LU_XATTR_CREATE)
                fs_flags |= XATTR_CREATE;
 
-       if (strcmp(name, XATTR_NAME_LMV) == 0) {
-               struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+       /* For the OST device with 256 bytes inode size by default,
+        * the PFID EA will be stored together with LMA EA to avoid
+        * performance trouble. Otherwise the PFID EA can be stored
+        * independently. LU-8998 */
+       if (strcmp(name, XATTR_NAME_FID) == 0 &&
+           LDISKFS_INODE_SIZE(inode->i_sb) <= 256) {
+               struct dentry *dentry = &info->oti_obj_dentry;
+               struct filter_fid *ff;
+               struct ost_layout *ol;
+               int fl;
+
+               LASSERT(osd_dev(dt->do_lu.lo_dev)->od_is_ost);
+
+               ff = buf->lb_buf;
+               ol = &ff->ff_layout;
+               /* Old client does not send stripe information, store
+                * the PFID EA on disk directly. */
+               if (buf->lb_len == sizeof(struct lu_fid) ||
+                   ol->ol_stripe_size == 0) {
+                       len = sizeof(struct lu_fid);
+                       goto set;
+               }
+
+               if (buf->lb_len != sizeof(*ff))
+                       RETURN(-EINVAL);
 
-               rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
-               if (rc != 0)
+               rc = osd_get_lma(info, inode, dentry, loa);
+               if (unlikely(rc == -ENODATA)) {
+                       /* Usually for upgarding from old device */
+                       lustre_loa_init(loa, lu_object_fid(&dt->do_lu),
+                                       LMAC_FID_ON_OST, 0);
+                       fl = XATTR_CREATE;
+               } else if (rc) {
+                       RETURN(rc);
+               } else {
+                       fl = XATTR_REPLACE;
+               }
+
+               fid_le_to_cpu(&loa->loa_parent_fid, &ff->ff_parent);
+               loa->loa_parent_fid.f_ver |= le32_to_cpu(ol->ol_stripe_count) <<
+                                            PFID_STRIPE_IDX_BITS;
+               loa->loa_stripe_size = le32_to_cpu(ol->ol_stripe_size);
+               lma->lma_compat |= LMAC_STRIPE_INFO;
+               if (ol->ol_comp_id != 0) {
+                       loa->loa_comp_id = le32_to_cpu(ol->ol_comp_id);
+                       loa->loa_comp_start = le64_to_cpu(ol->ol_comp_start);
+                       loa->loa_comp_end = le64_to_cpu(ol->ol_comp_end);
+                       lma->lma_compat |= LMAC_COMP_INFO;
+               }
+
+               lustre_loa_swab(loa, false);
+
+               /* Remove old PFID EA entry firstly. */
+               ll_vfs_dq_init(inode);
+               rc = inode->i_op->removexattr(dentry, name);
+               if (rc && rc != -ENODATA)
+                       RETURN(rc);
+
+               /* Store the PFID EA inside the LMA EA. */
+               rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, loa,
+                                    sizeof(*loa), fl);
+
+               RETURN(rc);
+       } else if (strcmp(name, XATTR_NAME_LMV) == 0) {
+               rc = osd_get_lma(info, inode, &info->oti_obj_dentry, loa);
+               if (rc)
                        RETURN(rc);
 
                lma->lma_incompat |= LMAI_STRIPED;
@@ -3947,8 +4073,8 @@ static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
                        RETURN(rc);
        }
 
-       rc = __osd_xattr_set(info, inode, name, buf->lb_buf, buf->lb_len,
-                              fs_flags);
+set:
+       rc = __osd_xattr_set(info, inode, name, buf->lb_buf, len, fs_flags);
        osd_trans_exec_check(env, handle, OSD_OT_XATTR_SET);
 
        if (rc == 0 &&
@@ -4032,6 +4158,27 @@ static int osd_xattr_del(const struct lu_env *env, struct dt_object *dt,
        dentry->d_inode = inode;
        dentry->d_sb = inode->i_sb;
        rc = inode->i_op->removexattr(dentry, name);
+       if (rc == -ENODATA && strcmp(name, XATTR_NAME_FID) == 0) {
+               struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
+
+               LASSERT(osd_dev(dt->do_lu.lo_dev)->od_is_ost);
+
+               rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+                                &info->oti_ost_attrs);
+               if (!rc) {
+                       if (!(lma->lma_compat & LMAC_STRIPE_INFO)) {
+                               rc = -ENODATA;
+                               goto out;
+                       }
+
+                       lma->lma_compat &= ~(LMAC_STRIPE_INFO | LMAC_COMP_INFO);
+                       lustre_lma_swab(lma);
+                       rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+                                            sizeof(*lma), XATTR_REPLACE);
+               }
+       }
+
+out:
        osd_trans_exec_check(env, handle, OSD_OT_XATTR_SET);
 
        if (rc == 0 &&
@@ -4972,9 +5119,9 @@ static int osd_fail_fid_lookup(struct osd_thread_info *oti,
                               struct osd_idmap_cache *oic,
                               struct lu_fid *fid, __u32 ino)
 {
-       struct lustre_mdt_attrs *lma   = &oti->oti_mdt_attrs;
-       struct inode            *inode;
-       int                      rc;
+       struct lustre_ost_attrs *loa = &oti->oti_ost_attrs;
+       struct inode *inode;
+       int rc;
 
        osd_id_gen(&oic->oic_lid, ino, OSD_OII_NOGEN);
        inode = osd_iget(oti, dev, &oic->oic_lid);
@@ -4983,12 +5130,12 @@ static int osd_fail_fid_lookup(struct osd_thread_info *oti,
                return PTR_ERR(inode);
        }
 
-       rc = osd_get_lma(oti, inode, &oti->oti_obj_dentry, lma);
+       rc = osd_get_lma(oti, inode, &oti->oti_obj_dentry, loa);
        iput(inode);
        if (rc != 0)
                fid_zero(&oic->oic_fid);
        else
-               *fid = oic->oic_fid = lma->lma_self_fid;
+               *fid = oic->oic_fid = loa->loa_lma.lma_self_fid;
        return rc;
 }
 
@@ -6062,7 +6209,7 @@ osd_dirent_check_repair(const struct lu_env *env, struct osd_object *obj,
                        struct osd_inode_id *id, __u32 *attr)
 {
        struct osd_thread_info     *info        = osd_oti_get(env);
-       struct lustre_mdt_attrs    *lma         = &info->oti_mdt_attrs;
+       struct lustre_mdt_attrs    *lma         = &info->oti_ost_attrs.loa_lma;
        struct osd_device          *dev         = osd_obj2dev(obj);
        struct super_block         *sb          = osd_sb(dev);
        const char                 *devname     = osd_name(dev);
@@ -6112,7 +6259,7 @@ osd_dirent_check_repair(const struct lu_env *env, struct osd_object *obj,
 
        dentry = osd_child_dentry_by_inode(env, dir, ent->oied_name,
                                           ent->oied_namelen);
-       rc = osd_get_lma(info, inode, dentry, lma);
+       rc = osd_get_lma(info, inode, dentry, &info->oti_ost_attrs);
        if (rc == -ENODATA || !fid_is_sane(&lma->lma_self_fid))
                lma = NULL;
        else if (rc != 0)
index f23ee5f..150c00a 100644 (file)
@@ -583,9 +583,7 @@ struct osd_thread_info {
        struct lu_buf          oti_big_buf;
         /** used in osd_ea_fid_set() to set fid into common ea */
        union {
-               struct lustre_mdt_attrs oti_mdt_attrs;
-               /* old LMA for compatibility */
-               char                    oti_mdt_attrs_old[LMA_OLD_SIZE];
+               struct lustre_ost_attrs oti_ost_attrs;
                struct filter_fid_old   oti_ff;
                struct filter_fid       oti_ff_new;
        };
@@ -667,7 +665,7 @@ struct inode *osd_iget(struct osd_thread_info *info, struct osd_device *dev,
 int osd_ea_fid_set(struct osd_thread_info *info, struct inode *inode,
                   const struct lu_fid *fid, __u32 compat, __u32 incompat);
 int osd_get_lma(struct osd_thread_info *info, struct inode *inode,
-               struct dentry *dentry, struct lustre_mdt_attrs *lma);
+               struct dentry *dentry, struct lustre_ost_attrs *loa);
 void osd_add_oi_cache(struct osd_thread_info *info, struct osd_device *osd,
                      struct osd_inode_id *id, const struct lu_fid *fid);
 int osd_get_idif(struct osd_thread_info *info, struct inode *inode,
index 6d09108..3700879 100644 (file)
@@ -693,7 +693,7 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_device *osd,
                               (const struct dt_key *)oi_fid, th, true);
        if (rc != 0) {
                struct inode *inode;
-               struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+               struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
 
                if (rc != -EEXIST)
                        return rc;
@@ -721,7 +721,8 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_device *osd,
                        goto update;
                }
 
-               rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+               rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+                                &info->oti_ost_attrs);
                iput(inode);
                if (rc == -ENODATA)
                        goto update;
index 514724f..dee0a5e 100644 (file)
@@ -377,8 +377,7 @@ osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
        handle_t                *jh;
        int                      size    = 0;
        int                      rc;
-       bool                     removed = false;
-       bool                     reset   = true;
+       bool                     reset   = false;
        ENTRY;
 
        if (dev->od_scrub.os_file.sf_param & SP_DRYRUN)
@@ -418,23 +417,24 @@ osd_scrub_convert_ff(struct osd_thread_info *info, struct osd_device *dev,
                /* 2) delete the old XATTR_NAME_FID */
                ll_vfs_dq_init(inode);
                rc = inode->i_op->removexattr(dentry, XATTR_NAME_FID);
-               if (rc != 0)
+               if (rc)
                        GOTO(stop, rc);
 
-               removed = true;
-       } else if (unlikely(rc == -ENODATA)) {
-               reset = false;
-       } else if (rc != sizeof(struct filter_fid)) {
+               reset = true;
+       } else if (rc != -ENODATA && rc != sizeof(struct filter_fid)) {
                GOTO(stop, rc = -EINVAL);
        }
 
        /* 3) make new LMA and add it */
        rc = osd_ea_fid_set(info, inode, tfid, LMAC_FID_ON_OST, 0);
-       if (rc == 0 && reset)
-               size = sizeof(struct filter_fid);
-       else if (rc != 0 && removed)
-               /* If failed, we should try to add the old back. */
-               size = sizeof(struct filter_fid_old);
+       if (reset) {
+               if (rc)
+                       /* If failed, we should try to add the old back. */
+                       size = sizeof(*ff);
+               else
+                       /* The new PFID EA will only contains ::ff_parent */
+                       size = sizeof(ff->ff_parent);
+       }
 
        /* 4) generate new XATTR_NAME_FID with the saved parent FID and add it*/
        if (size > 0) {
@@ -863,11 +863,12 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
                             struct osd_device *dev, struct inode *inode,
                             struct lu_fid *fid, bool scrub)
 {
-       struct lustre_mdt_attrs *lma     = &info->oti_mdt_attrs;
-       int                      rc;
-       bool                     has_lma = false;
+       struct lustre_mdt_attrs *lma = &info->oti_ost_attrs.loa_lma;
+       int rc;
+       bool has_lma = false;
 
-       rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+       rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+                        &info->oti_ost_attrs);
        if (rc == 0) {
                has_lma = true;
                if (lma->lma_compat & LMAC_NOT_IN_OI ||
@@ -2001,7 +2002,7 @@ static int
 osd_ios_scan_one(struct osd_thread_info *info, struct osd_device *dev,
                 struct inode *inode, const struct lu_fid *fid, int flags)
 {
-       struct lustre_mdt_attrs *lma    = &info->oti_mdt_attrs;
+       struct lustre_mdt_attrs *lma    = &info->oti_ost_attrs.loa_lma;
        struct osd_inode_id     *id     = &info->oti_id;
        struct osd_inode_id     *id2    = &info->oti_id2;
        struct osd_scrub        *scrub  = &dev->od_scrub;
@@ -2010,7 +2011,8 @@ osd_ios_scan_one(struct osd_thread_info *info, struct osd_device *dev,
        int                      rc;
        ENTRY;
 
-       rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+       rc = osd_get_lma(info, inode, &info->oti_obj_dentry,
+                        &info->oti_ost_attrs);
        if (rc != 0 && rc != -ENODATA) {
                CDEBUG(D_LFSCK, "%s: fail to get lma for init OI scrub: "
                       "rc = %d\n", osd_name(dev), rc);
index 481932d..cca2f6c 100644 (file)
@@ -348,6 +348,7 @@ struct osp_it {
        __u32                     ooi_pos_page;
        __u32                     ooi_pos_lu_page;
        __u32                     ooi_attr;
+       __u32                     ooi_rec_size;
        int                       ooi_pos_ent;
        int                       ooi_total_npages;
        int                       ooi_valid_npages;
index 1fcbac7..a5b69d1 100644 (file)
@@ -1765,6 +1765,7 @@ static int osp_it_fetch(const struct lu_env *env, struct osp_it *it)
                GOTO(out, rc = -EINVAL);
        }
 
+       it->ooi_rec_size = ii->ii_recsize;
        it->ooi_valid_npages = npages;
        if (ptlrpc_rep_need_swab(req))
                it->ooi_swab = 1;
@@ -1909,11 +1910,20 @@ again:
 
                it->ooi_pos_ent++;
                if (it->ooi_pos_ent < idxpage->lip_nr) {
-                       it->ooi_ent =
+                       if (it->ooi_rec_size ==
+                                       sizeof(struct lu_orphan_rec_v2)) {
+                               it->ooi_ent =
+                               (struct lu_orphan_ent_v2 *)idxpage->lip_entries+
+                                                       it->ooi_pos_ent;
+                               if (it->ooi_swab)
+                                       lustre_swab_orphan_ent_v2(it->ooi_ent);
+                       } else {
+                               it->ooi_ent =
                                (struct lu_orphan_ent *)idxpage->lip_entries +
                                                        it->ooi_pos_ent;
-                       if (it->ooi_swab)
-                               lustre_swab_orphan_ent(it->ooi_ent);
+                               if (it->ooi_swab)
+                                       lustre_swab_orphan_ent(it->ooi_ent);
+                       }
                        RETURN(0);
                }
        }
@@ -1956,11 +1966,20 @@ static int osp_orphan_it_key_size(const struct lu_env *env,
 static int osp_orphan_it_rec(const struct lu_env *env, const struct dt_it *di,
                             struct dt_rec *rec, __u32 attr)
 {
-       struct osp_it   *it  = (struct osp_it *)di;
-       struct lu_orphan_ent    *ent = (struct lu_orphan_ent *)it->ooi_ent;
+       struct osp_it *it = (struct osp_it *)di;
 
-       if (likely(ent != NULL)) {
-               *(struct lu_orphan_rec *)rec = ent->loe_rec;
+       if (likely(it->ooi_ent)) {
+               if (it->ooi_rec_size == sizeof(struct lu_orphan_rec_v2)) {
+                       struct lu_orphan_ent_v2 *ent =
+                               (struct lu_orphan_ent_v2 *)it->ooi_ent;
+
+                       *(struct lu_orphan_rec_v2 *)rec = ent->loe_rec;
+               } else {
+                       struct lu_orphan_ent *ent =
+                               (struct lu_orphan_ent *)it->ooi_ent;
+
+                       *(struct lu_orphan_rec *)rec = ent->loe_rec;
+               }
                return 0;
        }
 
index 231a94b..7642894 100644 (file)
@@ -1698,6 +1698,15 @@ void lustre_swab_connect(struct obd_connect_data *ocd)
         CLASSERT(offsetof(typeof(*ocd), paddingF) != 0);
 }
 
+static void lustre_swab_ost_layout(struct ost_layout *ol)
+{
+       __swab32s(&ol->ol_stripe_size);
+       __swab32s(&ol->ol_stripe_count);
+       __swab64s(&ol->ol_comp_start);
+       __swab64s(&ol->ol_comp_end);
+       __swab32s(&ol->ol_comp_id);
+}
+
 void lustre_swab_obdo (struct obdo  *o)
 {
         __swab64s (&o->o_valid);
@@ -1720,8 +1729,8 @@ void lustre_swab_obdo (struct obdo  *o)
         __swab64s (&o->o_ioepoch);
         __swab32s (&o->o_stripe_idx);
         __swab32s (&o->o_parent_ver);
-        /* o_handle is opaque */
-        /* o_lcookie is swabbed elsewhere */
+       lustre_swab_ost_layout(&o->o_layout);
+       CLASSERT(offsetof(typeof(*o), o_padding_3) != 0);
         __swab32s (&o->o_uid_h);
         __swab32s (&o->o_gid_h);
         __swab64s (&o->o_data_version);
@@ -2737,9 +2746,11 @@ void lustre_swab_lfsck_request(struct lfsck_request *lr)
        __swab32s(&lr->lr_flags);
        lustre_swab_lu_fid(&lr->lr_fid);
        lustre_swab_lu_fid(&lr->lr_fid2);
-       lustre_swab_lu_fid(&lr->lr_fid3);
+       __swab32s(&lr->lr_comp_id);
+       CLASSERT(offsetof(typeof(*lr), lr_padding_0) != 0);
        CLASSERT(offsetof(typeof(*lr), lr_padding_1) != 0);
        CLASSERT(offsetof(typeof(*lr), lr_padding_2) != 0);
+       CLASSERT(offsetof(typeof(*lr), lr_padding_3) != 0);
 }
 
 void lustre_swab_lfsck_reply(struct lfsck_reply *lr)
@@ -2749,15 +2760,29 @@ void lustre_swab_lfsck_reply(struct lfsck_reply *lr)
        __swab64s(&lr->lr_repaired);
 }
 
+static void lustre_swab_orphan_rec(struct lu_orphan_rec *rec)
+{
+       lustre_swab_lu_fid(&rec->lor_fid);
+       __swab32s(&rec->lor_uid);
+       __swab32s(&rec->lor_gid);
+}
+
 void lustre_swab_orphan_ent(struct lu_orphan_ent *ent)
 {
        lustre_swab_lu_fid(&ent->loe_key);
-       lustre_swab_lu_fid(&ent->loe_rec.lor_fid);
-       __swab32s(&ent->loe_rec.lor_uid);
-       __swab32s(&ent->loe_rec.lor_gid);
+       lustre_swab_orphan_rec(&ent->loe_rec);
 }
 EXPORT_SYMBOL(lustre_swab_orphan_ent);
 
+void lustre_swab_orphan_ent_v2(struct lu_orphan_ent_v2 *ent)
+{
+       lustre_swab_lu_fid(&ent->loe_key);
+       lustre_swab_orphan_rec(&ent->loe_rec.lor_rec);
+       lustre_swab_ost_layout(&ent->loe_rec.lor_layout);
+       CLASSERT(offsetof(typeof(ent->loe_rec), lor_padding) != 0);
+}
+EXPORT_SYMBOL(lustre_swab_orphan_ent_v2);
+
 void lustre_swab_ladvise(struct lu_ladvise *ladvise)
 {
        __swab16s(&ladvise->lla_advice);
index abdec07..6dc2f3d 100644 (file)
@@ -417,6 +417,16 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lustre_mdt_attrs, lma_self_fid));
        LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid));
+       LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_HSM);
+       LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_NOT_IN_OI);
+       LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_FID_ON_OST);
+       LASSERTF(LMAC_STRIPE_INFO == 0x00000010UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_STRIPE_INFO);
+       LASSERTF(LMAC_COMP_INFO == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_COMP_INFO);
        LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)LMAI_RELEASED);
        LASSERTF(LMAI_AGENT == 0x00000002UL, "found 0x%.8xUL\n",
@@ -427,12 +437,34 @@ void lustre_assert_wire_constants(void)
                (unsigned)LMAI_STRIPED);
        LASSERTF(LMAI_ORPHAN == 0x00000010UL, "found 0x%.8xUL\n",
                (unsigned)LMAI_ORPHAN);
-       LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
-               (unsigned)LMAC_HSM);
-       LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
-               (unsigned)LMAC_NOT_IN_OI);
-       LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
-               (unsigned)LMAC_FID_ON_OST);
+
+       /* Checks for struct lustre_ost_attrs */
+       LASSERTF((int)sizeof(struct lustre_ost_attrs) == 64, "found %lld\n",
+                (long long)(int)sizeof(struct lustre_ost_attrs));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_lma) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_lma));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma) == 24, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_parent_fid) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_parent_fid));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_stripe_size) == 40, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_stripe_size));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_id) == 44, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_id));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_start) == 48, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_start));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_end) == 56, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_end));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end));
        LASSERTF(OUT_CREATE == 1, "found %lld\n",
                 (long long)OUT_CREATE);
        LASSERTF(OUT_DESTROY == 2, "found %lld\n",
@@ -1211,6 +1243,30 @@ void lustre_assert_wire_constants(void)
        LASSERTF(OBD_CKSUM_CRC32C == 0x00000004UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32C);
 
+       /* Checks for struct ost_layout */
+       LASSERTF((int)sizeof(struct ost_layout) == 28, "found %lld\n",
+                (long long)(int)sizeof(struct ost_layout));
+       LASSERTF((int)offsetof(struct ost_layout, ol_stripe_size) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_stripe_size));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_size) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_size));
+       LASSERTF((int)offsetof(struct ost_layout, ol_stripe_count) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_stripe_count));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_count));
+       LASSERTF((int)offsetof(struct ost_layout, ol_comp_start) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_comp_start));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_start) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_start));
+       LASSERTF((int)offsetof(struct ost_layout, ol_comp_end) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_comp_end));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_end) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_end));
+       LASSERTF((int)offsetof(struct ost_layout, ol_comp_id) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_comp_id));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id));
+
        /* Checks for struct obdo */
        LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n",
                 (long long)(int)sizeof(struct obdo));
@@ -1298,10 +1354,14 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obdo, o_handle));
        LASSERTF((int)sizeof(((struct obdo *)0)->o_handle) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct obdo *)0)->o_handle));
-       LASSERTF((int)offsetof(struct obdo, o_lcookie) == 136, "found %lld\n",
-                (long long)(int)offsetof(struct obdo, o_lcookie));
-       LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, "found %lld\n",
-                (long long)(int)sizeof(((struct obdo *)0)->o_lcookie));
+       LASSERTF((int)offsetof(struct obdo, o_layout) == 136, "found %lld\n",
+                (long long)(int)offsetof(struct obdo, o_layout));
+       LASSERTF((int)sizeof(((struct obdo *)0)->o_layout) == 28, "found %lld\n",
+                (long long)(int)sizeof(((struct obdo *)0)->o_layout));
+       LASSERTF((int)offsetof(struct obdo, o_padding_3) == 164, "found %lld\n",
+                (long long)(int)offsetof(struct obdo, o_padding_3));
+       LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
        LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, "found %lld\n",
                 (long long)(int)offsetof(struct obdo, o_uid_h));
        LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, "found %lld\n",
@@ -1410,6 +1470,12 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLGETATTRLOCK);
        LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLDATAVERSION);
+       LASSERTF(OBD_MD_CLOSE_INTENT_EXECED == (0x0020000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_CLOSE_INTENT_EXECED);
+       LASSERTF(OBD_MD_DEFAULT_MEA == (0x0040000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_DEFAULT_MEA);
+       LASSERTF(OBD_MD_FLOSTLAYOUT == (0x0080000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLOSTLAYOUT);
        CLASSERT(OBD_FL_INLINEDATA == 0x00000001);
        CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002);
        CLASSERT(OBD_FL_DELORPHAN == 0x00000004);
@@ -3836,26 +3902,6 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, "found %lld\n",
                 (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid));
 
-       /* Checks for struct llog_cookie */
-       LASSERTF((int)sizeof(struct llog_cookie) == 32, "found %lld\n",
-                (long long)(int)sizeof(struct llog_cookie));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_lgl));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_subsys));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_index));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_padding));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding));
-
        /* Checks for struct llogd_body */
        LASSERTF((int)sizeof(struct llogd_body) == 48, "found %lld\n",
                 (long long)(int)sizeof(struct llogd_body));
@@ -5008,18 +5054,26 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lfsck_request, lr_fid2));
        LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid2));
-       LASSERTF((int)offsetof(struct lfsck_request, lr_fid3) == 64, "found %lld\n",
-                (long long)(int)offsetof(struct lfsck_request, lr_fid3));
-       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid3) == 16, "found %lld\n",
-                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid3));
-       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 80, "found %lld\n",
+       LASSERTF((int)offsetof(struct lfsck_request, lr_comp_id) == 64, "found %lld\n",
+                (long long)(int)offsetof(struct lfsck_request, lr_comp_id));
+       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_comp_id) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_comp_id));
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_0) == 68, "found %lld\n",
+                (long long)(int)offsetof(struct lfsck_request, lr_padding_0));
+       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_0) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_0));
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 72, "found %lld\n",
                 (long long)(int)offsetof(struct lfsck_request, lr_padding_1));
        LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_1) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_1));
-       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 88, "found %lld\n",
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 80, "found %lld\n",
                 (long long)(int)offsetof(struct lfsck_request, lr_padding_2));
        LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_2) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_2));
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_3) == 88, "found %lld\n",
+                (long long)(int)offsetof(struct lfsck_request, lr_padding_3));
+       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_3) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_3));
        LASSERTF(LFSCK_TYPE_SCRUB == 0x00000000UL, "found 0x%.8xUL\n",
                (unsigned)LFSCK_TYPE_SCRUB);
        LASSERTF(LFSCK_TYPE_LAYOUT == 0x00000001UL, "found 0x%.8xUL\n",
index 31897da..1e9d5d0 100644 (file)
@@ -289,7 +289,6 @@ struct lquota_thread_info {
        struct lu_buf           qti_lb;
        struct lu_attr          qti_attr;
        struct dt_object_format qti_dof;
-       struct lustre_mdt_attrs qti_lma;
        struct lu_fid           qti_fid;
        char                    qti_buf[LQUOTA_NAME_MAX];
 };
index a3b3fae..33268f1 100755 (executable)
@@ -1909,6 +1909,9 @@ check_seq_oid()
                local ff_pstripe
                if echo $ff_parent | grep -q 'stripe='; then
                        ff_pstripe=$(echo $ff_parent | sed -e 's/.*stripe=//')
+                       if echo $ff_pstripe | grep -q 'stripe_size='; then
+                               ff_pstripe=$(echo $ff_pstripe | cut -d' ' -f1)
+                       fi
                else
                        #
                        # $LL_DECODE_FILTER_FID does not print "stripe="; look
@@ -1919,6 +1922,15 @@ check_seq_oid()
                                sed -e 's/\]//')
                fi
 
+               if echo $ff_parent | grep -q 'stripe_count='; then
+                       local ff_scnt=$(echo $ff_parent |
+                                       sed -e 's/.*stripe_count=//' |
+                                       cut -d' ' -f1)
+
+                       [ $lmm_count -eq $ff_scnt ] ||
+                               error "FF stripe count $lmm_count != $ff_scnt"
+               fi
+
                 # compare lmm_seq and filter_fid->ff_parent.f_seq
                 [ $ff_pseq = $lmm_seq ] ||
                         error "FF parent SEQ $ff_pseq != $lmm_seq"
index f088343..ea10e6d 100644 (file)
 #include <asm/byteorder.h>
 #include <lustre/lustre_user.h>
 
+#define PFID_STRIPE_IDX_BITS   16
+#define PFID_STRIPE_COUNT_MASK ((1 << PFID_STRIPE_IDX_BITS) - 1)
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+static void lustre_swab_lu_fid(struct lu_fid *fid)
+{
+       __swab64s(&fid->f_seq);
+       __swab32s(&fid->f_oid);
+       __swab32s(&fid->f_ver);
+}
+
+static void lustre_loa_swab(struct lustre_ost_attrs *loa)
+{
+       struct lustre_mdt_attrs *lma = &loa->loa_lma;
+
+       __swab32s(&lma->lma_compat);
+       __swab32s(&lma->lma_incompat);
+       lustre_swab_lu_fid(&lma->lma_self_fid);
+       if (lma->lma_compat & LMAC_STRIPE_INFO) {
+               lustre_swab_lu_fid(&loa->loa_parent_fid);
+               __swab32s(&loa->loa_stripe_size);
+       }
+       if (lma->lma_compat & LMAC_COMP_INFO) {
+               __swab32s(&loa->loa_comp_id);
+               __swab64s(&loa->loa_comp_start);
+               __swab64s(&loa->loa_comp_end);
+       }
+};
+#else
+static void lustre_loa_swab(struct lustre_ost_attrs *loa)
+{
+}
+#endif
+
 int main(int argc, char *argv[])
 {
        int rc = 0;
@@ -56,36 +90,101 @@ int main(int argc, char *argv[])
                int size;
 
                size = getxattr(argv[i], "trusted.fid", buf,
-                               sizeof(struct filter_fid_old));
+                               sizeof(struct filter_fid));
                if (size < 0) {
+                       if (errno == ENODATA) {
+                               struct lustre_ost_attrs *loa = (void *)buf;
+                               int rc1;
+
+                               rc1 = getxattr(argv[i], "trusted.lma", loa,
+                                              sizeof(*loa));
+                               if (rc1 < sizeof(*loa)) {
+                                       fprintf(stderr,
+                                               "%s: error reading fid: %s\n",
+                                               argv[i], strerror(ENODATA));
+                                       if (!rc)
+                                               rc = size;
+                                       continue;
+                               }
+
+                               lustre_loa_swab(loa);
+                               if (!(loa->loa_lma.lma_compat &
+                                     LMAC_STRIPE_INFO)) {
+                                       fprintf(stderr,
+                                               "%s: not stripe info: %s\n",
+                                               argv[i], strerror(ENODATA));
+                                       if (!rc)
+                                               rc = size;
+                                       continue;
+                               }
+
+                               printf("%s: parent="DFID" stripe=%u "
+                                      "stripe_size=%u stripe_count=%u",
+                                      argv[i], loa->loa_parent_fid.f_seq,
+                                      loa->loa_parent_fid.f_oid, 0, /* ver */
+                                      loa->loa_parent_fid.f_stripe_idx &
+                                                       PFID_STRIPE_COUNT_MASK,
+                                      loa->loa_stripe_size,
+                                      loa->loa_parent_fid.f_stripe_idx >>
+                                                       PFID_STRIPE_IDX_BITS);
+                               if (loa->loa_comp_id != 0)
+                                       printf(" component_id=%u "
+                                              "component_start=%llu "
+                                              "component_end=%llu",
+                                              loa->loa_comp_id,
+                                              loa->loa_comp_start,
+                                              loa->loa_comp_end);
+                               printf("\n");
+                               continue;
+                       }
+
                        fprintf(stderr, "%s: error reading fid: %s\n",
                                argv[i], strerror(errno));
-                       if (rc == 0)
+                       if (!rc)
                                rc = size;
                        continue;
                }
-               if (size > sizeof(struct filter_fid_old)) {
+
+               if (size != sizeof(struct filter_fid) &&
+                   size != sizeof(struct filter_fid_old) &&
+                   size != sizeof(struct lu_fid)) {
                        fprintf(stderr, "%s: warning: fid larger than expected"
                                " (%d bytes), recompile?\n", argv[i], size);
-               } else if (size > sizeof(*ff)) {
+                       continue;
+               }
+
+               printf("%s: ", argv[i]);
+               if (size == sizeof(struct filter_fid_old)) {
                        struct filter_fid_old *ffo = (void *)buf;
 
-                       /* old filter_fid */
-                       printf("%s: objid=%llu seq=%llu parent="DFID
-                              " stripe=%u\n", argv[i],
+                       printf("objid=%llu seq=%llu ",
                               (unsigned long long)__le64_to_cpu(ffo->ff_objid),
-                              (unsigned long long)__le64_to_cpu(ffo->ff_seq),
-                              (unsigned long long)__le64_to_cpu(ffo->ff_parent.f_seq),
-                              le32toh(ffo->ff_parent.f_oid), 0 /* ver */,
-                              /* this is stripe_nr actually */
-                              le32toh(ffo->ff_parent.f_stripe_idx));
-               } else {
-                       printf("%s: parent="DFID" stripe=%u\n", argv[i],
-                              (unsigned long long)__le64_to_cpu(ff->ff_parent.f_seq),
-                              __le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
-                              /* this is stripe_nr actually */
-                              __le32_to_cpu(ff->ff_parent.f_stripe_idx));
+                              (unsigned long long)__le64_to_cpu(ffo->ff_seq));
+               }
+
+               printf("parent="DFID" stripe=%u",
+                      (unsigned long long)__le64_to_cpu(ff->ff_parent.f_seq),
+                      __le32_to_cpu(ff->ff_parent.f_oid), 0, /* ver */
+                      /* this is stripe_nr actually */
+                      __le32_to_cpu(ff->ff_parent.f_stripe_idx));
+
+               if (size >= sizeof(struct filter_fid)) {
+                       struct ost_layout *ol = &ff->ff_layout;
+
+                       /* new filter_fid, support PFL */
+                       printf(" stripe_size=%u stripe_count=%u",
+                              __le32_to_cpu(ol->ol_stripe_size),
+                              __le32_to_cpu(ol->ol_stripe_count));
+                       if (ol->ol_comp_id != 0)
+                               printf(" component_id=%u "
+                                      "component_start=%llu "
+                                      "component_end=%llu",
+                                      __le32_to_cpu(ol->ol_comp_id),
+                                      __le64_to_cpu(ol->ol_comp_start),
+                                      __le64_to_cpu(ol->ol_comp_end));
                }
+
+               printf("\n");
        }
 
        return rc;
index 58faa39..3b87d73 100644 (file)
@@ -206,15 +206,31 @@ check_lustre_mdt_attrs(void)
        CHECK_MEMBER(lustre_mdt_attrs, lma_compat);
        CHECK_MEMBER(lustre_mdt_attrs, lma_incompat);
        CHECK_MEMBER(lustre_mdt_attrs, lma_self_fid);
+
+       CHECK_VALUE_X(LMAC_HSM);
+       CHECK_VALUE_X(LMAC_NOT_IN_OI);
+       CHECK_VALUE_X(LMAC_FID_ON_OST);
+       CHECK_VALUE_X(LMAC_STRIPE_INFO);
+       CHECK_VALUE_X(LMAC_COMP_INFO);
+
        CHECK_VALUE_X(LMAI_RELEASED);
        CHECK_VALUE_X(LMAI_AGENT);
        CHECK_VALUE_X(LMAI_REMOTE_PARENT);
        CHECK_VALUE_X(LMAI_STRIPED);
        CHECK_VALUE_X(LMAI_ORPHAN);
+}
 
-       CHECK_VALUE_X(LMAC_HSM);
-       CHECK_VALUE_X(LMAC_NOT_IN_OI);
-       CHECK_VALUE_X(LMAC_FID_ON_OST);
+static void
+check_lustre_ost_attrs(void)
+{
+       BLANK_LINE();
+       CHECK_STRUCT(lustre_ost_attrs);
+       CHECK_MEMBER(lustre_ost_attrs, loa_lma);
+       CHECK_MEMBER(lustre_ost_attrs, loa_parent_fid);
+       CHECK_MEMBER(lustre_ost_attrs, loa_stripe_size);
+       CHECK_MEMBER(lustre_ost_attrs, loa_comp_id);
+       CHECK_MEMBER(lustre_ost_attrs, loa_comp_start);
+       CHECK_MEMBER(lustre_ost_attrs, loa_comp_end);
 }
 
 static void
@@ -585,6 +601,18 @@ check_obd_connect_data(void)
 }
 
 static void
+check_ost_layout(void)
+{
+       BLANK_LINE();
+       CHECK_STRUCT(ost_layout);
+       CHECK_MEMBER(ost_layout, ol_stripe_size);
+       CHECK_MEMBER(ost_layout, ol_stripe_count);
+       CHECK_MEMBER(ost_layout, ol_comp_start);
+       CHECK_MEMBER(ost_layout, ol_comp_end);
+       CHECK_MEMBER(ost_layout, ol_comp_id);
+}
+
+static void
 check_obdo(void)
 {
        BLANK_LINE();
@@ -610,7 +638,8 @@ check_obdo(void)
        CHECK_MEMBER(obdo, o_stripe_idx);
        CHECK_MEMBER(obdo, o_parent_ver);
        CHECK_MEMBER(obdo, o_handle);
-       CHECK_MEMBER(obdo, o_lcookie);
+       CHECK_MEMBER(obdo, o_layout);
+       CHECK_MEMBER(obdo, o_padding_3);
        CHECK_MEMBER(obdo, o_uid_h);
        CHECK_MEMBER(obdo, o_gid_h);
        CHECK_MEMBER(obdo, o_data_version);
@@ -660,6 +689,9 @@ check_obdo(void)
        CHECK_DEFINE_64X(OBD_MD_FLCROSSREF);
        CHECK_DEFINE_64X(OBD_MD_FLGETATTRLOCK);
        CHECK_DEFINE_64X(OBD_MD_FLDATAVERSION);
+       CHECK_DEFINE_64X(OBD_MD_CLOSE_INTENT_EXECED);
+       CHECK_DEFINE_64X(OBD_MD_DEFAULT_MEA);
+       CHECK_DEFINE_64X(OBD_MD_FLOSTLAYOUT);
 
        CHECK_CVALUE_X(OBD_FL_INLINEDATA);
        CHECK_CVALUE_X(OBD_FL_OBDMDEXISTS);
@@ -1737,17 +1769,6 @@ check_llog_log_hdr(void)
 }
 
 static void
-check_llog_cookie(void)
-{
-       BLANK_LINE();
-       CHECK_STRUCT(llog_cookie);
-       CHECK_MEMBER(llog_cookie, lgc_lgl);
-       CHECK_MEMBER(llog_cookie, lgc_subsys);
-       CHECK_MEMBER(llog_cookie, lgc_index);
-       CHECK_MEMBER(llog_cookie, lgc_padding);
-}
-
-static void
 check_llogd_body(void)
 {
        BLANK_LINE();
@@ -2341,9 +2362,11 @@ static void check_lfsck_request(void)
        CHECK_MEMBER(lfsck_request, lr_flags);
        CHECK_MEMBER(lfsck_request, lr_fid);
        CHECK_MEMBER(lfsck_request, lr_fid2);
-       CHECK_MEMBER(lfsck_request, lr_fid3);
+       CHECK_MEMBER(lfsck_request, lr_comp_id);
+       CHECK_MEMBER(lfsck_request, lr_padding_0);
        CHECK_MEMBER(lfsck_request, lr_padding_1);
        CHECK_MEMBER(lfsck_request, lr_padding_2);
+       CHECK_MEMBER(lfsck_request, lr_padding_3);
 
        CHECK_VALUE_X(LFSCK_TYPE_SCRUB);
        CHECK_VALUE_X(LFSCK_TYPE_LAYOUT);
@@ -2697,6 +2720,7 @@ main(int argc, char **argv)
        CHECK_STRUCT(obd_uuid);
        check_lu_seq_range();
        check_lustre_mdt_attrs();
+       check_lustre_ost_attrs();
 
        CHECK_VALUE(OUT_CREATE);
        CHECK_VALUE(OUT_DESTROY);
@@ -2726,6 +2750,7 @@ main(int argc, char **argv)
        check_lustre_msg_v2();
        check_ptlrpc_body();
        check_obd_connect_data();
+       check_ost_layout();
        check_obdo();
        check_lov_ost_data_v1();
        check_lov_mds_md_v1();
@@ -2788,7 +2813,6 @@ main(int argc, char **argv)
        check_llog_gen();
        check_llog_gen_rec();
        check_llog_log_hdr();
-       check_llog_cookie();
        check_llogd_body();
        check_llogd_conn_body();
        check_ll_fiemap_info_key();
index 508fd18..8346c56 100644 (file)
@@ -437,6 +437,16 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lustre_mdt_attrs, lma_self_fid));
        LASSERTF((int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct lustre_mdt_attrs *)0)->lma_self_fid));
+       LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_HSM);
+       LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_NOT_IN_OI);
+       LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_FID_ON_OST);
+       LASSERTF(LMAC_STRIPE_INFO == 0x00000010UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_STRIPE_INFO);
+       LASSERTF(LMAC_COMP_INFO == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_COMP_INFO);
        LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)LMAI_RELEASED);
        LASSERTF(LMAI_AGENT == 0x00000002UL, "found 0x%.8xUL\n",
@@ -447,12 +457,34 @@ void lustre_assert_wire_constants(void)
                (unsigned)LMAI_STRIPED);
        LASSERTF(LMAI_ORPHAN == 0x00000010UL, "found 0x%.8xUL\n",
                (unsigned)LMAI_ORPHAN);
-       LASSERTF(LMAC_HSM == 0x00000001UL, "found 0x%.8xUL\n",
-               (unsigned)LMAC_HSM);
-       LASSERTF(LMAC_NOT_IN_OI == 0x00000004UL, "found 0x%.8xUL\n",
-               (unsigned)LMAC_NOT_IN_OI);
-       LASSERTF(LMAC_FID_ON_OST == 0x00000008UL, "found 0x%.8xUL\n",
-               (unsigned)LMAC_FID_ON_OST);
+
+       /* Checks for struct lustre_ost_attrs */
+       LASSERTF((int)sizeof(struct lustre_ost_attrs) == 64, "found %lld\n",
+                (long long)(int)sizeof(struct lustre_ost_attrs));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_lma) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_lma));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma) == 24, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_lma));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_parent_fid) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_parent_fid));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid) == 16, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_parent_fid));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_stripe_size) == 40, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_stripe_size));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_stripe_size));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_id) == 44, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_id));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_id));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_start) == 48, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_start));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_start));
+       LASSERTF((int)offsetof(struct lustre_ost_attrs, loa_comp_end) == 56, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_ost_attrs, loa_comp_end));
+       LASSERTF((int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_ost_attrs *)0)->loa_comp_end));
        LASSERTF(OUT_CREATE == 1, "found %lld\n",
                 (long long)OUT_CREATE);
        LASSERTF(OUT_DESTROY == 2, "found %lld\n",
@@ -1231,6 +1263,30 @@ void lustre_assert_wire_constants(void)
        LASSERTF(OBD_CKSUM_CRC32C == 0x00000004UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32C);
 
+       /* Checks for struct ost_layout */
+       LASSERTF((int)sizeof(struct ost_layout) == 28, "found %lld\n",
+                (long long)(int)sizeof(struct ost_layout));
+       LASSERTF((int)offsetof(struct ost_layout, ol_stripe_size) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_stripe_size));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_size) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_size));
+       LASSERTF((int)offsetof(struct ost_layout, ol_stripe_count) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_stripe_count));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_stripe_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_stripe_count));
+       LASSERTF((int)offsetof(struct ost_layout, ol_comp_start) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_comp_start));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_start) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_start));
+       LASSERTF((int)offsetof(struct ost_layout, ol_comp_end) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_comp_end));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_end) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_end));
+       LASSERTF((int)offsetof(struct ost_layout, ol_comp_id) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct ost_layout, ol_comp_id));
+       LASSERTF((int)sizeof(((struct ost_layout *)0)->ol_comp_id) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ost_layout *)0)->ol_comp_id));
+
        /* Checks for struct obdo */
        LASSERTF((int)sizeof(struct obdo) == 208, "found %lld\n",
                 (long long)(int)sizeof(struct obdo));
@@ -1318,10 +1374,14 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obdo, o_handle));
        LASSERTF((int)sizeof(((struct obdo *)0)->o_handle) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct obdo *)0)->o_handle));
-       LASSERTF((int)offsetof(struct obdo, o_lcookie) == 136, "found %lld\n",
-                (long long)(int)offsetof(struct obdo, o_lcookie));
-       LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, "found %lld\n",
-                (long long)(int)sizeof(((struct obdo *)0)->o_lcookie));
+       LASSERTF((int)offsetof(struct obdo, o_layout) == 136, "found %lld\n",
+                (long long)(int)offsetof(struct obdo, o_layout));
+       LASSERTF((int)sizeof(((struct obdo *)0)->o_layout) == 28, "found %lld\n",
+                (long long)(int)sizeof(((struct obdo *)0)->o_layout));
+       LASSERTF((int)offsetof(struct obdo, o_padding_3) == 164, "found %lld\n",
+                (long long)(int)offsetof(struct obdo, o_padding_3));
+       LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct obdo *)0)->o_padding_3));
        LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, "found %lld\n",
                 (long long)(int)offsetof(struct obdo, o_uid_h));
        LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, "found %lld\n",
@@ -1430,6 +1490,12 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLGETATTRLOCK);
        LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLDATAVERSION);
+       LASSERTF(OBD_MD_CLOSE_INTENT_EXECED == (0x0020000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_CLOSE_INTENT_EXECED);
+       LASSERTF(OBD_MD_DEFAULT_MEA == (0x0040000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_DEFAULT_MEA);
+       LASSERTF(OBD_MD_FLOSTLAYOUT == (0x0080000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLOSTLAYOUT);
        CLASSERT(OBD_FL_INLINEDATA == 0x00000001);
        CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002);
        CLASSERT(OBD_FL_DELORPHAN == 0x00000004);
@@ -3856,26 +3922,6 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid) == 40, "found %lld\n",
                 (long long)(int)sizeof(((struct llog_log_hdr *)0)->llh_tgtuuid));
 
-       /* Checks for struct llog_cookie */
-       LASSERTF((int)sizeof(struct llog_cookie) == 32, "found %lld\n",
-                (long long)(int)sizeof(struct llog_cookie));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_lgl) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_lgl));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_lgl) == 20, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_lgl));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_subsys) == 20, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_subsys));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_subsys) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_subsys));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_index) == 24, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_index));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_index) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_index));
-       LASSERTF((int)offsetof(struct llog_cookie, lgc_padding) == 28, "found %lld\n",
-                (long long)(int)offsetof(struct llog_cookie, lgc_padding));
-       LASSERTF((int)sizeof(((struct llog_cookie *)0)->lgc_padding) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct llog_cookie *)0)->lgc_padding));
-
        /* Checks for struct llogd_body */
        LASSERTF((int)sizeof(struct llogd_body) == 48, "found %lld\n",
                 (long long)(int)sizeof(struct llogd_body));
@@ -5028,18 +5074,26 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lfsck_request, lr_fid2));
        LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid2));
-       LASSERTF((int)offsetof(struct lfsck_request, lr_fid3) == 64, "found %lld\n",
-                (long long)(int)offsetof(struct lfsck_request, lr_fid3));
-       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_fid3) == 16, "found %lld\n",
-                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_fid3));
-       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 80, "found %lld\n",
+       LASSERTF((int)offsetof(struct lfsck_request, lr_comp_id) == 64, "found %lld\n",
+                (long long)(int)offsetof(struct lfsck_request, lr_comp_id));
+       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_comp_id) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_comp_id));
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_0) == 68, "found %lld\n",
+                (long long)(int)offsetof(struct lfsck_request, lr_padding_0));
+       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_0) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_0));
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_1) == 72, "found %lld\n",
                 (long long)(int)offsetof(struct lfsck_request, lr_padding_1));
        LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_1) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_1));
-       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 88, "found %lld\n",
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_2) == 80, "found %lld\n",
                 (long long)(int)offsetof(struct lfsck_request, lr_padding_2));
        LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_2) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_2));
+       LASSERTF((int)offsetof(struct lfsck_request, lr_padding_3) == 88, "found %lld\n",
+                (long long)(int)offsetof(struct lfsck_request, lr_padding_3));
+       LASSERTF((int)sizeof(((struct lfsck_request *)0)->lr_padding_3) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lfsck_request *)0)->lr_padding_3));
        LASSERTF(LFSCK_TYPE_SCRUB == 0x00000000UL, "found 0x%.8xUL\n",
                (unsigned)LFSCK_TYPE_SCRUB);
        LASSERTF(LFSCK_TYPE_LAYOUT == 0x00000001UL, "found 0x%.8xUL\n",