Whamcloud - gitweb
LU-6179 llite: remove LOCKAHEAD_OLD compatibility
[fs/lustre-release.git] / lustre / utils / wiretest.c
index 673281c..b38f1fe 100644 (file)
 #ifdef HAVE_SERVER_SUPPORT
 #include <linux/lustre/lustre_lfsck_user.h>
 #include <linux/lustre/lustre_disk.h>
-#endif
+#ifdef CONFIG_FS_POSIX_ACL
+#include <linux/posix_acl_xattr.h>
+#ifdef HAVE_STRUCT_POSIX_ACL_XATTR
+# define posix_acl_xattr_header struct posix_acl_xattr_header
+# define posix_acl_xattr_entry  struct posix_acl_xattr_entry
+#endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
+#endif /* CONFIG_FS_POSIX_ACL */
+#endif /* HAVE_SERVER_SUPPORT */
+#include <linux/lustre/lustre_cfg.h>
 
 #define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
-#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__);ret = 1;}
+#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__); ret = 1; }
 /*
- * Compile-time LASSERT, which verifies correctness at compile-time rather
- * than runtime. If "cond" is true, then there are two different cases
- * ("(non-zero)" and "0"). If "cond" is false, then there are two identical
- * cases ("0" and "0"), which is an error that causes the compiler to complain.
+ * BUILD_BUG_ON() is Compile-time LASSERT, which verifies correctness at
+ * compile-time rather than runtime. If "cond" is true, then there are two
+ * identical cases ("0" and "0"), which is an error that causes the compiler to
+ * complain. If "cond" is false, then there are two different cases
+ * ("(non-zero)" and "0").
+ *
  */
-#define CLASSERT(cond) do {switch (1) {case (cond): case 0: break; } } while (0)
+#ifndef BUILD_BUG_ON
+#define BUILD_BUG_ON(cond) do {switch (0) {case (cond): case 1: break; } } while (0)
+#endif
 
 int ret;
 
@@ -57,12 +69,12 @@ void lustre_assert_wire_constants(void);
 
 int main()
 {
-        lustre_assert_wire_constants();
+       lustre_assert_wire_constants();
 
-        if (ret == 0)
-                printf("wire constants OK\n");
+       if (ret == 0)
+               printf("wire constants OK\n");
 
-        return ret;
+       return ret;
 }
 
 void lustre_assert_wire_constants(void)
@@ -82,7 +94,7 @@ void lustre_assert_wire_constants(void)
                 MDS_DIR_END_OFF);
        LASSERTF(DEAD_HANDLE_MAGIC == 0xdeadbeefcafebabeULL, "found 0x%.16llxULL\n",
                 DEAD_HANDLE_MAGIC);
-       CLASSERT(MTI_NAME_MAXLEN == 64);
+       BUILD_BUG_ON(MTI_NAME_MAXLEN != 64);
        LASSERTF(OST_REPLY == 0, "found %lld\n",
                 (long long)OST_REPLY);
        LASSERTF(OST_GETATTR == 1, "found %lld\n",
@@ -123,7 +135,9 @@ void lustre_assert_wire_constants(void)
                 (long long)OST_QUOTA_ADJUST_QUNIT);
        LASSERTF(OST_LADVISE == 21, "found %lld\n",
                 (long long)OST_LADVISE);
-       LASSERTF(OST_LAST_OPC == 22, "found %lld\n",
+       LASSERTF(OST_FALLOCATE == 22, "found %lld\n",
+                (long long)OST_FALLOCATE);
+       LASSERTF(OST_LAST_OPC == 23, "found %lld\n",
                 (long long)OST_LAST_OPC);
        LASSERTF(OBD_OBJECT_EOF == 0xffffffffffffffffULL, "found 0x%.16llxULL\n",
                 OBD_OBJECT_EOF);
@@ -195,7 +209,9 @@ void lustre_assert_wire_constants(void)
                 (long long)MDS_HSM_CT_UNREGISTER);
        LASSERTF(MDS_SWAP_LAYOUTS == 61, "found %lld\n",
                 (long long)MDS_SWAP_LAYOUTS);
-       LASSERTF(MDS_LAST_OPC == 62, "found %lld\n",
+       LASSERTF(MDS_RMFID == 62, "found %lld\n",
+                (long long)MDS_RMFID);
+       LASSERTF(MDS_LAST_OPC == 63, "found %lld\n",
                 (long long)MDS_LAST_OPC);
        LASSERTF(REINT_SETATTR == 1, "found %lld\n",
                 (long long)REINT_SETATTR);
@@ -275,6 +291,12 @@ void lustre_assert_wire_constants(void)
                        (long long)MDS_ATTR_BLOCKS);
        LASSERTF(MDS_ATTR_PROJID == 0x0000000000010000ULL, "found 0x%.16llxULL\n",
                        (long long)MDS_ATTR_PROJID);
+       LASSERTF(MDS_ATTR_LSIZE == 0x0000000000020000ULL, "found 0x%.16llxULL\n",
+                       (long long)MDS_ATTR_LSIZE);
+       LASSERTF(MDS_ATTR_LBLOCKS == 0x0000000000040000ULL, "found 0x%.16llxULL\n",
+                       (long long)MDS_ATTR_LBLOCKS);
+       LASSERTF(MDS_ATTR_OVERRIDE == 0x0000000002000000ULL, "found 0x%.16llxULL\n",
+                       (long long)MDS_ATTR_OVERRIDE);
        LASSERTF(FLD_QUERY == 900, "found %lld\n",
                 (long long)FLD_QUERY);
        LASSERTF(FLD_READ == 901, "found %lld\n",
@@ -339,30 +361,26 @@ void lustre_assert_wire_constants(void)
                 (long long)LCK_MAXMODE);
        LASSERTF(LCK_MODE_NUM == 8, "found %lld\n",
                 (long long)LCK_MODE_NUM);
-       CLASSERT(LDLM_PLAIN == 10);
-       CLASSERT(LDLM_EXTENT == 11);
-       CLASSERT(LDLM_FLOCK == 12);
-       CLASSERT(LDLM_IBITS == 13);
-       CLASSERT(LDLM_MAX_TYPE == 14);
-       CLASSERT(LUSTRE_RES_ID_SEQ_OFF == 0);
-       CLASSERT(LUSTRE_RES_ID_VER_OID_OFF == 1);
+       BUILD_BUG_ON(LDLM_PLAIN != 10);
+       BUILD_BUG_ON(LDLM_EXTENT != 11);
+       BUILD_BUG_ON(LDLM_FLOCK != 12);
+       BUILD_BUG_ON(LDLM_IBITS != 13);
+       BUILD_BUG_ON(LDLM_MAX_TYPE != 14);
+       BUILD_BUG_ON(LUSTRE_RES_ID_SEQ_OFF != 0);
+       BUILD_BUG_ON(LUSTRE_RES_ID_VER_OID_OFF != 1);
        LASSERTF(OUT_UPDATE == 1000, "found %lld\n",
                 (long long)OUT_UPDATE);
        LASSERTF(OUT_UPDATE_LAST_OPC == 1001, "found %lld\n",
                 (long long)OUT_UPDATE_LAST_OPC);
-       CLASSERT(LUSTRE_RES_ID_QUOTA_SEQ_OFF == 2);
-       CLASSERT(LUSTRE_RES_ID_QUOTA_VER_OID_OFF == 3);
-       CLASSERT(LUSTRE_RES_ID_HSH_OFF == 3);
-       CLASSERT(LQUOTA_TYPE_USR == 0);
-       CLASSERT(LQUOTA_TYPE_GRP == 1);
-       CLASSERT(LQUOTA_RES_MD == 1);
-       CLASSERT(LQUOTA_RES_DT == 2);
+       BUILD_BUG_ON(LUSTRE_RES_ID_QUOTA_SEQ_OFF != 2);
+       BUILD_BUG_ON(LUSTRE_RES_ID_QUOTA_VER_OID_OFF != 3);
+       BUILD_BUG_ON(LUSTRE_RES_ID_HSH_OFF != 3);
+       BUILD_BUG_ON(LQUOTA_TYPE_USR != 0);
+       BUILD_BUG_ON(LQUOTA_TYPE_GRP != 1);
+       BUILD_BUG_ON(LQUOTA_RES_MD != 1);
+       BUILD_BUG_ON(LQUOTA_RES_DT != 2);
        LASSERTF(OBD_PING == 400, "found %lld\n",
                 (long long)OBD_PING);
-       LASSERTF(OBD_LOG_CANCEL == 401, "found %lld\n",
-                (long long)OBD_LOG_CANCEL);
-       LASSERTF(OBD_QC_CALLBACK == 402, "found %lld\n",
-                (long long)OBD_QC_CALLBACK);
        LASSERTF(OBD_IDX_READ == 403, "found %lld\n",
                 (long long)OBD_IDX_READ);
        LASSERTF(OBD_LAST_OPC == 404, "found %lld\n",
@@ -385,6 +403,8 @@ void lustre_assert_wire_constants(void)
                 (long long)MGS_TARGET_DEL);
        LASSERTF(MGS_SET_INFO == 255, "found %lld\n",
                 (long long)MGS_SET_INFO);
+       LASSERTF(MGS_CONFIG_READ == 256, "found %lld\n",
+                (long long)MGS_CONFIG_READ);
        LASSERTF(MGS_LAST_OPC == 257, "found %lld\n",
                 (long long)MGS_LAST_OPC);
        LASSERTF(SEC_CTX_INIT == 801, "found %lld\n",
@@ -450,6 +470,8 @@ void lustre_assert_wire_constants(void)
                (unsigned)LMAC_STRIPE_INFO);
        LASSERTF(LMAC_COMP_INFO == 0x00000020UL, "found 0x%.8xUL\n",
                (unsigned)LMAC_COMP_INFO);
+       LASSERTF(LMAC_IDX_BACKUP == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)LMAC_IDX_BACKUP);
        LASSERTF(LMAI_RELEASED == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)LMAI_RELEASED);
        LASSERTF(LMAI_AGENT == 0x00000002UL, "found 0x%.8xUL\n",
@@ -520,6 +542,30 @@ void lustre_assert_wire_constants(void)
                 (long long)OUT_PUNCH);
        LASSERTF(OUT_READ == 15, "found %lld\n",
                 (long long)OUT_READ);
+       LASSERTF(OUT_NOOP == 16, "found %lld\n",
+                (long long)OUT_NOOP);
+       LASSERTF(OUT_XATTR_LIST == 17, "found %lld\n",
+                (long long)OUT_XATTR_LIST);
+
+       /* Checks for struct lustre_som_attrs */
+       LASSERTF((int)sizeof(struct lustre_som_attrs) == 24, "found %lld\n",
+                (long long)(int)sizeof(struct lustre_som_attrs));
+       LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_valid) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_som_attrs, lsa_valid));
+       LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_valid));
+       LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_reserved) == 2, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_som_attrs, lsa_reserved));
+       LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved) == 6, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_reserved));
+       LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_size) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_som_attrs, lsa_size));
+       LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_size) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_size));
+       LASSERTF((int)offsetof(struct lustre_som_attrs, lsa_blocks) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_som_attrs, lsa_blocks));
+       LASSERTF((int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_som_attrs *)0)->lsa_blocks));
 
        /* Checks for struct hsm_attrs */
        LASSERTF((int)sizeof(struct hsm_attrs) == 24, "found %lld\n",
@@ -560,6 +606,8 @@ void lustre_assert_wire_constants(void)
                 (long long)FID_SEQ_UNUSED_START);
        LASSERTF(FID_SEQ_UNUSED_END == 9, "found %lld\n",
                 (long long)FID_SEQ_UNUSED_END);
+       LASSERTF(FID_SEQ_LLOG_NAME == 10, "found %lld\n",
+                (long long)FID_SEQ_LLOG_NAME);
        LASSERTF(FID_SEQ_RSVD == 11, "found %lld\n",
                 (long long)FID_SEQ_RSVD);
        LASSERTF(FID_SEQ_IGIF == 12, "found %lld\n",
@@ -576,6 +624,8 @@ void lustre_assert_wire_constants(void)
                        (long long)FID_SEQ_LOCAL_FILE);
        LASSERTF(FID_SEQ_DOT_LUSTRE == 0x0000000200000002ULL, "found 0x%.16llxULL\n",
                        (long long)FID_SEQ_DOT_LUSTRE);
