PERFORCE change 100088 for review

Kip Macy kmacy at FreeBSD.org
Mon Jun 26 20:51:09 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=100088

Change 100088 by kmacy at 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;


More information about the p4-projects mailing list