Whamcloud - gitweb
LU-9184 ldlm: selective IBITS lock trying
[fs/lustre-release.git] / lustre / utils / wiretest.c
index 46d28ed..e13c636 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -44,8 +44,8 @@
 /*
  * 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.
+ * ("(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.
  */
 #define CLASSERT(cond) do {switch (1) {case (cond): case 0: break; } } while (0)
 
@@ -62,13 +62,12 @@ int main()
 
         return ret;
 }
+
 void lustre_assert_wire_constants(void)
 {
-        /* Wire protocol assertions generated by 'wirecheck'
-         * (make -C lustre/utils newwiretest)
-         * running on Linux centss05 2.6.32.431.29.2.el6_lustre #1 SMP Tue Sep 23 16:06:38 CDT 2014 x
-         * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)  */
-
+       /* Wire protocol assertions generated by 'wirecheck'
+        * (make -C lustre/utils newwiretest)
+        */
 
        /* Constants... */
        LASSERTF(PTL_RPC_MSG_REQUEST == 4711, "found %lld\n",
@@ -675,6 +674,78 @@ void lustre_assert_wire_constants(void)
        LASSERTF((int)sizeof(union lu_page) == 4096, "found %lld\n",
                 (long long)(int)sizeof(union lu_page));
 
+       /* Checks for struct lu_ladvise */
+       LASSERTF((int)sizeof(struct lu_ladvise) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct lu_ladvise));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_advice) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_advice));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_advice) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_advice));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_value1) == 2, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_value1));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value1) == 2, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value1));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_value2) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_value2));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value2) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value2));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_start) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_start));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_start) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_start));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_end) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_end));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_end) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_end));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_value3) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_value3));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value3) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value3));
+       LASSERTF((int)offsetof(struct lu_ladvise, lla_value4) == 28, "found %lld\n",
+                (long long)(int)offsetof(struct lu_ladvise, lla_value4));
+       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value4) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value4));
+       LASSERTF(LU_LADVISE_WILLREAD == 1, "found %lld\n",
+                (long long)LU_LADVISE_WILLREAD);
+       LASSERTF(LU_LADVISE_DONTNEED == 2, "found %lld\n",
+                (long long)LU_LADVISE_DONTNEED);
+
+       /* Checks for struct ladvise_hdr */
+       LASSERTF((int)sizeof(struct ladvise_hdr) == 32, "found %lld\n",
+                (long long)(int)sizeof(struct ladvise_hdr));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_magic) == 0, "found %lld\n",
+                (long long)(int)offsetof(struct ladvise_hdr, lah_magic));
+       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_magic) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_magic));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_count) == 4, "found %lld\n",
+                (long long)(int)offsetof(struct ladvise_hdr, lah_count));
+       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_count) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_count));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_flags) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct ladvise_hdr, lah_flags));
+       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_flags) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_flags));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_value1) == 16, "found %lld\n",
+                (long long)(int)offsetof(struct ladvise_hdr, lah_value1));
+       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_value1) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_value1));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_value2) == 20, "found %lld\n",
+                (long long)(int)offsetof(struct ladvise_hdr, lah_value2));
+       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_value2) == 4, "found %lld\n",
+                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_value2));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_value3) == 24, "found %lld\n",
+                (long long)(int)offsetof(struct ladvise_hdr, lah_value3));
+       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_value3) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_value3));
+       LASSERTF((int)offsetof(struct ladvise_hdr, lah_advise) == 32, "found %lld\n",
+                (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);
+
        /* Checks for struct lustre_handle */
        LASSERTF((int)sizeof(struct lustre_handle) == 8, "found %lld\n",
                 (long long)(int)sizeof(struct lustre_handle));
@@ -3182,12 +3253,16 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)sizeof(((struct ldlm_extent *)0)->gid));
 
        /* Checks for struct ldlm_inodebits */
-       LASSERTF((int)sizeof(struct ldlm_inodebits) == 8, "found %lld\n",
+       LASSERTF((int)sizeof(struct ldlm_inodebits) == 16, "found %lld\n",
                 (long long)(int)sizeof(struct ldlm_inodebits));
        LASSERTF((int)offsetof(struct ldlm_inodebits, bits) == 0, "found %lld\n",
                 (long long)(int)offsetof(struct ldlm_inodebits, bits));
        LASSERTF((int)sizeof(((struct ldlm_inodebits *)0)->bits) == 8, "found %lld\n",
                 (long long)(int)sizeof(((struct ldlm_inodebits *)0)->bits));
+       LASSERTF((int)offsetof(struct ldlm_inodebits, try_bits) == 8, "found %lld\n",
+                (long long)(int)offsetof(struct ldlm_inodebits, try_bits));
+       LASSERTF((int)sizeof(((struct ldlm_inodebits *)0)->try_bits) == 8, "found %lld\n",
+                (long long)(int)sizeof(((struct ldlm_inodebits *)0)->try_bits));
 
        /* Checks for struct ldlm_flock_wire */
        LASSERTF((int)sizeof(struct ldlm_flock_wire) == 32, "found %lld\n",
@@ -5241,76 +5316,5 @@ 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 lu_ladvise */
-       LASSERTF((int)sizeof(struct lu_ladvise) == 32, "found %lld\n",
-                (long long)(int)sizeof(struct lu_ladvise));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_advice) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_advice));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_advice) == 2, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_advice));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_value1) == 2, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_value1));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value1) == 2, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value1));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_value2) == 4, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_value2));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value2) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value2));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_start) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_start));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_start) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_start));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_end) == 16, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_end));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_end) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_end));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_value3) == 24, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_value3));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value3) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value3));
-       LASSERTF((int)offsetof(struct lu_ladvise, lla_value4) == 28, "found %lld\n",
-                (long long)(int)offsetof(struct lu_ladvise, lla_value4));
-       LASSERTF((int)sizeof(((struct lu_ladvise *)0)->lla_value4) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct lu_ladvise *)0)->lla_value4));
-       LASSERTF(LU_LADVISE_WILLREAD == 1, "found %lld\n",
-                (long long)LU_LADVISE_WILLREAD);
-       LASSERTF(LU_LADVISE_DONTNEED == 2, "found %lld\n",
-                (long long)LU_LADVISE_DONTNEED);
-
-       /* Checks for struct ladvise_hdr */
-       LASSERTF(LADVISE_MAGIC == 0x1ADF1CE0, "found 0x%.8x\n",
-                LADVISE_MAGIC);
-       LASSERTF((int)sizeof(struct ladvise_hdr) == 32, "found %lld\n",
-                (long long)(int)sizeof(struct ladvise_hdr));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_magic) == 0, "found %lld\n",
-                (long long)(int)offsetof(struct ladvise_hdr, lah_magic));
-       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_magic) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_magic));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_count) == 4, "found %lld\n",
-                (long long)(int)offsetof(struct ladvise_hdr, lah_count));
-       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_count) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_count));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_flags) == 8, "found %lld\n",
-                (long long)(int)offsetof(struct ladvise_hdr, lah_flags));
-       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_flags) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_flags));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_value1) == 16, "found %lld\n",
-                (long long)(int)offsetof(struct ladvise_hdr, lah_value1));
-       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_value1) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_value1));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_value2) == 20, "found %lld\n",
-                (long long)(int)offsetof(struct ladvise_hdr, lah_value2));
-       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_value2) == 4, "found %lld\n",
-                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_value2));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_value3) == 24, "found %lld\n",
-                (long long)(int)offsetof(struct ladvise_hdr, lah_value3));
-       LASSERTF((int)sizeof(((struct ladvise_hdr *)0)->lah_value3) == 8, "found %lld\n",
-                (long long)(int)sizeof(((struct ladvise_hdr *)0)->lah_value3));
-       LASSERTF((int)offsetof(struct ladvise_hdr, lah_advise) == 32, "found %lld\n",
-                (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 == 0x00000001UL, "found 0x%.8xUL\n",
-               (unsigned)LF_ASYNC);
 }
+