+       LASSERTF(FID_SEQ_LOCAL_NAME == 0x0000000200000003ULL, "found 0x%.16llxULL\n",
+                       (long long)FID_SEQ_LOCAL_NAME);
        LASSERTF(FID_SEQ_SPECIAL == 0x0000000200000004ULL, "found 0x%.16llxULL\n",
                        (long long)FID_SEQ_SPECIAL);
        LASSERTF(FID_SEQ_QUOTA == 0x0000000200000005ULL, "found 0x%.16llxULL\n",
@@ -600,6 +650,8 @@ void lustre_assert_wire_constants(void)
                (unsigned)FID_OID_DOT_LUSTRE);
        LASSERTF(FID_OID_DOT_LUSTRE_OBF == 0x00000002UL, "found 0x%.8xUL\n",
                (unsigned)FID_OID_DOT_LUSTRE_OBF);
+       LASSERTF(FID_OID_DOT_LUSTRE_LPF == 0x00000003UL, "found 0x%.8xUL\n",
+               (unsigned)FID_OID_DOT_LUSTRE_LPF);
 
        /* Checks for struct lu_dirent */
        LASSERTF((int)sizeof(struct lu_dirent) == 32, "found %lld\n",
@@ -711,6 +763,10 @@ void lustre_assert_wire_constants(void)
                 (long long)LU_LADVISE_WILLREAD);
        LASSERTF(LU_LADVISE_DONTNEED == 2, "found %lld\n",
                 (long long)LU_LADVISE_DONTNEED);
+       LASSERTF(LU_LADVISE_LOCKNOEXPAND == 3, "found %lld\n",
+                (long long)LU_LADVISE_LOCKNOEXPAND);
+       LASSERTF(LU_LADVISE_LOCKAHEAD == 4, "found %lld\n",
+                (long long)LU_LADVISE_LOCKAHEAD);
 
        /* Checks for struct ladvise_hdr */
        LASSERTF((int)sizeof(struct ladvise_hdr) == 32, "found %lld\n",
@@ -743,10 +799,9 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct ladvise_hdr, lah_advise));
        LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_advise) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_advise));
-       LASSERTF(LF_ASYNC == 1, "found %lld\n",
-                (long long)LF_ASYNC);
-       LASSERTF(LADVISE_MAGIC == 450829536, "found %lld\n",
-                (long long)LADVISE_MAGIC);
+       BUILD_BUG_ON(LF_ASYNC != 0x00000001);
+       BUILD_BUG_ON(LF_UNSET != 0x00000002);
+       BUILD_BUG_ON(LADVISE_MAGIC != 0x1adf1ce0);
 
        /* Checks for struct lustre_handle */
        LASSERTF((int)sizeof(struct lustre_handle) == 8, "found %lld\n",
@@ -795,10 +850,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lustre_msg_v2, lm_buflens[0]));
        LASSERTF((int)sizeof(((struct lustre_msg_v2 *)0)->lm_buflens[0]) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct lustre_msg_v2 *)0)->lm_buflens[0]));
-       LASSERTF(LUSTRE_MSG_MAGIC_V2 == 0x0BD00BD3, "found 0x%.8x\n",
-               LUSTRE_MSG_MAGIC_V2);
-       LASSERTF(LUSTRE_MSG_MAGIC_V2_SWABBED == 0xD30BD00B, "found 0x%.8x\n",
-               LUSTRE_MSG_MAGIC_V2_SWABBED);
+       LASSERTF(LUSTRE_MSG_MAGIC_V2 == 0x0bd00bd3UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_MSG_MAGIC_V2);
+       LASSERTF(LUSTRE_MSG_MAGIC_V2_SWABBED == 0xd30bd00bUL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_MSG_MAGIC_V2_SWABBED);
 
        /* Checks for struct ptlrpc_body */
        LASSERTF((int)sizeof(struct ptlrpc_body_v3) == 184, "found %lld\n",
@@ -875,7 +930,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct ptlrpc_body_v3, pb_slv));
        LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_slv) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_slv));
-       CLASSERT(PTLRPC_NUM_VERSIONS == 4);
+       BUILD_BUG_ON(PTLRPC_NUM_VERSIONS != 4);
        LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_pre_versions) == 88, "found %lld\n",
                 (long long)(int)offsetof(struct ptlrpc_body_v3, pb_pre_versions));
        LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_pre_versions) == 32, "found %lld\n",
@@ -896,7 +951,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct ptlrpc_body_v3, pb_padding64_2));
        LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_padding64_2));
-       CLASSERT(LUSTRE_JOBID_SIZE == 32);
+       BUILD_BUG_ON(LUSTRE_JOBID_SIZE != 32);
        LASSERTF((int)offsetof(struct ptlrpc_body_v3, pb_jobid) == 152, "found %lld\n",
                 (long long)(int)offsetof(struct ptlrpc_body_v3, pb_jobid));
        LASSERTF((int)sizeof(((struct ptlrpc_body_v3 *)0)->pb_jobid) == 32, "found %lld\n",
@@ -1013,42 +1068,30 @@ void lustre_assert_wire_constants(void)
                 (long long)DLM_REPLY_REC_OFF);
        LASSERTF(MSG_PTLRPC_HEADER_OFF == 31, "found %lld\n",
                 (long long)MSG_PTLRPC_HEADER_OFF);
-       LASSERTF(PTLRPC_MSG_VERSION == 0x00000003, "found 0x%.8x\n",
-               PTLRPC_MSG_VERSION);
-       LASSERTF(LUSTRE_VERSION_MASK == 0xffff0000, "found 0x%.8x\n",
-               LUSTRE_VERSION_MASK);
-       LASSERTF(LUSTRE_OBD_VERSION == 0x00010000, "found 0x%.8x\n",
-               LUSTRE_OBD_VERSION);
-       LASSERTF(LUSTRE_MDS_VERSION == 0x00020000, "found 0x%.8x\n",
-               LUSTRE_MDS_VERSION);
-       LASSERTF(LUSTRE_OST_VERSION == 0x00030000, "found 0x%.8x\n",
-               LUSTRE_OST_VERSION);
-       LASSERTF(LUSTRE_DLM_VERSION == 0x00040000, "found 0x%.8x\n",
-               LUSTRE_DLM_VERSION);
-       LASSERTF(LUSTRE_LOG_VERSION == 0x00050000, "found 0x%.8x\n",
-               LUSTRE_LOG_VERSION);
-       LASSERTF(LUSTRE_MGS_VERSION == 0x00060000, "found 0x%.8x\n",
-               LUSTRE_MGS_VERSION);
+       LASSERTF(PTLRPC_MSG_VERSION == 0x00000003UL, "found 0x%.8xUL\n",
+               (unsigned)PTLRPC_MSG_VERSION);
+       LASSERTF(LUSTRE_VERSION_MASK == 0xffff0000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_VERSION_MASK);
+       LASSERTF(LUSTRE_OBD_VERSION == 0x00010000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_OBD_VERSION);
+       LASSERTF(LUSTRE_MDS_VERSION == 0x00020000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_MDS_VERSION);
+       LASSERTF(LUSTRE_OST_VERSION == 0x00030000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_OST_VERSION);
+       LASSERTF(LUSTRE_DLM_VERSION == 0x00040000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_DLM_VERSION);
+       LASSERTF(LUSTRE_LOG_VERSION == 0x00050000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_LOG_VERSION);
+       LASSERTF(LUSTRE_MGS_VERSION == 0x00060000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_MGS_VERSION);
        LASSERTF(MSGHDR_AT_SUPPORT == 1, "found %lld\n",
                 (long long)MSGHDR_AT_SUPPORT);
        LASSERTF(MSGHDR_CKSUM_INCOMPAT18 == 2, "found %lld\n",
                 (long long)MSGHDR_CKSUM_INCOMPAT18);
-       LASSERTF(MSG_OP_FLAG_MASK == 0xffff0000UL, "found 0x%.8xUL\n",
-               (unsigned)MSG_OP_FLAG_MASK);
-       LASSERTF(MSG_OP_FLAG_SHIFT == 16, "found %lld\n",
-                (long long)MSG_OP_FLAG_SHIFT);
-       LASSERTF(MSG_GEN_FLAG_MASK == 0x0000ffffUL, "found 0x%.8xUL\n",
-               (unsigned)MSG_GEN_FLAG_MASK);
-       LASSERTF(MSG_LAST_REPLAY == 0x00000001UL, "found 0x%.8xUL\n",
-               (unsigned)MSG_LAST_REPLAY);
        LASSERTF(MSG_RESENT == 0x00000002UL, "found 0x%.8xUL\n",
                (unsigned)MSG_RESENT);
        LASSERTF(MSG_REPLAY == 0x00000004UL, "found 0x%.8xUL\n",
                (unsigned)MSG_REPLAY);
-       LASSERTF(MSG_DELAY_REPLAY == 0x00000010UL, "found 0x%.8xUL\n",
-               (unsigned)MSG_DELAY_REPLAY);
-       LASSERTF(MSG_VERSION_REPLAY == 0x00000020UL, "found 0x%.8xUL\n",
-               (unsigned)MSG_VERSION_REPLAY);
        LASSERTF(MSG_REQ_REPLAY_DONE == 0x00000040UL, "found 0x%.8xUL\n",
                (unsigned)MSG_REQ_REPLAY_DONE);
        LASSERTF(MSG_LOCK_REPLAY_DONE == 0x00000080UL, "found 0x%.8xUL\n",
@@ -1063,8 +1106,6 @@ void lustre_assert_wire_constants(void)
                (unsigned)MSG_CONNECT_LIBCLIENT);
        LASSERTF(MSG_CONNECT_INITIAL == 0x00000020UL, "found 0x%.8xUL\n",
                (unsigned)MSG_CONNECT_INITIAL);
-       LASSERTF(MSG_CONNECT_ASYNC == 0x00000040UL, "found 0x%.8xUL\n",
-               (unsigned)MSG_CONNECT_ASYNC);
        LASSERTF(MSG_CONNECT_NEXT_VER == 0x00000080UL, "found 0x%.8xUL\n",
                (unsigned)MSG_CONNECT_NEXT_VER);
        LASSERTF(MSG_CONNECT_TRANSNO == 0x00000100UL, "found 0x%.8xUL\n",
@@ -1309,6 +1350,8 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_PINGLESS);
        LASSERTF(OBD_CONNECT_FLOCK_DEAD == 0x8000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_FLOCK_DEAD);
+       LASSERTF(OBD_CONNECT_DISP_STRIPE == 0x10000000000000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT_DISP_STRIPE);
        LASSERTF(OBD_CONNECT_OPEN_BY_FID == 0x20000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_OPEN_BY_FID);
        LASSERTF(OBD_CONNECT_LFSCK == 0x40000000000000ULL, "found 0x%.16llxULL\n",
@@ -1321,8 +1364,6 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT_DIR_STRIPE);
        LASSERTF(OBD_CONNECT_SUBTREE == 0x800000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_SUBTREE);
-       LASSERTF(OBD_CONNECT_LOCKAHEAD_OLD == 0x1000000000000000ULL, "found 0x%.16llxULL\n",
-                OBD_CONNECT_LOCKAHEAD_OLD);
        LASSERTF(OBD_CONNECT_BULK_MBITS == 0x2000000000000000ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT_BULK_MBITS);
        LASSERTF(OBD_CONNECT_OBDOPACK == 0x4000000000000000ULL, "found 0x%.16llxULL\n",
@@ -1333,12 +1374,52 @@ void lustre_assert_wire_constants(void)
                 OBD_CONNECT2_FILE_SECCTX);
        LASSERTF(OBD_CONNECT2_LOCKAHEAD == 0x2ULL, "found 0x%.16llxULL\n",
                 OBD_CONNECT2_LOCKAHEAD);
+       LASSERTF(OBD_CONNECT2_DIR_MIGRATE == 0x4ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_DIR_MIGRATE);
+       LASSERTF(OBD_CONNECT2_SUM_STATFS == 0x8ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_SUM_STATFS);
+       LASSERTF(OBD_CONNECT2_OVERSTRIPING == 0x10ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_OVERSTRIPING);
+       LASSERTF(OBD_CONNECT2_FLR == 0x20ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_FLR);
+       LASSERTF(OBD_CONNECT2_WBC_INTENTS == 0x40ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_WBC_INTENTS);
+       LASSERTF(OBD_CONNECT2_LOCK_CONVERT == 0x80ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_LOCK_CONVERT);
+       LASSERTF(OBD_CONNECT2_ARCHIVE_ID_ARRAY == 0x100ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_ARCHIVE_ID_ARRAY);
+       LASSERTF(OBD_CONNECT2_INC_XID == 0x200ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_INC_XID);
+       LASSERTF(OBD_CONNECT2_SELINUX_POLICY == 0x400ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_SELINUX_POLICY);
+       LASSERTF(OBD_CONNECT2_LSOM == 0x800ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_LSOM);
+       LASSERTF(OBD_CONNECT2_PCC == 0x1000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_PCC);
+       LASSERTF(OBD_CONNECT2_CRUSH == 0x2000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_CRUSH);
+       LASSERTF(OBD_CONNECT2_ASYNC_DISCARD == 0x4000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_ASYNC_DISCARD);
+       LASSERTF(OBD_CONNECT2_ENCRYPT == 0x8000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT2_ENCRYPT);
        LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32);
        LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_ADLER);
        LASSERTF(OBD_CKSUM_CRC32C == 0x00000004UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32C);
