From e124976ce1c095669747f6e4f761bafa553f4910 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 15 Jan 2010 17:50:13 -0800 Subject: [PATCH] kernel - add UP version for spin_trylock_wr() * UP version is a degenerate case, used by kern_lock.o Reported-by: Antonio Huete Jimenez --- sys/sys/spinlock2.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/sys/spinlock2.h b/sys/sys/spinlock2.h index 0eb9249b95..0c974f708b 100644 --- a/sys/sys/spinlock2.h +++ b/sys/sys/spinlock2.h @@ -78,8 +78,7 @@ extern void spin_lock_rd_contested(struct spinlock *mtx); /* * Attempt to obtain an exclusive spinlock. Returns FALSE on failure, - * TRUE on success. Since the caller assumes that spinlocks must actually - * work when using this function, it is only made available to SMP builds. + * TRUE on success. */ static __inline boolean_t spin_trylock_wr(struct spinlock *mtx) @@ -93,6 +92,17 @@ spin_trylock_wr(struct spinlock *mtx) return (TRUE); } +#else + +static __inline boolean_t +spin_trylock_wr(struct spinlock *mtx) +{ + globaldata_t gd = mycpu; + + ++gd->gd_spinlocks_wr; + return (TRUE); +} + #endif /* -- 2.11.4.GIT