From owner-dev-commits-src-main@freebsd.org Sun Jan 3 06:53:12 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 A25674C7A35; Sun, 3 Jan 2021 06:53:12 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D7qGJ4FdCz4WVX; Sun, 3 Jan 2021 06:53:12 +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 851592380D; Sun, 3 Jan 2021 06:53:12 +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 1036rC2s023153; Sun, 3 Jan 2021 06:53:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1036rCnF023152; Sun, 3 Jan 2021 06:53:12 GMT (envelope-from git) Date: Sun, 3 Jan 2021 06:53:12 GMT Message-Id: <202101030653.1036rCnF023152@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: 7220a10b5b34 - main - cache: predict on no spurious slashes in cache_fpl_handle_root 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: 7220a10b5b343f0528612c62072f80458076a061 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: Sun, 03 Jan 2021 06:53:12 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7220a10b5b343f0528612c62072f80458076a061 commit 7220a10b5b343f0528612c62072f80458076a061 Author: Mateusz Guzik AuthorDate: 2021-01-01 02:25:19 +0000 Commit: Mateusz Guzik CommitDate: 2021-01-03 06:50:06 +0000 cache: predict on no spurious slashes in cache_fpl_handle_root This is a step towards speculatively not handling them. --- sys/kern/vfs_cache.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index b4882079790d..396969bb10ec 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -3623,9 +3623,15 @@ cache_fpl_handle_root(struct cache_fpl *fpl) ndp = fpl->ndp; cnp = fpl->cnp; - while (*(cnp->cn_nameptr) == '/') { - cnp->cn_nameptr++; - ndp->ni_pathlen--; + MPASS(*(cnp->cn_nameptr) == '/'); + cnp->cn_nameptr++; + ndp->ni_pathlen--; + + if (__predict_false(*(cnp->cn_nameptr) == '/')) { + do { + cnp->cn_nameptr++; + ndp->ni_pathlen--; + } while (*(cnp->cn_nameptr) == '/'); } return (ndp->ni_rootdir);