+       LASSERTF(OBD_CKSUM_RESERVED == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)OBD_CKSUM_RESERVED);
+       LASSERTF(OBD_CKSUM_T10IP512 == 0x00000010UL, "found 0x%.8xUL\n",
+               (unsigned)OBD_CKSUM_T10IP512);
+       LASSERTF(OBD_CKSUM_T10IP4K == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)OBD_CKSUM_T10IP4K);
+       LASSERTF(OBD_CKSUM_T10CRC512 == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)OBD_CKSUM_T10CRC512);
+       LASSERTF(OBD_CKSUM_T10CRC4K == 0x00000080UL, "found 0x%.8xUL\n",
+               (unsigned)OBD_CKSUM_T10CRC4K);
+       LASSERTF(OBD_CKSUM_T10_TOP == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)OBD_CKSUM_T10_TOP);
 
        /* Checks for struct ost_layout */
        LASSERTF((int)sizeof(struct ost_layout) == 28, "found %lld\n",
@@ -1511,10 +1592,12 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLGID);
        LASSERTF(OBD_MD_FLFLAGS == (0x00000800ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLFLAGS);
+       LASSERTF(OBD_MD_DOM_SIZE == (0X00001000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_DOM_SIZE);
        LASSERTF(OBD_MD_FLNLINK == (0x00002000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLNLINK);
-       LASSERTF(OBD_MD_FLGENER == (0x00004000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_FLGENER);
+       LASSERTF(OBD_MD_FLPARENT == (0x00004000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLPARENT);
        LASSERTF(OBD_MD_FLRDEV == (0x00010000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLRDEV);
        LASSERTF(OBD_MD_FLEASIZE == (0x00020000ULL), "found 0x%.16llxULL\n",
@@ -1525,14 +1608,12 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLHANDLE);
        LASSERTF(OBD_MD_FLCKSUM == (0x00100000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLCKSUM);
-       LASSERTF(OBD_MD_FLQOS == (0x00200000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_FLQOS);
+       LASSERTF(OBD_MD_FLPRJQUOTA == (0x00400000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLPRJQUOTA);
        LASSERTF(OBD_MD_FLGROUP == (0x01000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLGROUP);
        LASSERTF(OBD_MD_FLFID == (0x02000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLFID);
-       LASSERTF(OBD_MD_FLEPOCH == (0x04000000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_FLEPOCH);
        LASSERTF(OBD_MD_FLGRANT == (0x08000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLGRANT);
        LASSERTF(OBD_MD_FLDIREA == (0x10000000ULL), "found 0x%.16llxULL\n",
@@ -1545,8 +1626,6 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLMODEASIZE);
        LASSERTF(OBD_MD_MDS == (0x0000000100000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_MDS);
-       LASSERTF(OBD_MD_REINT == (0x0000000200000000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_REINT);
        LASSERTF(OBD_MD_MEA == (0x0000000400000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_MEA);
        LASSERTF(OBD_MD_TSTATE == (0x0000000800000000ULL), "found 0x%.16llxULL\n",
@@ -1559,16 +1638,14 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLXATTRRM);
        LASSERTF(OBD_MD_FLACL == (0x0000008000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLACL);
-       LASSERTF(OBD_MD_FLMDSCAPA == (0x0000020000000000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_FLMDSCAPA);
-       LASSERTF(OBD_MD_FLOSSCAPA == (0x0000040000000000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_FLOSSCAPA);
-       LASSERTF(OBD_MD_FLCKSPLIT == (0x0000080000000000ULL), "found 0x%.16llxULL\n",
-                OBD_MD_FLCKSPLIT);
+       LASSERTF(OBD_MD_FLAGSTATFS == (0x0000010000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLAGSTATFS);
        LASSERTF(OBD_MD_FLCROSSREF == (0x0000100000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLCROSSREF);
        LASSERTF(OBD_MD_FLGETATTRLOCK == (0x0000200000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLGETATTRLOCK);
+       LASSERTF(OBD_MD_FLOBJCOUNT == (0x0000400000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLOBJCOUNT);
        LASSERTF(OBD_MD_FLDATAVERSION == (0x0010000000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLDATAVERSION);
        LASSERTF(OBD_MD_CLOSE_INTENT_EXECED == (0x0020000000000000ULL), "found 0x%.16llxULL\n",
@@ -1579,28 +1656,38 @@ void lustre_assert_wire_constants(void)
                 OBD_MD_FLOSTLAYOUT);
        LASSERTF(OBD_MD_FLPROJID == (0x0100000000000000ULL), "found 0x%.16llxULL\n",
                 OBD_MD_FLPROJID);
-       CLASSERT(OBD_FL_INLINEDATA == 0x00000001);
-       CLASSERT(OBD_FL_OBDMDEXISTS == 0x00000002);
-       CLASSERT(OBD_FL_DELORPHAN == 0x00000004);
-       CLASSERT(OBD_FL_NORPC == 0x00000008);
-       CLASSERT(OBD_FL_IDONLY == 0x00000010);
-       CLASSERT(OBD_FL_RECREATE_OBJS == 0x00000020);
-       CLASSERT(OBD_FL_DEBUG_CHECK == 0x00000040);
-       CLASSERT(OBD_FL_NO_USRQUOTA == 0x00000100);
-       CLASSERT(OBD_FL_NO_GRPQUOTA == 0x00000200);
-       CLASSERT(OBD_FL_CREATE_CROW == 0x00000400);
-       CLASSERT(OBD_FL_SRVLOCK == 0x00000800);
-       CLASSERT(OBD_FL_CKSUM_CRC32 == 0x00001000);
-       CLASSERT(OBD_FL_CKSUM_ADLER == 0x00002000);
-       CLASSERT(OBD_FL_CKSUM_CRC32C == 0x00004000);
-       CLASSERT(OBD_FL_CKSUM_RSVD2 == 0x00008000);
-       CLASSERT(OBD_FL_CKSUM_RSVD3 == 0x00010000);
-       CLASSERT(OBD_FL_SHRINK_GRANT == 0x00020000);
-       CLASSERT(OBD_FL_MMAP == 0x00040000);
-       CLASSERT(OBD_FL_RECOV_RESEND == 0x00080000);
-       CLASSERT(OBD_FL_NOSPC_BLK == 0x00100000);
-       CLASSERT(OBD_FL_FLUSH == 0x00200000);
-       CLASSERT(OBD_FL_SHORT_IO == 0x00400000);
+       LASSERTF(OBD_MD_SECCTX == (0x0200000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_SECCTX);
+       LASSERTF(OBD_MD_FLLAZYSIZE == (0x0400000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLLAZYSIZE);
+       LASSERTF(OBD_MD_FLLAZYBLOCKS == (0x0800000000000000ULL), "found 0x%.16llxULL\n",
+                OBD_MD_FLLAZYBLOCKS);
+       BUILD_BUG_ON(OBD_FL_INLINEDATA != 0x00000001);
+       BUILD_BUG_ON(OBD_FL_OBDMDEXISTS != 0x00000002);
+       BUILD_BUG_ON(OBD_FL_DELORPHAN != 0x00000004);
+       BUILD_BUG_ON(OBD_FL_NORPC != 0x00000008);
+       BUILD_BUG_ON(OBD_FL_IDONLY != 0x00000010);
+       BUILD_BUG_ON(OBD_FL_RECREATE_OBJS != 0x00000020);
+       BUILD_BUG_ON(OBD_FL_DEBUG_CHECK != 0x00000040);
+       BUILD_BUG_ON(OBD_FL_NO_PRJQUOTA != 0x00000080);
+       BUILD_BUG_ON(OBD_FL_NO_USRQUOTA != 0x00000100);
+       BUILD_BUG_ON(OBD_FL_NO_GRPQUOTA != 0x00000200);
+       BUILD_BUG_ON(OBD_FL_CREATE_CROW != 0x00000400);
+       BUILD_BUG_ON(OBD_FL_SRVLOCK != 0x00000800);
+       BUILD_BUG_ON(OBD_FL_CKSUM_CRC32 != 0x00001000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_ADLER != 0x00002000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_CRC32C != 0x00004000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_T10IP512 != 0x00005000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_T10IP4K != 0x00006000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_T10CRC512 != 0x00007000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_T10CRC4K != 0x00008000);
+       BUILD_BUG_ON(OBD_FL_CKSUM_RSVD3 != 0x00010000);
+       BUILD_BUG_ON(OBD_FL_SHRINK_GRANT != 0x00020000);
+       BUILD_BUG_ON(OBD_FL_MMAP != 0x00040000);
+       BUILD_BUG_ON(OBD_FL_RECOV_RESEND != 0x00080000);
+       BUILD_BUG_ON(OBD_FL_NOSPC_BLK != 0x00100000);
+       BUILD_BUG_ON(OBD_FL_FLUSH != 0x00200000);
+       BUILD_BUG_ON(OBD_FL_SHORT_IO != 0x00400000);
 
        /* Checks for struct lov_ost_data_v1 */
        LASSERTF((int)sizeof(struct lov_ost_data_v1) == 24, "found %lld\n",
@@ -1649,7 +1736,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lov_mds_md_v1, lmm_objects[0]));
        LASSERTF((int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]) == 24, "found %lld\n",
                 (long long)(int)sizeof(((struct lov_mds_md_v1 *)0)->lmm_objects[0]));
-       CLASSERT(LOV_MAGIC_V1 == (0x0BD10000 | 0x0BD0));
+       BUILD_BUG_ON(LOV_MAGIC_V1 != (0x0BD10000 | 0x0BD0));
 
        /* Checks for struct lov_mds_md_v3 */
        LASSERTF((int)sizeof(struct lov_mds_md_v3) == 48, "found %lld\n",
@@ -1678,7 +1765,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lov_mds_md_v3, lmm_layout_gen));
        LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen) == 2, "found %lld\n",
                 (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_layout_gen));
-       CLASSERT(LOV_MAXPOOLNAME == 15);
+       BUILD_BUG_ON(LOV_MAXPOOLNAME != 15);
        LASSERTF((int)offsetof(struct lov_mds_md_v3, lmm_pool_name[15 + 1]) == 48, "found %lld\n",
                 (long long)(int)offsetof(struct lov_mds_md_v3, lmm_pool_name[15 + 1]));
        LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_pool_name[15 + 1]) == 1, "found %lld\n",
@@ -1687,15 +1774,15 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lov_mds_md_v3, lmm_objects[0]));
        LASSERTF((int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_objects[0]) == 24, "found %lld\n",
                 (long long)(int)sizeof(((struct lov_mds_md_v3 *)0)->lmm_objects[0]));
-       CLASSERT(LOV_MAGIC_V3 == (0x0BD30000 | 0x0BD0));
+       BUILD_BUG_ON(LOV_MAGIC_V3 != (0x0BD30000 | 0x0BD0));
        LASSERTF(LOV_PATTERN_RAID0 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)LOV_PATTERN_RAID0);
        LASSERTF(LOV_PATTERN_RAID1 == 0x00000002UL, "found 0x%.8xUL\n",
                (unsigned)LOV_PATTERN_RAID1);
        LASSERTF(LOV_PATTERN_MDT == 0x00000100UL, "found 0x%.8xUL\n",
                (unsigned)LOV_PATTERN_MDT);
-       LASSERTF(LOV_PATTERN_CMOBD == 0x00000200UL, "found 0x%.8xUL\n",
-               (unsigned)LOV_PATTERN_CMOBD);
+       LASSERTF(LOV_PATTERN_OVERSTRIPING == 0x00000200UL, "found 0x%.8xUL\n",
+               (unsigned)LOV_PATTERN_OVERSTRIPING);
 
        /* Checks for struct lov_comp_md_entry_v1 */
        LASSERTF((int)sizeof(struct lov_comp_md_entry_v1) == 48, "found %lld\n",
@@ -1720,14 +1807,27 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_size));
        LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_size) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_size));
-       LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding) == 32, "found %lld\n",
-                (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_padding));
-       LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding) == 16, "found %lld\n",
-                (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding));
-       LASSERTF(LCME_FL_INIT == 0x00000010UL, "found 0x%.8xUL\n",
-               (unsigned)LCME_FL_INIT);
-       LASSERTF(LCME_FL_NEG == 0x80000000UL, "found 0x%.8xUL\n",
-               (unsigned)LCME_FL_NEG);
+       LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_layout_gen) == 32, "found %lld\n",
+                (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_layout_gen));
+       LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_layout_gen) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_layout_gen));
+       LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_timestamp) == 36, "found %lld\n",
+                (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_timestamp));
+       LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_timestamp) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_timestamp));
+       LASSERTF((int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1) == 44, "found %lld\n",
+                (long long)(int)offsetof(struct lov_comp_md_entry_v1, lcme_padding_1));
+       LASSERTF((int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lov_comp_md_entry_v1 *)0)->lcme_padding_1));
+       BUILD_BUG_ON(LCME_FL_STALE != 0x00000001);
+       BUILD_BUG_ON(LCME_FL_PREF_RD != 0x00000002);
+       BUILD_BUG_ON(LCME_FL_PREF_WR != 0x00000004);
+       BUILD_BUG_ON(LCME_FL_PREF_RW != 0x00000006);
+       BUILD_BUG_ON(LCME_FL_OFFLINE != 0x00000008);
+       BUILD_BUG_ON(LCME_FL_INIT != 0x00000010);
+       BUILD_BUG_ON(LCME_FL_NOSYNC != 0x00000020);
+       BUILD_BUG_ON(LCME_FL_EXTENSION != 0x00000040);
+       BUILD_BUG_ON(LCME_FL_NEG != 0x80000000);
 
        /* Checks for struct lov_comp_md_v1 */
        LASSERTF((int)sizeof(struct lov_comp_md_v1) == 32, "found %lld\n",
@@ -1768,9 +1868,9 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lov_comp_md_v1, lcm_entries[0]));
        LASSERTF((int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0]) == 48, "found %lld\n",
                 (long long)(int)sizeof(((struct lov_comp_md_v1 *)0)->lcm_entries[0]));
