From owner-dev-commits-src-all@freebsd.org Mon Jun 7 00:40:21 2021 Return-Path: Delivered-To: dev-commits-src-all@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 1831664336C; Mon, 7 Jun 2021 00:40:21 +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 4FyvfX1trrz4rMR; Mon, 7 Jun 2021 00:40:20 +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 1784B5518; Mon, 7 Jun 2021 00:40:20 +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 1570eJEB066374; Mon, 7 Jun 2021 00:40:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1570eJ7D066368; Mon, 7 Jun 2021 00:40:19 GMT (envelope-from git) Date: Mon, 7 Jun 2021 00:40:19 GMT Message-Id: <202106070040.1570eJ7D066368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 56687b27b87c - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 56687b27b87c6fcd3516e56595b0d153225cddd2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jun 2021 00:40:21 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=56687b27b87c6fcd3516e56595b0d153225cddd2 commit 56687b27b87c6fcd3516e56595b0d153225cddd2 Author: Mateusz Guzik AuthorDate: 2021-05-29 01:36:50 +0000 Commit: Mateusz Guzik CommitDate: 2021-06-07 00:34:59 +0000 tmpfs: save on common case relocking in tmpfs_reclaim (cherry picked from commit 331a7601c9c21c1e55c57c5338e7affced9c7b7c) --- 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);