--- //depot/vendor/freebsd/src/sys/kern/kern_lock.c 2008/02/15 21:05:17 +++ //depot/user/attilio/attilio_schedlock/kern/kern_lock.c 2008/02/15 23:08:30 @@ -647,23 +647,6 @@ } /* - * Determine the number of waiters on a lock. - */ -int -lockwaiters(lkp) - struct lock *lkp; -{ - int count; - - KASSERT((lkp->lk_flags & LK_DESTROYED) == 0, - ("%s: %p lockmgr is destroyed", __func__, lkp)); - mtx_lock(lkp->lk_interlock); - count = lkp->lk_waitcount; - mtx_unlock(lkp->lk_interlock); - return (count); -} - -/* * Print out information about state of a lock. Used by VOP_PRINT * routines to display status about contained locks. */ --- //depot/vendor/freebsd/src/sys/kern/vfs_bio.c 2008/02/13 20:45:52 +++ //depot/user/attilio/attilio_schedlock/kern/vfs_bio.c 2008/02/15 23:08:30 @@ -1913,7 +1913,7 @@ * Notify any waiters for the buffer lock about * identity change by freeing the buffer. */ - if (qindex == QUEUE_CLEAN && BUF_LOCKWAITERS(bp) > 0) { + if (qindex == QUEUE_CLEAN && BUF_WAITERS(bp)) { bp->b_flags |= B_INVAL; bfreekva(bp); brelse(bp); --- //depot/vendor/freebsd/src/sys/sys/buf.h 2008/02/15 21:05:17 +++ //depot/user/attilio/attilio_schedlock/sys/buf.h 2008/02/15 23:08:30 @@ -352,14 +352,10 @@ #endif /* - * Find out the number of waiters on a lock. + * Find out if the lock has waiters. */ -static __inline int BUF_LOCKWAITERS(struct buf *); -static __inline int -BUF_LOCKWAITERS(struct buf *bp) -{ - return (lockwaiters(&bp->b_lock)); -} +#define BUF_WAITERS(bp) \ + (lockmgr_waiters(&(bp)->b_lock)) #endif /* _KERNEL */ --- //depot/vendor/freebsd/src/sys/sys/lockmgr.h 2008/02/15 21:05:17 +++ //depot/user/attilio/attilio_schedlock/sys/lockmgr.h 2008/02/15 23:08:30 @@ -203,7 +203,6 @@ void _lockmgr_disown(struct lock *, const char *, int); void lockmgr_printinfo(struct lock *); int lockstatus(struct lock *, struct thread *); -int lockwaiters(struct lock *); #define lockmgr(lock, flags, mtx) \ _lockmgr_args((lock), (flags), (mtx), LK_WMESG_DEFAULT, \ @@ -215,6 +214,8 @@ LOCK_FILE, LOCK_LINE) #define lockmgr_recursed(lkp) \ ((lkp)->lk_exclusivecount > 1) +#define lockmgr_waiters(lkp) \ + ((lkp)->lk_flags & LK_WAIT_NONZERO) #ifdef INVARIANTS #define lockmgr_assert(lkp, what) \ _lockmgr_assert((lkp), (what), LOCK_FILE, LOCK_LINE)