From owner-svn-src-all@freebsd.org Fri Jan 6 19:58:21 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DCF3CA2169; Fri, 6 Jan 2017 19:58:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1AB1E106E; Fri, 6 Jan 2017 19:58:21 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v06JwKKK058474; Fri, 6 Jan 2017 19:58:20 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v06JwKIe058473; Fri, 6 Jan 2017 19:58:20 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201701061958.v06JwKIe058473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 6 Jan 2017 19:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311531 - head/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Fri, 06 Jan 2017 19:58:21 -0000 Author: mjg Date: Fri Jan 6 19:58:20 2017 New Revision: 311531 URL: https://svnweb.freebsd.org/changeset/base/311531 Log: tmpfs: perform a lockless check in tmpfs_itimes Most of the time the status is 0 as the function is repeatedly called from tmpfs_getattr. Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Fri Jan 6 18:41:28 2017 (r311530) +++ head/sys/fs/tmpfs/tmpfs_subr.c Fri Jan 6 19:58:20 2017 (r311531) @@ -1747,19 +1747,22 @@ tmpfs_set_status(struct tmpfs_node *node } /* Sync timestamps */ -static void -tmpfs_itimes_locked(struct tmpfs_node *node, const struct timespec *acc, +void +tmpfs_itimes(struct vnode *vp, const struct timespec *acc, const struct timespec *mod) { + struct tmpfs_node *node; struct timespec now; - TMPFS_ASSERT_LOCKED(node); + ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); + node = VP_TO_TMPFS_NODE(vp); if ((node->tn_status & (TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED)) == 0) return; vfs_timestamp(&now); + TMPFS_NODE_LOCK(node); if (node->tn_status & TMPFS_NODE_ACCESSED) { if (acc == NULL) acc = &now; @@ -1774,19 +1777,6 @@ tmpfs_itimes_locked(struct tmpfs_node *n node->tn_ctime = now; node->tn_status &= ~(TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED | TMPFS_NODE_CHANGED); -} - -void -tmpfs_itimes(struct vnode *vp, const struct timespec *acc, - const struct timespec *mod) -{ - struct tmpfs_node *node; - - ASSERT_VOP_LOCKED(vp, "tmpfs_itimes"); - node = VP_TO_TMPFS_NODE(vp); - - TMPFS_NODE_LOCK(node); - tmpfs_itimes_locked(node, acc, mod); TMPFS_NODE_UNLOCK(node); /* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */