From owner-p4-projects@FreeBSD.ORG Mon Jun 26 20:51:09 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 84D0916A407; Mon, 26 Jun 2006 20:51:09 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4815716A404 for ; Mon, 26 Jun 2006 20:51:09 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EE5D2449E6 for ; Mon, 26 Jun 2006 20:51:08 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5QKp8QG022220 for ; Mon, 26 Jun 2006 20:51:08 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5QKp8b3022216 for perforce@freebsd.org; Mon, 26 Jun 2006 20:51:08 GMT (envelope-from kmacy@freebsd.org) Date: Mon, 26 Jun 2006 20:51:08 GMT Message-Id: <200606262051.k5QKp8b3022216@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 100088 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jun 2006 20:51:09 -0000 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;