+void lustre_loa_init(struct lustre_ost_attrs *loa, const struct lu_fid *fid,
+ __u32 compat, __u32 incompat)
+{
+ BUILD_BUG_ON(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, SOM structure which is stored on-disk in little-endian
+ * order.
+ *
+ * \param attrs - is a pointer to the SOM structure to be swabbed.
+ */
+void lustre_som_swab(struct lustre_som_attrs *attrs)
+{
+#ifdef __BIG_ENDIAN
+ __swab16s(&attrs->lsa_valid);
+ __swab64s(&attrs->lsa_size);
+ __swab64s(&attrs->lsa_blocks);
+#endif
+}
+EXPORT_SYMBOL(lustre_som_swab);
+