-       CLASSERT(LOV_MAGIC_COMP_V1 == (0x0BD60000 | 0x0BD0));
-       LASSERTF(LCM_FL_NOT_FLR == 0, "found %lld\n",
-                (long long)LCM_FL_NOT_FLR);
+       BUILD_BUG_ON(LOV_MAGIC_COMP_V1 != (0x0BD60000 | 0x0BD0));
+       LASSERTF(LCM_FL_NONE == 0, "found %lld\n",
+                (long long)LCM_FL_NONE);
        LASSERTF(LCM_FL_RDONLY == 1, "found %lld\n",
                 (long long)LCM_FL_RDONLY);
        LASSERTF(LCM_FL_WRITE_PENDING == 2, "found %lld\n",
@@ -1801,13 +1901,17 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_layout_version));
        LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_layout_version) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_layout_version));
-       LASSERTF((int)offsetof(struct lmv_mds_md_v1, lmv_padding1) == 20, "found %lld\n",
-                (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_padding1));
-       LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_padding1) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_padding1));
-       LASSERTF((int)offsetof(struct lmv_mds_md_v1, lmv_padding2) == 24, "found %lld\n",
+       LASSERTF((int)offsetof(struct lmv_mds_md_v1, lmv_migrate_offset) == 20, "found %lld\n",
+                (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_migrate_offset));
+       LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_migrate_offset) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_migrate_offset));
+       LASSERTF((int)offsetof(struct lmv_mds_md_v1, lmv_migrate_hash) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_migrate_hash));
+       LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_migrate_hash) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_migrate_hash));
+       LASSERTF((int)offsetof(struct lmv_mds_md_v1, lmv_padding2) == 28, "found %lld\n",
                 (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_padding2));
-       LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_padding2) == 8, "found %lld\n",
+       LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_padding2) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_padding2));
        LASSERTF((int)offsetof(struct lmv_mds_md_v1, lmv_padding3) == 32, "found %lld\n",
                 (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_padding3));
@@ -1821,13 +1925,13 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lmv_mds_md_v1, lmv_stripe_fids[0]));
        LASSERTF((int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_stripe_fids[0]) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct lmv_mds_md_v1 *)0)->lmv_stripe_fids[0]));
-       CLASSERT(LMV_MAGIC_V1 == 0x0CD20CD0);
-       CLASSERT(LMV_MAGIC_STRIPE == 0x0CD40CD0);
-       CLASSERT(LMV_HASH_TYPE_MASK == 0x0000ffff);
-       CLASSERT(LMV_HASH_FLAG_MIGRATION == 0x80000000);
-       CLASSERT(LMV_HASH_FLAG_DEAD == 0x40000000);
-       CLASSERT(LMV_HASH_FLAG_BAD_TYPE == 0x20000000);
-       CLASSERT(LMV_HASH_FLAG_LOST_LMV == 0x10000000);
+       BUILD_BUG_ON(LMV_MAGIC_V1 != 0x0CD20CD0);
+       BUILD_BUG_ON(LMV_MAGIC_STRIPE != 0x0CD40CD0);
+       BUILD_BUG_ON(LMV_HASH_TYPE_MASK != 0x0000ffff);
+       BUILD_BUG_ON(LMV_HASH_FLAG_LOST_LMV != 0x10000000);
+       BUILD_BUG_ON(LMV_HASH_FLAG_BAD_TYPE != 0x20000000);
+       BUILD_BUG_ON(LMV_HASH_FLAG_MIGRATION != 0x80000000);
+       BUILD_BUG_ON(LMV_CRUSH_PG_COUNT != 4096);
 
        /* Checks for struct obd_statfs */
        LASSERTF((int)sizeof(struct obd_statfs) == 144, "found %lld\n",
@@ -1848,6 +1952,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obd_statfs, os_bavail));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_bavail) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_bavail));
+       LASSERTF((int)offsetof(struct obd_statfs, os_files) == 32, "found %lld\n",
+                (long long)(int)offsetof(struct obd_statfs, os_files));
+       LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_files) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct obd_statfs *)0)->os_files));
        LASSERTF((int)offsetof(struct obd_statfs, os_ffree) == 40, "found %lld\n",
                 (long long)(int)offsetof(struct obd_statfs, os_ffree));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_ffree) == 8, "found %lld\n",
@@ -1864,6 +1972,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obd_statfs, os_namelen));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_namelen) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_namelen));
+       LASSERTF((int)offsetof(struct obd_statfs, os_maxbytes) == 96, "found %lld\n",
+                (long long)(int)offsetof(struct obd_statfs, os_maxbytes));
+       LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_maxbytes) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct obd_statfs *)0)->os_maxbytes));
        LASSERTF((int)offsetof(struct obd_statfs, os_state) == 104, "found %lld\n",
                 (long long)(int)offsetof(struct obd_statfs, os_state));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_state) == 4, "found %lld\n",
@@ -1872,10 +1984,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obd_statfs, os_fprecreated));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_fprecreated) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_fprecreated));
-       LASSERTF((int)offsetof(struct obd_statfs, os_spare2) == 112, "found %lld\n",
-                (long long)(int)offsetof(struct obd_statfs, os_spare2));
-       LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare2) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare2));
+       LASSERTF((int)offsetof(struct obd_statfs, os_granted) == 112, "found %lld\n",
+                (long long)(int)offsetof(struct obd_statfs, os_granted));
+       LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_granted) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct obd_statfs *)0)->os_granted));
        LASSERTF((int)offsetof(struct obd_statfs, os_spare3) == 116, "found %lld\n",
                 (long long)(int)offsetof(struct obd_statfs, os_spare3));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare3) == 4, "found %lld\n",
@@ -1904,6 +2016,20 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct obd_statfs, os_spare9));
        LASSERTF((int)sizeof(((struct obd_statfs *)0)->os_spare9) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct obd_statfs *)0)->os_spare9));
+       LASSERTF(OS_STATE_DEGRADED == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_DEGRADED);
+       LASSERTF(OS_STATE_READONLY == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_READONLY);
+       LASSERTF(OS_STATE_NOPRECREATE == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_NOPRECREATE);
+       LASSERTF(OS_STATE_ENOSPC == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_ENOSPC);
+       LASSERTF(OS_STATE_ENOINO == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_ENOINO);
+       LASSERTF(OS_STATE_SUM == 0x00000100UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_SUM);
+       LASSERTF(OS_STATE_NONROT == 0x00000200UL, "found 0x%.8xUL\n",
+               (unsigned)OS_STATE_NONROT);
 
        /* Checks for struct obd_ioobj */
        LASSERTF((int)sizeof(struct obd_ioobj) == 24, "found %lld\n",
@@ -2133,7 +2259,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct idx_info, ii_pad3));
        LASSERTF((int)sizeof(((struct idx_info *)0)->ii_pad3) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct idx_info *)0)->ii_pad3));
-       CLASSERT(IDX_INFO_MAGIC == 0x3D37CC37);
+       BUILD_BUG_ON(IDX_INFO_MAGIC != 0x3D37CC37);
 
        /* Checks for struct lu_idxpage */
        LASSERTF((int)sizeof(struct lu_idxpage) == 16, "found %lld\n",
@@ -2154,17 +2280,13 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lu_idxpage, lip_pad0));
        LASSERTF((int)sizeof(((struct lu_idxpage *)0)->lip_pad0) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct lu_idxpage *)0)->lip_pad0));
-       CLASSERT(LIP_MAGIC == 0x8A6D6B6C);
-       LASSERTF(LIP_HDR_SIZE == 16, "found %lld\n",
-                (long long)LIP_HDR_SIZE);
-       LASSERTF(II_FL_NOHASH == 1, "found %lld\n",
-                (long long)II_FL_NOHASH);
-       LASSERTF(II_FL_VARKEY == 2, "found %lld\n",
-                (long long)II_FL_VARKEY);
-       LASSERTF(II_FL_VARREC == 4, "found %lld\n",
-                (long long)II_FL_VARREC);
-       LASSERTF(II_FL_NONUNQ == 8, "found %lld\n",
-                (long long)II_FL_NONUNQ);
+       BUILD_BUG_ON(LIP_MAGIC != 0x8A6D6B6C);
+       BUILD_BUG_ON(LIP_HDR_SIZE != (__builtin_offsetof (struct lu_idxpage, lip_entries)));
+       BUILD_BUG_ON(II_FL_NOHASH != 0x00000001);
+       BUILD_BUG_ON(II_FL_VARKEY != 0x00000002);
+       BUILD_BUG_ON(II_FL_VARREC != 0x00000004);
+       BUILD_BUG_ON(II_FL_NONUNQ != 0x00000008);
+       BUILD_BUG_ON(II_FL_NOKEY != 0x00000010);
 
        /* Checks for struct niobuf_remote */
        LASSERTF((int)sizeof(struct niobuf_remote) == 16, "found %lld\n",
@@ -2185,6 +2307,8 @@ void lustre_assert_wire_constants(void)
                OBD_BRW_READ);
        LASSERTF(OBD_BRW_WRITE == 0x02, "found 0x%.8x\n",
                OBD_BRW_WRITE);
+       LASSERTF(OBD_BRW_NDELAY == 0x04, "found 0x%.8x\n",
+               OBD_BRW_NDELAY);
        LASSERTF(OBD_BRW_SYNC == 0x08, "found 0x%.8x\n",
                OBD_BRW_SYNC);
        LASSERTF(OBD_BRW_CHECK == 0x10, "found 0x%.8x\n",
@@ -2209,6 +2333,10 @@ void lustre_assert_wire_constants(void)
                OBD_BRW_OVER_GRPQUOTA);
        LASSERTF(OBD_BRW_SOFT_SYNC == 0x4000, "found 0x%.8x\n",
                OBD_BRW_SOFT_SYNC);
+       LASSERTF(OBD_BRW_OVER_PRJQUOTA == 0x8000, "found 0x%.8x\n",
+               OBD_BRW_OVER_PRJQUOTA);
+       LASSERTF(OBD_BRW_RDMA_ONLY == 0x20000, "found 0x%.8x\n",
+               OBD_BRW_RDMA_ONLY);
 
        /* Checks for struct ost_body */
        LASSERTF((int)sizeof(struct ost_body) == 208, "found %lld\n",
@@ -2234,6 +2362,39 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct ll_fid *)0)->f_type) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct ll_fid *)0)->f_type));
 
