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>
Tue, 18 Dec 2012 17:48:52 +0000 (18:48 +0100)
sys/kern/kern_spinlock.c

index 0cea05d..b6c40f5 100644 (file)
@@ -208,15 +208,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 (;;) {
@@ -242,7 +243,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;
                }
@@ -265,15 +268,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 (;;) {
@@ -301,7 +305,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;
                }