From owner-svn-src-all@FreeBSD.ORG Mon Jun 13 22:08:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1785106566C; Mon, 13 Jun 2011 22:08:24 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 918308FC13; Mon, 13 Jun 2011 22:08:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p5DM8OQ7000932; Mon, 13 Jun 2011 22:08:24 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5DM8OZ1000930; Mon, 13 Jun 2011 22:08:24 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201106132208.p5DM8OZ1000930@svn.freebsd.org> From: "Kenneth D. Merry" Date: Mon, 13 Jun 2011 22:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r223062 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2011 22:08:24 -0000 Author: ken Date: Mon Jun 13 22:08:24 2011 New Revision: 223062 URL: http://svn.freebsd.org/changeset/base/223062 Log: Instead of using an atomic operation to determine whether the devstat(9) device node has been created, pass MAKEDEV_CHECKNAME in so that the devfs code will do the check. Use a regular static variable as before, that's good enough to keep us from calling into devfs most of the time. Suggested by: kib MFC after: 1 week Sponsored by: Spectra Logic Corporation Modified: head/sys/kern/subr_devstat.c Modified: head/sys/kern/subr_devstat.c ============================================================================== --- head/sys/kern/subr_devstat.c Mon Jun 13 21:21:02 2011 (r223061) +++ head/sys/kern/subr_devstat.c Mon Jun 13 22:08:24 2011 (r223062) @@ -470,9 +470,11 @@ devstat_alloc(void) static int once; mtx_assert(&devstat_mutex, MA_NOTOWNED); - if (!once && atomic_cmpset_int(&once, 0, 1)) { - make_dev_credf(MAKEDEV_ETERNAL, &devstat_cdevsw, 0, NULL, - UID_ROOT, GID_WHEEL, 0400, DEVSTAT_DEVICE_NAME); + if (!once) { + make_dev_credf(MAKEDEV_ETERNAL | MAKEDEV_CHECKNAME, + &devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, + DEVSTAT_DEVICE_NAME); + once = 1; } spp2 = NULL; mtx_lock(&devstat_mutex);