+       LASSERTF(MDS_CROSS_REF == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CROSS_REF);
+       LASSERTF(MDS_PERM_BYPASS == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_PERM_BYPASS);
+       LASSERTF(MDS_QUOTA_IGNORE == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_QUOTA_IGNORE);
+       LASSERTF(MDS_KEEP_ORPHAN == 0x00000080UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_KEEP_ORPHAN);
+       LASSERTF(MDS_RECOV_OPEN == 0x00000100UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_RECOV_OPEN);
+       LASSERTF(MDS_DATA_MODIFIED == 0x00000200UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_DATA_MODIFIED);
+       LASSERTF(MDS_CREATE_VOLATILE == 0x00000400UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CREATE_VOLATILE);
+       LASSERTF(MDS_OWNEROVERRIDE == 0x00000800UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_OWNEROVERRIDE);
+       LASSERTF(MDS_HSM_RELEASE == 0x00001000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_HSM_RELEASE);
+       LASSERTF(MDS_CLOSE_LAYOUT_SWAP == 0x00004000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CLOSE_LAYOUT_SWAP);
+       LASSERTF(MDS_CLOSE_LAYOUT_MERGE == 0x00008000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CLOSE_LAYOUT_MERGE);
+       LASSERTF(MDS_CLOSE_RESYNC_DONE == 0x00010000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CLOSE_RESYNC_DONE);
+       LASSERTF(MDS_CLOSE_LAYOUT_SPLIT == 0x00020000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CLOSE_LAYOUT_SPLIT);
+       LASSERTF(MDS_TRUNC_KEEP_LEASE == 0x00040000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_TRUNC_KEEP_LEASE);
+       LASSERTF(MDS_PCC_ATTACH == 0x00080000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_PCC_ATTACH);
+       LASSERTF(MDS_CLOSE_UPDATE_TIMES == 0x00100000UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_CLOSE_UPDATE_TIMES);
+
        /* Checks for struct mdt_body */
        LASSERTF((int)sizeof(struct mdt_body) == 216, "found %lld\n",
                 (long long)(int)sizeof(struct mdt_body));
@@ -2245,10 +2406,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_body, mbo_fid2));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_body *)0)->mbo_fid2));
-       LASSERTF((int)offsetof(struct mdt_body, mbo_handle) == 32, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_body, mbo_handle));
-       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_handle));
+       LASSERTF((int)offsetof(struct mdt_body, mbo_open_handle) == 32, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_body, mbo_open_handle));
+       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_open_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_open_handle));
        LASSERTF((int)offsetof(struct mdt_body, mbo_valid) == 40, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_body, mbo_valid));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_valid) == 8, "found %lld\n",
@@ -2273,6 +2434,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_body, mbo_blocks));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_blocks) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_body *)0)->mbo_blocks));
+       LASSERTF((int)offsetof(struct mdt_body, mbo_version) == 88, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_body, mbo_version));
+       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_version) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_version));
        LASSERTF((int)offsetof(struct mdt_body, mbo_t_state) == 96, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_body, mbo_t_state));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_t_state) == 8, "found %lld\n",
@@ -2313,10 +2478,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_body, mbo_nlink));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_nlink) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_body *)0)->mbo_nlink));
-       LASSERTF((int)offsetof(struct mdt_body, mbo_unused2) == 140, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_body, mbo_unused2));
-       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_unused2) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_unused2));
+       LASSERTF((int)offsetof(struct mdt_body, mbo_layout_gen) == 140, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_body, mbo_layout_gen));
+       LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_layout_gen) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_body *)0)->mbo_layout_gen));
        LASSERTF((int)offsetof(struct mdt_body, mbo_suppgid) == 144, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_body, mbo_suppgid));
        LASSERTF((int)sizeof(((struct mdt_body *)0)->mbo_suppgid) == 4, "found %lld\n",
@@ -2375,8 +2540,6 @@ void lustre_assert_wire_constants(void)
                MDS_FMODE_EXEC);
        LASSERTF(MDS_OPEN_CREATED == 000000000010UL, "found 0%.11oUL\n",
                MDS_OPEN_CREATED);
-       LASSERTF(MDS_OPEN_CROSS == 000000000020UL, "found 0%.11oUL\n",
-               MDS_OPEN_CROSS);
        LASSERTF(MDS_OPEN_CREAT == 000000000100UL, "found 0%.11oUL\n",
                MDS_OPEN_CREAT);
        LASSERTF(MDS_OPEN_EXCL == 000000000200UL, "found 0%.11oUL\n",
@@ -2409,6 +2572,12 @@ void lustre_assert_wire_constants(void)
                        (long long)MDS_OPEN_NEWSTRIPE);
        LASSERTF(MDS_OPEN_VOLATILE == 00000000000400000000000ULL, "found 0%.22lloULL\n",
                        (long long)MDS_OPEN_VOLATILE);
+       LASSERTF(MDS_OPEN_LEASE == 00000000001000000000000ULL, "found 0%.22lloULL\n",
+                       (long long)MDS_OPEN_LEASE);
+       LASSERTF(MDS_OPEN_RESYNC == 00000000004000000000000ULL, "found 0%.22lloULL\n",
+                       (long long)MDS_OPEN_RESYNC);
+       LASSERTF(MDS_OPEN_PCC == 00000000010000000000000ULL, "found 0%.22lloULL\n",
+                       (long long)MDS_OPEN_PCC);
        LASSERTF(LUSTRE_SYNC_FL == 0x00000008UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_SYNC_FL);
        LASSERTF(LUSTRE_IMMUTABLE_FL == 0x00000010UL, "found 0x%.8xUL\n",
@@ -2427,26 +2596,32 @@ void lustre_assert_wire_constants(void)
                (unsigned)LUSTRE_DIRSYNC_FL);
        LASSERTF(LUSTRE_TOPDIR_FL == 0x00020000UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_TOPDIR_FL);
-       LASSERTF(LUSTRE_DIRECTIO_FL == 0x00100000UL, "found 0x%.8xUL\n",
-               (unsigned)LUSTRE_DIRECTIO_FL);
        LASSERTF(LUSTRE_INLINE_DATA_FL == 0x10000000UL, "found 0x%.8xUL\n",
                (unsigned)LUSTRE_INLINE_DATA_FL);
-       LASSERTF(MDS_INODELOCK_LOOKUP == 0x000001, "found 0x%.8x\n",
-               MDS_INODELOCK_LOOKUP);
-       LASSERTF(MDS_INODELOCK_UPDATE == 0x000002, "found 0x%.8x\n",
-               MDS_INODELOCK_UPDATE);
-       LASSERTF(MDS_INODELOCK_OPEN == 0x000004, "found 0x%.8x\n",
-               MDS_INODELOCK_OPEN);
-       LASSERTF(MDS_INODELOCK_LAYOUT == 0x000008, "found 0x%.8x\n",
-               MDS_INODELOCK_LAYOUT);
+       LASSERTF(LUSTRE_SET_SYNC_FL == 0x00040000UL, "found 0x%.8xUL\n",
+               (unsigned)LUSTRE_SET_SYNC_FL);
+       LASSERTF(MDS_INODELOCK_LOOKUP == 0x00000001UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_LOOKUP);
+       LASSERTF(MDS_INODELOCK_UPDATE == 0x00000002UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_UPDATE);
+       LASSERTF(MDS_INODELOCK_OPEN == 0x00000004UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_OPEN);
+       LASSERTF(MDS_INODELOCK_LAYOUT == 0x00000008UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_LAYOUT);
+       LASSERTF(MDS_INODELOCK_PERM == 0x00000010UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_PERM);
+       LASSERTF(MDS_INODELOCK_XATTR == 0x00000020UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_XATTR);
+       LASSERTF(MDS_INODELOCK_DOM == 0x00000040UL, "found 0x%.8xUL\n",
+               (unsigned)MDS_INODELOCK_DOM);
 
        /* Checks for struct mdt_ioepoch */
        LASSERTF((int)sizeof(struct mdt_ioepoch) == 24, "found %lld\n",
                 (long long)(int)sizeof(struct mdt_ioepoch));
-       LASSERTF((int)offsetof(struct mdt_ioepoch, mio_handle) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_ioepoch, mio_handle));
-       LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_ioepoch *)0)->mio_handle));
+       LASSERTF((int)offsetof(struct mdt_ioepoch, mio_open_handle) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_ioepoch, mio_open_handle));
+       LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_open_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_ioepoch *)0)->mio_open_handle));
        LASSERTF((int)offsetof(struct mdt_ioepoch, mio_unused1) == 8, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_ioepoch, mio_unused1));
        LASSERTF((int)sizeof(((struct mdt_ioepoch *)0)->mio_unused1) == 8, "found %lld\n",
@@ -2615,10 +2790,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_rec_create, cr_fid2));
        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_fid2) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_fid2));
-       LASSERTF((int)offsetof(struct mdt_rec_create, cr_old_handle) == 72, "found %lld\n",
-                (long long)(int)offsetof(struct mdt_rec_create, cr_old_handle));
-       LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_old_handle) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_old_handle));
+       LASSERTF((int)offsetof(struct mdt_rec_create, cr_open_handle_old) == 72, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_rec_create, cr_open_handle_old));
+       LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_open_handle_old) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_rec_create *)0)->cr_open_handle_old));
        LASSERTF((int)offsetof(struct mdt_rec_create, cr_time) == 80, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_rec_create, cr_time));
        LASSERTF((int)sizeof(((struct mdt_rec_create *)0)->cr_time) == 8, "found %lld\n",
@@ -3103,6 +3278,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_rec_resync, rs_padding0));
        LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_padding0) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_resync *)0)->rs_padding0));
+       LASSERTF((int)offsetof(struct mdt_rec_resync, rs_lease_handle) == 72, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_rec_resync, rs_lease_handle));
+       LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_lease_handle) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_rec_resync *)0)->rs_lease_handle));
        LASSERTF((int)offsetof(struct mdt_rec_resync, rs_padding1) == 80, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_rec_resync, rs_padding1));
        LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_padding1) == 8, "found %lld\n",
@@ -3139,9 +3318,13 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_rec_resync, rs_padding8));
        LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_padding8) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_resync *)0)->rs_padding8));
-       LASSERTF((int)offsetof(struct mdt_rec_resync, rs_padding9) == 132, "found %lld\n",
+       LASSERTF((int)offsetof(struct mdt_rec_resync, rs_mirror_id) == 132, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_rec_resync, rs_mirror_id));
+       LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_mirror_id) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_rec_resync *)0)->rs_mirror_id));
+       LASSERTF((int)offsetof(struct mdt_rec_resync, rs_padding9) == 134, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_rec_resync, rs_padding9));
-       LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_padding9) == 4, "found %lld\n",
+       LASSERTF((int)sizeof(((struct mdt_rec_resync *)0)->rs_padding9) == 2, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_resync *)0)->rs_padding9));
 
        /* Checks for struct mdt_rec_reint */
@@ -3235,9 +3418,13 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mdt_rec_reint, rr_umask));
        LASSERTF((int)sizeof(((struct mdt_rec_reint *)0)->rr_umask) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_reint *)0)->rr_umask));
-       LASSERTF((int)offsetof(struct mdt_rec_reint, rr_padding_4) == 132, "found %lld\n",
+       LASSERTF((int)offsetof(struct mdt_rec_reint, rr_mirror_id) == 132, "found %lld\n",
+                (long long)(int)offsetof(struct mdt_rec_reint, rr_mirror_id));
+       LASSERTF((int)sizeof(((struct mdt_rec_reint *)0)->rr_mirror_id) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct mdt_rec_reint *)0)->rr_mirror_id));
+       LASSERTF((int)offsetof(struct mdt_rec_reint, rr_padding_4) == 134, "found %lld\n",
                 (long long)(int)offsetof(struct mdt_rec_reint, rr_padding_4));
-       LASSERTF((int)sizeof(((struct mdt_rec_reint *)0)->rr_padding_4) == 4, "found %lld\n",
+       LASSERTF((int)sizeof(((struct mdt_rec_reint *)0)->rr_padding_4) == 2, "found %lld\n",
                 (long long)(int)sizeof(((struct mdt_rec_reint *)0)->rr_padding_4));
 
        /* Checks for struct lmv_desc */
@@ -3335,12 +3522,12 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct lov_desc, ld_uuid));
        LASSERTF((int)sizeof(((struct lov_desc *)0)->ld_uuid) == 40, "found %lld\n",
                 (long long)(int)sizeof(((struct lov_desc *)0)->ld_uuid));
