Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 2006 20:51:08 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 100088 for review
Message-ID:  <200606262051.k5QKp8b3022216@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100088

Change 100088 by kmacy@kmacy_storage:sun4v_work_sleepq on 2006/06/26 20:50:54

	allow turnstiles to handle sleeping for us

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sys/filedesc.h#5 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sys/filedesc.h#5 (text+ko) ====

@@ -96,60 +96,11 @@
 #ifdef _KERNEL
 
 /* Lock a file descriptor table. */
-#define	FILEDESC_LOCK(fd)								\
-	do {										\
-		mtx_lock(&(fd)->fd_mtx);						\
-		(fd)->fd_wanted++;							\
-		while ((fd)->fd_locked)							\
-			msleep(&(fd)->fd_locked, &(fd)->fd_mtx, PLOCK, "fdesc", 0);	\
-		(fd)->fd_locked = 2;							\
-		(fd)->fd_wanted--;							\
-		mtx_unlock(&(fd)->fd_mtx);						\
-	} while (0)
-
-#define	FILEDESC_UNLOCK(fd)								\
-	do {										\
-		mtx_lock(&(fd)->fd_mtx);						\
-		KASSERT((fd)->fd_locked == 2,						\
-		    ("fdesc locking mistake %d should be %d", (fd)->fd_locked, 2));	\
-		(fd)->fd_locked = 0;							\
-		if ((fd)->fd_wanted)							\
-			wakeup_one(&(fd)->fd_locked);					\
-		mtx_unlock(&(fd)->fd_mtx);						\
-	} while (0)
-
-#define	FILEDESC_LOCK_FAST(fd)								\
-	do {										\
-		mtx_lock(&(fd)->fd_mtx);						\
-		(fd)->fd_wanted++;							\
-		while ((fd)->fd_locked)							\
-			msleep(&(fd)->fd_locked, &(fd)->fd_mtx, PLOCK, "fdesc", 0);	\
-		(fd)->fd_locked = 1;							\
-		(fd)->fd_wanted--;							\
-	} while (0)
-
-#define	FILEDESC_UNLOCK_FAST(fd)							\
-	do {										\
-		KASSERT((fd)->fd_locked == 1,						\
-		    ("fdesc locking mistake %d should be %d", (fd)->fd_locked, 1));	\
-		(fd)->fd_locked = 0;							\
-		if ((fd)->fd_wanted)							\
-			wakeup_one(&(fd)->fd_locked);					\
-		mtx_unlock(&(fd)->fd_mtx);						\
-	} while (0)
-
-#ifdef INVARIANT_SUPPORT
-#define	FILEDESC_LOCK_ASSERT(fd, arg)							\
-	do {										\
-		if ((arg) == MA_OWNED)							\
-			KASSERT((fd)->fd_locked != 0, ("fdesc locking mistake"));	\
-		else									\
-			KASSERT((fd)->fd_locked == 0, ("fdesc locking mistake"));	\
-	} while (0)
-#else
-#define	FILEDESC_LOCK_ASSERT(fd, arg)
-#endif
-
+#define	FILEDESC_LOCK(fd)          mtx_lock(&(fd)->fd_mtx);
+#define	FILEDESC_LOCK_FAST(fd)     mtx_lock(&(fd)->fd_mtx);
+#define	FILEDESC_UNLOCK(fd)        mtx_unlock(&(fd)->fd_mtx);
+#define	FILEDESC_UNLOCK_FAST(fd)   mtx_unlock(&(fd)->fd_mtx);
+#define	FILEDESC_LOCK_ASSERT(fd, arg)  mtx_assert(&(fd)->fd_mtx, arg)
 #define	FILEDESC_LOCK_DESC	"filedesc structure"
 
 struct thread;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606262051.k5QKp8b3022216>