svn commit: r364632 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Mon Aug 24 08:55:56 UTC 2020
Author: mjg
Date: Mon Aug 24 08:55:55 2020
New Revision: 364632
URL: https://svnweb.freebsd.org/changeset/base/364632
Log:
cache: perform reverse lookup using v_cache_dd if possible
Tested by: pho
Modified:
head/sys/kern/vfs_cache.c
Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c Mon Aug 24 08:55:04 2020 (r364631)
+++ head/sys/kern/vfs_cache.c Mon Aug 24 08:55:55 2020 (r364632)
@@ -2572,6 +2572,19 @@ vn_fullpath_global(struct thread *td, struct vnode *vn
return (error);
}
+static struct namecache *
+vn_dd_from_dst(struct vnode *vp)
+{
+ struct namecache *ncp;
+
+ cache_assert_vnode_locked(vp);
+ TAILQ_FOREACH(ncp, &vp->v_cache_dst, nc_dst) {
+ if ((ncp->nc_flag & NCF_ISDOTDOT) == 0)
+ return (ncp);
+ }
+ return (NULL);
+}
+
int
vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, size_t *buflen)
{
@@ -2582,9 +2595,13 @@ vn_vptocnp(struct vnode **vp, struct ucred *cred, char
vlp = VP2VNODELOCK(*vp);
mtx_lock(vlp);
- TAILQ_FOREACH(ncp, &((*vp)->v_cache_dst), nc_dst) {
- if ((ncp->nc_flag & NCF_ISDOTDOT) == 0)
- break;
+ ncp = (*vp)->v_cache_dd;
+ if (ncp != NULL && (ncp->nc_flag & NCF_ISDOTDOT) == 0) {
+ KASSERT(ncp == vn_dd_from_dst(*vp),
+ ("%s: mismatch for dd entry (%p != %p)", __func__,
+ ncp, vn_dd_from_dst(*vp)));
+ } else {
+ ncp = vn_dd_from_dst(*vp);
}
if (ncp != NULL) {
if (*buflen < ncp->nc_nlen) {
More information about the svn-src-all
mailing list