-       CLASSERT(LOV_DESC_MAGIC == 0xB0CCDE5C);
+       BUILD_BUG_ON(LOV_DESC_MAGIC != 0xB0CCDE5C);
 
        /* Checks for struct ldlm_res_id */
        LASSERTF((int)sizeof(struct ldlm_res_id) == 32, "found %lld\n",
                 (long long)(int)sizeof(struct ldlm_res_id));
-       CLASSERT(RES_NAME_SIZE == 4);
+       BUILD_BUG_ON(RES_NAME_SIZE != 4);
        LASSERTF((int)offsetof(struct ldlm_res_id, name[4]) == 32, "found %lld\n",
                 (long long)(int)offsetof(struct ldlm_res_id, name[4]));
        LASSERTF((int)sizeof(((struct ldlm_res_id *)0)->name[4]) == 8, "found %lld\n",
@@ -3405,34 +3592,17 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct ldlm_intent, opc));
        LASSERTF((int)sizeof(((struct ldlm_intent *)0)->opc) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct ldlm_intent *)0)->opc));
-       LASSERTF(IT_OPEN == 1, "found %lld\n",
-                (long long)IT_OPEN);
-       LASSERTF(IT_CREAT == 2, "found %lld\n",
-                (long long)IT_CREAT);
-       LASSERTF(IT_READDIR == 4, "found %lld\n",
-                (long long)IT_READDIR);
-       LASSERTF(IT_GETATTR == 8, "found %lld\n",
-                (long long)IT_GETATTR);
-       LASSERTF(IT_LOOKUP == 16, "found %lld\n",
-                (long long)IT_LOOKUP);
-       LASSERTF(IT_UNLINK == 32, "found %lld\n",
-                (long long)IT_UNLINK);
-       LASSERTF(IT_TRUNC == 64, "found %lld\n",
-                (long long)IT_TRUNC);
-       LASSERTF(IT_GETXATTR == 128, "found %lld\n",
-                (long long)IT_GETXATTR);
-       LASSERTF(IT_EXEC == 256, "found %lld\n",
-                (long long)IT_EXEC);
-       LASSERTF(IT_PIN == 512, "found %lld\n",
-                (long long)IT_PIN);
-       LASSERTF(IT_LAYOUT == 1024, "found %lld\n",
-                (long long)IT_LAYOUT);
-       LASSERTF(IT_QUOTA_DQACQ == 2048, "found %lld\n",
-                (long long)IT_QUOTA_DQACQ);
-       LASSERTF(IT_QUOTA_CONN == 4096, "found %lld\n",
-                (long long)IT_QUOTA_CONN);
-       LASSERTF(IT_SETXATTR == 8192, "found %lld\n",
-                (long long)IT_SETXATTR);
+       BUILD_BUG_ON(IT_OPEN != 0x00000001);
+       BUILD_BUG_ON(IT_CREAT != 0x00000002);
+       BUILD_BUG_ON(IT_READDIR != 0x00000004);
+       BUILD_BUG_ON(IT_GETATTR != 0x00000008);
+       BUILD_BUG_ON(IT_LOOKUP != 0x00000010);
+       BUILD_BUG_ON(IT_GETXATTR != 0x00000080);
+       BUILD_BUG_ON(IT_LAYOUT != 0x00000400);
+       BUILD_BUG_ON(IT_QUOTA_DQACQ != 0x00000800);
+       BUILD_BUG_ON(IT_QUOTA_CONN != 0x00001000);
+       BUILD_BUG_ON(IT_GLIMPSE != 0x00004000);
+       BUILD_BUG_ON(IT_BRW != 0x00008000);
 
        /* Checks for struct ldlm_resource_desc */
        LASSERTF((int)sizeof(struct ldlm_resource_desc) == 40, "found %lld\n",
@@ -3672,15 +3842,6 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct barrier_lvb *)0)->lvb_padding) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct barrier_lvb *)0)->lvb_padding));
 
-       /* Checks for struct mgs_send_param */
-       LASSERTF((int)sizeof(struct mgs_send_param) == 1024, "found %lld\n",
-                (long long)(int)sizeof(struct mgs_send_param));
-       CLASSERT(MGS_PARAM_MAXLEN == 1024);
-       LASSERTF((int)offsetof(struct mgs_send_param, mgs_param[1024]) == 1024, "found %lld\n",
-                (long long)(int)offsetof(struct mgs_send_param, mgs_param[1024]));
-       LASSERTF((int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024]) == 1, "found %lld\n",
-                (long long)(int)sizeof(((struct mgs_send_param *)0)->mgs_param[1024]));
-
        /* Checks for struct cfg_marker */
        LASSERTF((int)sizeof(struct cfg_marker) == 160, "found %lld\n",
                 (long long)(int)sizeof(struct cfg_marker));
@@ -3728,16 +3889,18 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct llog_logid, lgl_ogen));
        LASSERTF((int)sizeof(((struct llog_logid *)0)->lgl_ogen) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct llog_logid *)0)->lgl_ogen));
-       CLASSERT(OST_SZ_REC == 274730752);
-       CLASSERT(MDS_UNLINK_REC == 274801668);
-       CLASSERT(MDS_UNLINK64_REC == 275325956);
-       CLASSERT(MDS_SETATTR64_REC == 275325953);
-       CLASSERT(OBD_CFG_REC == 274857984);
-       CLASSERT(LLOG_GEN_REC == 274989056);
-       CLASSERT(CHANGELOG_REC == 275120128);
-       CLASSERT(CHANGELOG_USER_REC == 275185664);
-       CLASSERT(LLOG_HDR_MAGIC == 275010873);
-       CLASSERT(LLOG_LOGID_MAGIC == 275010875);
+       BUILD_BUG_ON(OST_SZ_REC != 274730752);
+       BUILD_BUG_ON(MDS_UNLINK_REC != 274801668);
+       BUILD_BUG_ON(MDS_UNLINK64_REC != 275325956);
+       BUILD_BUG_ON(MDS_SETATTR64_REC != 275325953);
+       BUILD_BUG_ON(OBD_CFG_REC != 274857984);
+       BUILD_BUG_ON(LLOG_GEN_REC != 274989056);
+       BUILD_BUG_ON(CHANGELOG_REC != 275120128);
+       BUILD_BUG_ON(CHANGELOG_USER_REC != 275185664);
+       BUILD_BUG_ON(HSM_AGENT_REC != 275251200);
+       BUILD_BUG_ON(UPDATE_REC != 275382272);
+       BUILD_BUG_ON(LLOG_HDR_MAGIC != 275010873);
+       BUILD_BUG_ON(LLOG_LOGID_MAGIC != 275010875);
 
        /* Checks for struct llog_catid */
        LASSERTF((int)sizeof(struct llog_catid) == 32, "found %lld\n",
@@ -3909,10 +4072,54 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct llog_setattr64_rec, lsr_tail));
        LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_tail) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct llog_setattr64_rec *)0)->lsr_tail));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_hdr) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_hdr), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_hdr), (int)offsetof(struct llog_setattr64_rec_v2, lsr_hdr));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_hdr) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_hdr), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_hdr), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_hdr));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_oi) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_oi), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_oi), (int)offsetof(struct llog_setattr64_rec_v2, lsr_oi));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oi) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_oi), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_oi), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_oi));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_uid) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_uid), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_uid), (int)offsetof(struct llog_setattr64_rec_v2, lsr_uid));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_uid) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_uid), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_uid), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_uid));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_uid_h) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_uid_h), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_uid_h), (int)offsetof(struct llog_setattr64_rec_v2, lsr_uid_h));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_uid_h) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_uid_h), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_uid_h), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_uid_h));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_gid) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_gid), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_gid), (int)offsetof(struct llog_setattr64_rec_v2, lsr_gid));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_gid) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_gid), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_gid), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_gid));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_gid_h) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_gid_h), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_gid_h), (int)offsetof(struct llog_setattr64_rec_v2, lsr_gid_h));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_gid_h) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_gid_h), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_gid_h), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_gid_h));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec, lsr_valid) == (int)offsetof(struct llog_setattr64_rec_v2, lsr_valid), "%d != %d\n",
+                (int)offsetof(struct llog_setattr64_rec, lsr_valid), (int)offsetof(struct llog_setattr64_rec_v2, lsr_valid));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec *)0)->lsr_valid) == (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_valid), "%d != %d\n",
+                (int)sizeof(((struct llog_setattr64_rec *)0)->lsr_valid), (int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_valid));
        LASSERTF((int)offsetof(struct llog_setattr64_rec_v2, lsr_projid) == 56, "found %lld\n",
                 (long long)(int)offsetof(struct llog_setattr64_rec_v2, lsr_projid));
        LASSERTF((int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_projid) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_projid));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec_v2, lsr_layout_version) == 60, "found %lld\n",
+                (long long)(int)offsetof(struct llog_setattr64_rec_v2, lsr_layout_version));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_layout_version) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_layout_version));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec_v2, lsr_padding2) == 64, "found %lld\n",
+                (long long)(int)offsetof(struct llog_setattr64_rec_v2, lsr_padding2));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_padding2) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_padding2));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec_v2, lsr_padding3) == 72, "found %lld\n",
+                (long long)(int)offsetof(struct llog_setattr64_rec_v2, lsr_padding3));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_padding3) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_padding3));
+       LASSERTF((int)offsetof(struct llog_setattr64_rec_v2, lsr_tail) == 80, "found %lld\n",
+                (long long)(int)offsetof(struct llog_setattr64_rec_v2, lsr_tail));
+       LASSERTF((int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_tail) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct llog_setattr64_rec_v2 *)0)->lsr_tail));
 
        /* Checks for struct llog_size_change_rec */
        LASSERTF((int)sizeof(struct llog_size_change_rec) == 64, "found %lld\n",
@@ -3997,6 +4204,7 @@ void lustre_assert_wire_constants(void)
        /* Checks for struct changelog_ext_jobid */
        LASSERTF((int)sizeof(struct changelog_ext_jobid) == 32, "found %lld\n",
                 (long long)(int)sizeof(struct changelog_ext_jobid));
+       BUILD_BUG_ON(LUSTRE_JOBID_SIZE != 32);
        LASSERTF((int)offsetof(struct changelog_ext_jobid, cr_jobid) == 0, "found %lld\n",
                 (long long)(int)offsetof(struct changelog_ext_jobid, cr_jobid));
        LASSERTF((int)sizeof(((struct changelog_ext_jobid *)0)->cr_jobid) == 32, "found %lld\n",
@@ -4117,6 +4325,16 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct llog_log_hdr, llh_tgtuuid));
        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));
+       BUILD_BUG_ON(LLOG_F_ZAP_WHEN_EMPTY != 0x00000001);
+       BUILD_BUG_ON(LLOG_F_IS_CAT != 0x00000002);
+       BUILD_BUG_ON(LLOG_F_IS_PLAIN != 0x00000004);
+       BUILD_BUG_ON(LLOG_F_EXT_JOBID != 0x00000008);
+       BUILD_BUG_ON(LLOG_F_IS_FIXSIZE != 0x00000010);
+       BUILD_BUG_ON(LLOG_F_EXT_EXTRA_FLAGS != 0x00000020);
+       BUILD_BUG_ON(LLOG_F_EXT_X_UIDGID != 0x00000040);
+       BUILD_BUG_ON(LLOG_F_EXT_X_NID != 0x00000080);
+       BUILD_BUG_ON(LLOG_F_EXT_X_OMODE != 0x00000100);
+       BUILD_BUG_ON(LLOG_F_EXT_X_XATTR != 0x00000200);
 
        /* Checks for struct llogd_body */
        LASSERTF((int)sizeof(struct llogd_body) == 48, "found %lld\n",
@@ -4149,32 +4367,27 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct llogd_body, lgd_cur_offset));
        LASSERTF((int)sizeof(((struct llogd_body *)0)->lgd_cur_offset) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct llogd_body *)0)->lgd_cur_offset));
