From owner-dev-commits-src-main@freebsd.org Sat May 29 22:04:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86CC9648EA2; Sat, 29 May 2021 22:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FswZK2jvrz4hfF; Sat, 29 May 2021 22:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 25BEA11FAF; Sat, 29 May 2021 22:04:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14TM4PJt026326; Sat, 29 May 2021 22:04:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14TM4PDS026325; Sat, 29 May 2021 22:04:25 GMT (envelope-from git) Date: Sat, 29 May 2021 22:04:25 GMT Message-Id: <202105292204.14TM4PDS026325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 331a7601c9c2 - main - tmpfs: save on common case relocking in tmpfs_reclaim MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 331a7601c9c21c1e55c57c5338e7affced9c7b7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 May 2021 22:04:25 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=331a7601c9c21c1e55c57c5338e7affced9c7b7c commit 331a7601c9c21c1e55c57c5338e7affced9c7b7c Author: Mateusz Guzik AuthorDate: 2021-05-29 01:36:50 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-29 22:04:10 +0000 tmpfs: save on common case relocking in tmpfs_reclaim --- sys/fs/tmpfs/tmpfs_vnops.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 43a2aa77dbbb..5d0d80639046 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1525,26 +1525,18 @@ tmpfs_reclaim(struct vop_reclaim_args *v) struct vnode *vp; struct tmpfs_mount *tmp; struct tmpfs_node *node; - bool unlock, tm_locked; + bool unlock; vp = v->a_vp; node = VP_TO_TMPFS_NODE(vp); tmp = VFS_TO_TMPFS(vp->v_mount); - tm_locked = false; if (vp->v_type == VREG) tmpfs_destroy_vobject(vp, node->tn_reg.tn_aobj); vp->v_object = NULL; -relock: + TMPFS_LOCK(tmp); TMPFS_NODE_LOCK(node); - if (!tm_locked && node->tn_links == 0 && - (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { - TMPFS_NODE_UNLOCK(node); - TMPFS_LOCK(tmp); - tm_locked = true; - goto relock; - } tmpfs_free_vp(vp); /* @@ -1552,19 +1544,16 @@ relock: * we must free its associated data structures (now that the vnode * is being reclaimed). */ + unlock = true; if (node->tn_links == 0 && (node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0) { - MPASS(tm_locked); node->tn_vpstate = TMPFS_VNODE_DOOMED; unlock = !tmpfs_free_node_locked(tmp, node, true); - } else { - unlock = true; } if (unlock) { TMPFS_NODE_UNLOCK(node); - if (tm_locked) - TMPFS_UNLOCK(tmp); + TMPFS_UNLOCK(tmp); } MPASS(vp->v_data == NULL);