Fix INVARIANT build issue
authorAdam Sakareassen <lists_dfly@petrified.com.au>
Thu, 8 Nov 2012 15:46:00 +0000 (02:46 +1100)
committerSascha Wildner <saw@online.de>
Sat, 10 Nov 2012 08:53:11 +0000 (09:53 +0100)
sys/kern/kern_spinlock.c

index b0b0c21..5c523d1 100644 (file)
@@ -206,15 +206,16 @@ spin_lock_contested(struct spinlock *spin)
        for (j = spinlocks_add_latency; j > 0; --j)
                cpu_ccfence();
 #endif
+#if defined(INVARIANTS)
        if (spin_lock_test_mode > 10 &&
            spin->countb > spin_lock_test_mode &&
            (spin_lock_test_mode & 0xFF) == mycpu->gd_cpuid) {
                spin->countb = 0;
                print_backtrace(-1);
        }
-
-       i = 0;
        ++spin->countb;
+#endif
+       i = 0;
 
        /*logspin(beg, spin, 'w');*/
        for (;;) {
@@ -240,7 +241,9 @@ spin_lock_contested(struct spinlock *spin)
                        break;
                }
                if ((++i & 0x7F) == 0x7F) {
+#if defined(INVARIANTS)
                        ++spin->countb;
+#endif
                        if (spin_indefinite_check(spin, &info))
                                break;
                }
@@ -263,15 +266,16 @@ spin_lock_shared_contested(struct spinlock *spin)
        for (j = spinlocks_add_latency; j > 0; --j)
                cpu_ccfence();
 #endif
+#if defined(INVARIANTS)
        if (spin_lock_test_mode > 10 &&
            spin->countb > spin_lock_test_mode &&
            (spin_lock_test_mode & 0xFF) == mycpu->gd_cpuid) {
                spin->countb = 0;
                print_backtrace(-1);
        }
-
-       i = 0;
        ++spin->countb;
+#endif
+       i = 0;
 
        /*logspin(beg, spin, 'w');*/
        for (;;) {
@@ -299,7 +303,9 @@ spin_lock_shared_contested(struct spinlock *spin)
                                break;
                }
                if ((++i & 0x7F) == 0x7F) {
+#if defined(INVARIANTS)
                        ++spin->countb;
+#endif
                        if (spin_indefinite_check(spin, &info))
                                break;
                }