-       CLASSERT(LLOG_ORIGIN_HANDLE_CREATE == 501);
-       CLASSERT(LLOG_ORIGIN_HANDLE_NEXT_BLOCK == 502);
-       CLASSERT(LLOG_ORIGIN_HANDLE_READ_HEADER == 503);
-       CLASSERT(LLOG_ORIGIN_HANDLE_WRITE_REC == 504);
-       CLASSERT(LLOG_ORIGIN_HANDLE_CLOSE == 505);
-       CLASSERT(LLOG_ORIGIN_CONNECT == 506);
-       CLASSERT(LLOG_CATINFO == 507);
-       CLASSERT(LLOG_ORIGIN_HANDLE_PREV_BLOCK == 508);
-       CLASSERT(LLOG_ORIGIN_HANDLE_DESTROY == 509);
-       CLASSERT(LLOG_FIRST_OPC == 501);
-       CLASSERT(LLOG_LAST_OPC == 510);
-       CLASSERT(LLOG_CONFIG_ORIG_CTXT == 0);
-       CLASSERT(LLOG_CONFIG_REPL_CTXT == 1);
-       CLASSERT(LLOG_MDS_OST_ORIG_CTXT == 2);
-       CLASSERT(LLOG_MDS_OST_REPL_CTXT == 3);
-       CLASSERT(LLOG_SIZE_ORIG_CTXT == 4);
-       CLASSERT(LLOG_SIZE_REPL_CTXT == 5);
-       CLASSERT(LLOG_TEST_ORIG_CTXT == 8);
-       CLASSERT(LLOG_TEST_REPL_CTXT == 9);
-       CLASSERT(LLOG_CHANGELOG_ORIG_CTXT == 12);
-       CLASSERT(LLOG_CHANGELOG_REPL_CTXT == 13);
-       CLASSERT(LLOG_CHANGELOG_USER_ORIG_CTXT == 14);
-       CLASSERT(LLOG_AGENT_ORIG_CTXT == 15);
-       CLASSERT(LLOG_UPDATELOG_ORIG_CTXT == 16);
-       CLASSERT(LLOG_UPDATELOG_REPL_CTXT == 17);
-       CLASSERT(LLOG_MAX_CTXTS == 18);
+       BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_CREATE != 501);
+       BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_NEXT_BLOCK != 502);
+       BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_READ_HEADER != 503);
+       BUILD_BUG_ON(LLOG_ORIGIN_HANDLE_PREV_BLOCK != 508);
+       BUILD_BUG_ON(LLOG_FIRST_OPC != 501);
+       BUILD_BUG_ON(LLOG_LAST_OPC != 510);
+       BUILD_BUG_ON(LLOG_CONFIG_ORIG_CTXT != 0);
+       BUILD_BUG_ON(LLOG_CONFIG_REPL_CTXT != 1);
+       BUILD_BUG_ON(LLOG_MDS_OST_ORIG_CTXT != 2);
+       BUILD_BUG_ON(LLOG_MDS_OST_REPL_CTXT != 3);
+       BUILD_BUG_ON(LLOG_SIZE_ORIG_CTXT != 4);
+       BUILD_BUG_ON(LLOG_SIZE_REPL_CTXT != 5);
+       BUILD_BUG_ON(LLOG_TEST_ORIG_CTXT != 8);
+       BUILD_BUG_ON(LLOG_TEST_REPL_CTXT != 9);
+       BUILD_BUG_ON(LLOG_CHANGELOG_ORIG_CTXT != 12);
+       BUILD_BUG_ON(LLOG_CHANGELOG_REPL_CTXT != 13);
+       BUILD_BUG_ON(LLOG_CHANGELOG_USER_ORIG_CTXT != 14);
+       BUILD_BUG_ON(LLOG_AGENT_ORIG_CTXT != 15);
+       BUILD_BUG_ON(LLOG_UPDATELOG_ORIG_CTXT != 16);
+       BUILD_BUG_ON(LLOG_UPDATELOG_REPL_CTXT != 17);
+       BUILD_BUG_ON(LLOG_MAX_CTXTS != 18);
 
        /* Checks for struct llogd_conn_body */
        LASSERTF((int)sizeof(struct llogd_conn_body) == 40, "found %lld\n",
@@ -4367,12 +4580,12 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct mgs_config_body, mcb_units));
        LASSERTF((int)sizeof(((struct mgs_config_body *)0)->mcb_units) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct mgs_config_body *)0)->mcb_units));
-       CLASSERT(CONFIG_T_CONFIG == 0);
-       CLASSERT(CONFIG_T_SPTLRPC == 1);
-       CLASSERT(CONFIG_T_RECOVER == 2);
-       CLASSERT(CONFIG_T_PARAMS == 3);
-       CLASSERT(CONFIG_T_NODEMAP == 4);
-       CLASSERT(CONFIG_T_BARRIER == 5);
+       BUILD_BUG_ON(CONFIG_T_CONFIG != 0);
+       BUILD_BUG_ON(CONFIG_T_SPTLRPC != 1);
+       BUILD_BUG_ON(CONFIG_T_RECOVER != 2);
+       BUILD_BUG_ON(CONFIG_T_PARAMS != 3);
+       BUILD_BUG_ON(CONFIG_T_NODEMAP != 4);
+       BUILD_BUG_ON(CONFIG_T_BARRIER != 5);
 
        /* Checks for struct mgs_config_res */
        LASSERTF((int)sizeof(struct mgs_config_res) == 16, "found %lld\n",
@@ -4386,68 +4599,6 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(((struct mgs_config_res *)0)->mcr_size) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct mgs_config_res *)0)->mcr_size));
 
-       /* Checks for struct lustre_capa */
-       LASSERTF((int)sizeof(struct lustre_capa) == 120, "found %lld\n",
-                (long long)(int)sizeof(struct lustre_capa));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_fid) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_fid));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_fid) == 16, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_fid));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_opc) == 16, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_opc));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_opc) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_opc));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_uid) == 24, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_uid));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_uid) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_uid));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_gid) == 32, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_gid));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_gid) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_gid));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_flags) == 40, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_flags));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_flags) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_flags));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_keyid) == 44, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_keyid));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_keyid) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_keyid));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_timeout) == 48, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_timeout));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_timeout) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_timeout));
-       LASSERTF((int)offsetof(struct lustre_capa, lc_expiry) == 52, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_expiry));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_expiry) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_expiry));
-       CLASSERT(CAPA_HMAC_MAX_LEN == 64);
-       LASSERTF((int)offsetof(struct lustre_capa, lc_hmac[64]) == 120, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa, lc_hmac[64]));
-       LASSERTF((int)sizeof(((struct lustre_capa *)0)->lc_hmac[64]) == 1, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa *)0)->lc_hmac[64]));
-
-       /* Checks for struct lustre_capa_key */
-       LASSERTF((int)sizeof(struct lustre_capa_key) == 72, "found %lld\n",
-                (long long)(int)sizeof(struct lustre_capa_key));
-       LASSERTF((int)offsetof(struct lustre_capa_key, lk_seq) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa_key, lk_seq));
-       LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_seq) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa_key *)0)->lk_seq));
-       LASSERTF((int)offsetof(struct lustre_capa_key, lk_keyid) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa_key, lk_keyid));
-       LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_keyid) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa_key *)0)->lk_keyid));
-       LASSERTF((int)offsetof(struct lustre_capa_key, lk_padding) == 12, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa_key, lk_padding));
-       LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_padding) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa_key *)0)->lk_padding));
-       CLASSERT(CAPA_HMAC_KEY_MAX_LEN == 56);
-       LASSERTF((int)offsetof(struct lustre_capa_key, lk_key[56]) == 72, "found %lld\n",
-                (long long)(int)offsetof(struct lustre_capa_key, lk_key[56]));
-       LASSERTF((int)sizeof(((struct lustre_capa_key *)0)->lk_key[56]) == 1, "found %lld\n",
-                (long long)(int)sizeof(((struct lustre_capa_key *)0)->lk_key[56]));
-
        /* Checks for struct getinfo_fid2path */
        LASSERTF((int)sizeof(struct getinfo_fid2path) == 32, "found %lld\n",
                 (long long)(int)sizeof(struct getinfo_fid2path));
@@ -4503,9 +4654,9 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct fiemap, fm_extents));
        LASSERTF((int)sizeof(((struct fiemap *)0)->fm_extents) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct fiemap *)0)->fm_extents));
-       CLASSERT(FIEMAP_FLAG_SYNC == 0x00000001);
-       CLASSERT(FIEMAP_FLAG_XATTR == 0x00000002);
-       CLASSERT(FIEMAP_FLAG_DEVICE_ORDER == 0x40000000);
+       BUILD_BUG_ON(FIEMAP_FLAG_SYNC != 0x00000001);
+       BUILD_BUG_ON(FIEMAP_FLAG_XATTR != 0x00000002);
+       BUILD_BUG_ON(FIEMAP_FLAG_DEVICE_ORDER != 0x40000000);
 
        /* Checks for struct fiemap_extent */
        LASSERTF((int)sizeof(struct fiemap_extent) == 56, "found %lld\n",
@@ -4530,18 +4681,19 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct fiemap_extent, fe_reserved[0]));
        LASSERTF((int)sizeof(((struct fiemap_extent *)0)->fe_reserved[0]) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct fiemap_extent *)0)->fe_reserved[0]));
-       CLASSERT(FIEMAP_EXTENT_LAST == 0x00000001);
-       CLASSERT(FIEMAP_EXTENT_UNKNOWN == 0x00000002);
-       CLASSERT(FIEMAP_EXTENT_DELALLOC == 0x00000004);
-       CLASSERT(FIEMAP_EXTENT_ENCODED == 0x00000008);
-       CLASSERT(FIEMAP_EXTENT_DATA_ENCRYPTED == 0x00000080);
-       CLASSERT(FIEMAP_EXTENT_NOT_ALIGNED == 0x00000100);
-       CLASSERT(FIEMAP_EXTENT_DATA_INLINE == 0x00000200);
-       CLASSERT(FIEMAP_EXTENT_DATA_TAIL == 0x00000400);
-       CLASSERT(FIEMAP_EXTENT_UNWRITTEN == 0x00000800);
-       CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000);
-       CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000);
-       CLASSERT(FIEMAP_EXTENT_NET == 0x80000000);
+       BUILD_BUG_ON(FIEMAP_EXTENT_LAST != 0x00000001);
+       BUILD_BUG_ON(FIEMAP_EXTENT_UNKNOWN != 0x00000002);
+       BUILD_BUG_ON(FIEMAP_EXTENT_DELALLOC != 0x00000004);
+       BUILD_BUG_ON(FIEMAP_EXTENT_ENCODED != 0x00000008);
+       BUILD_BUG_ON(FIEMAP_EXTENT_DATA_ENCRYPTED != 0x00000080);
+       BUILD_BUG_ON(FIEMAP_EXTENT_NOT_ALIGNED != 0x00000100);
+       BUILD_BUG_ON(FIEMAP_EXTENT_DATA_INLINE != 0x00000200);
+       BUILD_BUG_ON(FIEMAP_EXTENT_DATA_TAIL != 0x00000400);
+       BUILD_BUG_ON(FIEMAP_EXTENT_UNWRITTEN != 0x00000800);
+       BUILD_BUG_ON(FIEMAP_EXTENT_MERGED != 0x00001000);
+       BUILD_BUG_ON(FIEMAP_EXTENT_SHARED != 0x00002000);
+       BUILD_BUG_ON(FIEMAP_EXTENT_NO_DIRECT != 0x40000000);
+       BUILD_BUG_ON(FIEMAP_EXTENT_NET != 0x80000000);
 
 #ifdef CONFIG_FS_POSIX_ACL
        /* Checks for type posix_acl_xattr_entry */
@@ -4569,10 +4721,12 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(posix_acl_xattr_header, a_version));
        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4, "found %lld\n",
                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+#ifndef HAVE_STRUCT_POSIX_ACL_XATTR
        LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4, "found %lld\n",
                 (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0, "found %lld\n",
                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
+#endif /* HAVE_STRUCT_POSIX_ACL_XATTR */
 #endif /* CONFIG_FS_POSIX_ACL */
 
        /* Checks for struct link_ea_header */
@@ -4598,7 +4752,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct link_ea_header, leh_padding));
        LASSERTF((int)sizeof(((struct link_ea_header *)0)->leh_padding) == 4, "found %lld\n",
                 (long long)(int)sizeof(((struct link_ea_header *)0)->leh_padding));
-       CLASSERT(LINK_EA_MAGIC == 0x11EAF1DFUL);
+       BUILD_BUG_ON(LINK_EA_MAGIC != 0x11EAF1DFUL);
 
        /* Checks for struct link_ea_entry */
        LASSERTF((int)sizeof(struct link_ea_entry) == 18, "found %lld\n",
@@ -4858,6 +5012,9 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct hsm_state_set, hss_clearmask));
        LASSERTF((int)sizeof(((struct hsm_state_set *)0)->hss_clearmask) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct hsm_state_set *)0)->hss_clearmask));
+       BUILD_BUG_ON(HSS_SETMASK != 1);
+       BUILD_BUG_ON(HSS_CLEARMASK != 2);
+       BUILD_BUG_ON(HSS_ARCHIVE_ID != 4);
 
        /* Checks for struct hsm_current_action */
        LASSERTF((int)sizeof(struct hsm_current_action) == 24, "found %lld\n",
@@ -4874,6 +5031,16 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct hsm_current_action, hca_location));
        LASSERTF((int)sizeof(((struct hsm_current_action *)0)->hca_location) == 16, "found %lld\n",
                 (long long)(int)sizeof(((struct hsm_current_action *)0)->hca_location));
+       BUILD_BUG_ON(HPS_NONE != 0);
+       BUILD_BUG_ON(HPS_WAITING != 1);
+       BUILD_BUG_ON(HPS_RUNNING != 2);
+       BUILD_BUG_ON(HPS_DONE != 3);
+       BUILD_BUG_ON(HUA_NONE != 1);
+       BUILD_BUG_ON(HUA_ARCHIVE != 10);
+       BUILD_BUG_ON(HUA_RESTORE != 11);
+       BUILD_BUG_ON(HUA_RELEASE != 12);
+       BUILD_BUG_ON(HUA_REMOVE != 13);
+       BUILD_BUG_ON(HUA_CANCEL != 14);
 
        /* Checks for struct hsm_request */
        LASSERTF((int)sizeof(struct hsm_request) == 24, "found %lld\n",
@@ -5010,6 +5177,10 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct object_update, ou_params));
        LASSERTF((int)sizeof(((struct object_update *)0)->ou_params) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct object_update *)0)->ou_params));
+       BUILD_BUG_ON(UPDATE_FL_OST != 0x00000001);
+       BUILD_BUG_ON(UPDATE_FL_SYNC != 0x00000002);
+       BUILD_BUG_ON(UPDATE_FL_COMMITTED != 0x00000004);
+       BUILD_BUG_ON(UPDATE_FL_NOLOG != 0x00000008);
 
        /* Checks for struct object_update_request */
        LASSERTF((int)sizeof(struct object_update_request) == 8, "found %lld\n",
@@ -5030,6 +5201,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct object_update_request, ourq_updates));
        LASSERTF((int)sizeof(((struct object_update_request *)0)->ourq_updates) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct object_update_request *)0)->ourq_updates));
+       BUILD_BUG_ON(UPDATE_REQUEST_MAGIC != 0xBDDE0002);
 
        /* Checks for struct object_update_result */
        LASSERTF((int)sizeof(struct object_update_result) == 8, "found %lld\n",
@@ -5070,6 +5242,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct object_update_reply, ourp_lens));
        LASSERTF((int)sizeof(((struct object_update_reply *)0)->ourp_lens) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct object_update_reply *)0)->ourp_lens));
+       BUILD_BUG_ON(UPDATE_REPLY_MAGIC != 0x00BD0002);
 
        /* Checks for struct out_update_header */
        LASSERTF((int)sizeof(struct out_update_header) == 16, "found %lld\n",
@@ -5094,6 +5267,8 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct out_update_header, ouh_inline_data));
        LASSERTF((int)sizeof(((struct out_update_header *)0)->ouh_inline_data) == 0, "found %lld\n",
                 (long long)(int)sizeof(((struct out_update_header *)0)->ouh_inline_data));
+       BUILD_BUG_ON(OUT_UPDATE_HEADER_MAGIC != 0xBDDF0001);
+       BUILD_BUG_ON(OUT_UPDATE_MAX_INLINE_SIZE != 4096);
 
        /* Checks for struct out_update_buffer */
        LASSERTF((int)sizeof(struct out_update_buffer) == 8, "found %lld\n",
@@ -5110,10 +5285,11 @@ void lustre_assert_wire_constants(void)
        /* Checks for struct nodemap_cluster_rec */
        LASSERTF((int)sizeof(struct nodemap_cluster_rec) == 32, "found %lld\n",
                 (long long)(int)sizeof(struct nodemap_cluster_rec));
-       LASSERTF((int)offsetof(struct nodemap_cluster_rec, ncr_name) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_name));
-       LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name) == 17, "found %lld\n",
-                (long long)(int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name));
+       BUILD_BUG_ON(LUSTRE_NODEMAP_NAME_LENGTH != 16);
+       LASSERTF((int)offsetof(struct nodemap_cluster_rec, ncr_name[16 + 1]) == 17, "found %lld\n",
+                (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_name[16 + 1]));
+       LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name[16 + 1]) == 1, "found %lld\n",
+                (long long)(int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_name[16 + 1]));
        LASSERTF((int)offsetof(struct nodemap_cluster_rec, ncr_flags) == 17, "found %lld\n",
                 (long long)(int)offsetof(struct nodemap_cluster_rec, ncr_flags));
        LASSERTF((int)sizeof(((struct nodemap_cluster_rec *)0)->ncr_flags) == 1, "found %lld\n",
@@ -5356,7 +5532,7 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)sizeof(((struct update_params *)0)->up_params));
 
        /* Checks for struct update_op */
-       LASSERTF((int)sizeof(struct update_op) == 24, "found %lld\n",
+       LASSERTF((int)sizeof(struct update_op) == 20, "found %lld\n",
                 (long long)(int)sizeof(struct update_op));
        LASSERTF((int)offsetof(struct update_op, uop_fid) == 0, "found %lld\n",
                 (long long)(int)offsetof(struct update_op, uop_fid));
@@ -5424,5 +5600,146 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)offsetof(struct llog_update_record, lur_update_rec));
        LASSERTF((int)sizeof(((struct llog_update_record *)0)->lur_update_rec) == 32, "found %lld\n",
                 (long long)(int)sizeof(((struct llog_update_record *)0)->lur_update_rec));
-}
 
+       /* Checks for struct lustre_cfg */
+       LASSERTF((int)sizeof(struct lustre_cfg) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct lustre_cfg));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_version) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_version));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_version) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_version));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_command) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_command));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_command) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_command));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_num) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_num));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_num) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_num));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_flags) == 12, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_flags));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_flags) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_flags));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_nid) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_nid));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_nid) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_nid));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_nal) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_nal));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_nal) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_nal));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_bufcount) == 28, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_bufcount));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_bufcount) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_bufcount));
+       LASSERTF((int)offsetof(struct lustre_cfg, lcfg_buflens[0]) == 32, "found %lld\n",
+                (long long)(int)offsetof(struct lustre_cfg, lcfg_buflens[0]));
+       LASSERTF((int)sizeof(((struct lustre_cfg *)0)->lcfg_buflens[0]) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lustre_cfg *)0)->lcfg_buflens[0]));
+       LASSERTF(LCFG_ATTACH == 0x000cf001UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_ATTACH);
+       LASSERTF(LCFG_DETACH == 0x000cf002UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_DETACH);
+       LASSERTF(LCFG_SETUP == 0x000cf003UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_SETUP);
+       LASSERTF(LCFG_CLEANUP == 0x000cf004UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_CLEANUP);
+       LASSERTF(LCFG_ADD_UUID == 0x000cf005UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_ADD_UUID);
+       LASSERTF(LCFG_DEL_UUID == 0x000cf006UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_DEL_UUID);
+       LASSERTF(LCFG_MOUNTOPT == 0x000cf007UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_MOUNTOPT);
+       LASSERTF(LCFG_DEL_MOUNTOPT == 0x000cf008UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_DEL_MOUNTOPT);
+       LASSERTF(LCFG_SET_TIMEOUT == 0x000cf009UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_SET_TIMEOUT);
+       LASSERTF(LCFG_SET_UPCALL == 0x000cf00aUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_SET_UPCALL);
+       LASSERTF(LCFG_ADD_CONN == 0x000cf00bUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_ADD_CONN);
+       LASSERTF(LCFG_DEL_CONN == 0x000cf00cUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_DEL_CONN);
+       LASSERTF(LCFG_LOV_ADD_OBD == 0x000cf00dUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_LOV_ADD_OBD);
+       LASSERTF(LCFG_LOV_DEL_OBD == 0x000cf00eUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_LOV_DEL_OBD);
+       LASSERTF(LCFG_PARAM == 0x000cf00fUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_PARAM);
+       LASSERTF(LCFG_MARKER == 0x000cf010UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_MARKER);
+       LASSERTF(LCFG_LOG_START == 0x000ce011UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_LOG_START);
+       LASSERTF(LCFG_LOG_END == 0x000ce012UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_LOG_END);
+       LASSERTF(LCFG_LOV_ADD_INA == 0x000ce013UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_LOV_ADD_INA);
+       LASSERTF(LCFG_ADD_MDC == 0x000cf014UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_ADD_MDC);
+       LASSERTF(LCFG_DEL_MDC == 0x000cf015UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_DEL_MDC);
+       LASSERTF(LCFG_SPTLRPC_CONF == 0x000ce016UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_SPTLRPC_CONF);
+       LASSERTF(LCFG_POOL_NEW == 0x000ce020UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_POOL_NEW);
+       LASSERTF(LCFG_POOL_ADD == 0x000ce021UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_POOL_ADD);
+       LASSERTF(LCFG_POOL_REM == 0x000ce022UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_POOL_REM);
+       LASSERTF(LCFG_POOL_DEL == 0x000ce023UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_POOL_DEL);
+       LASSERTF(LCFG_SET_LDLM_TIMEOUT == 0x000ce030UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_SET_LDLM_TIMEOUT);
+       LASSERTF(LCFG_PRE_CLEANUP == 0x000cf031UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_PRE_CLEANUP);
+       LASSERTF(LCFG_SET_PARAM == 0x000ce032UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_SET_PARAM);
+       LASSERTF(LCFG_NODEMAP_ADD == 0x000ce040UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ADD);
+       LASSERTF(LCFG_NODEMAP_DEL == 0x000ce041UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_DEL);
+       LASSERTF(LCFG_NODEMAP_ADD_RANGE == 0x000ce042UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ADD_RANGE);
+       LASSERTF(LCFG_NODEMAP_DEL_RANGE == 0x000ce043UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_DEL_RANGE);
+       LASSERTF(LCFG_NODEMAP_ADD_UIDMAP == 0x000ce044UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ADD_UIDMAP);
+       LASSERTF(LCFG_NODEMAP_DEL_UIDMAP == 0x000ce045UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_DEL_UIDMAP);
+       LASSERTF(LCFG_NODEMAP_ADD_GIDMAP == 0x000ce046UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ADD_GIDMAP);
+       LASSERTF(LCFG_NODEMAP_DEL_GIDMAP == 0x000ce047UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_DEL_GIDMAP);
+       LASSERTF(LCFG_NODEMAP_ACTIVATE == 0x000ce048UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ACTIVATE);
+       LASSERTF(LCFG_NODEMAP_ADMIN == 0x000ce049UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ADMIN);
+       LASSERTF(LCFG_NODEMAP_TRUSTED == 0x000ce050UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_TRUSTED);
+       LASSERTF(LCFG_NODEMAP_SQUASH_UID == 0x000ce051UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_SQUASH_UID);
+       LASSERTF(LCFG_NODEMAP_SQUASH_GID == 0x000ce052UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_SQUASH_GID);
+       LASSERTF(LCFG_NODEMAP_ADD_SHKEY == 0x000ce053UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_ADD_SHKEY);
+       LASSERTF(LCFG_NODEMAP_DEL_SHKEY == 0x000ce054UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_DEL_SHKEY);
+       LASSERTF(LCFG_NODEMAP_TEST_NID == 0x000ce055UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_TEST_NID);
+       LASSERTF(LCFG_NODEMAP_TEST_ID == 0x000ce056UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_TEST_ID);
+       LASSERTF(LCFG_NODEMAP_SET_FILESET == 0x000ce057UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_SET_FILESET);
+       LASSERTF(LCFG_NODEMAP_DENY_UNKNOWN == 0x000ce058UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_DENY_UNKNOWN);
+       LASSERTF(LCFG_NODEMAP_MAP_MODE == 0x000ce059UL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_MAP_MODE);
+       LASSERTF(LCFG_NODEMAP_AUDIT_MODE == 0x000ce05aUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_AUDIT_MODE);
+       LASSERTF(LCFG_NODEMAP_SET_SEPOL == 0x000ce05bUL, "found 0x%.8xUL\n",
+               (unsigned)LCFG_NODEMAP_SET_SEPOL);
+       LASSERTF(PORTALS_CFG_TYPE == 1, "found %lld\n",
+                (long long)PORTALS_CFG_TYPE);
+       LASSERTF(LUSTRE_CFG_TYPE == 123, "found %lld\n",
+                (long long)LUSTRE_CFG_TYPE);
+}