aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/unionfs/union_vnops.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2014-12-18 10:01:12 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2014-12-18 10:01:12 +0000
commit6c21f6edb8adc1083e0f3204068b84147a7e0982 (patch)
treed6d1c37be8bcdc191674e99f86893f2fda397461 /sys/fs/unionfs/union_vnops.c
parent9c75c3d4ba7c4e45507dbf57712b4aba8251735c (diff)
downloadsrc-6c21f6edb8adc1083e0f3204068b84147a7e0982.tar.gz
src-6c21f6edb8adc1083e0f3204068b84147a7e0982.zip
The VOP_LOOKUP() implementations for CREATE op do not put the name
into namecache, to avoid cache trashing when doing large operations. E.g., tar archive extraction is not usually followed by access to many of the files created. Right now, each VOP_LOOKUP() implementation explicitely knowns about this quirk and tests for both MAKEENTRY flag presence and op != CREATE to make the call to cache_enter(). Centralize the handling of the quirk into VFS, by deciding to cache only by MAKEENTRY flag in VOP. VFS now sets NOCACHE flag for CREATE namei() calls. Note that the change in semantic is backward-compatible and could be merged to the stable branch, and is compatible with non-changed third-party filesystems which correctly handle MAKEENTRY. Suggested by: Chris Torek <torek@pi-coral.com> Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=275897
Diffstat (limited to 'sys/fs/unionfs/union_vnops.c')
-rw-r--r--sys/fs/unionfs/union_vnops.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 5076f161e24c..6b60dbd47fb5 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -160,8 +160,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
LK_RETRY);
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
- } else if (error == ENOENT && (cnflags & MAKEENTRY) &&
- nameiop != CREATE)
+ } else if (error == ENOENT && (cnflags & MAKEENTRY) != 0)
cache_enter(dvp, NULLVP, cnp);
UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error);
@@ -337,7 +336,7 @@ unionfs_lookup_out:
if (lvp != NULLVP)
vrele(lvp);
- if (error == ENOENT && (cnflags & MAKEENTRY) && nameiop != CREATE)
+ if (error == ENOENT && (cnflags & MAKEENTRY) != 0)
cache_enter(dvp, NULLVP, cnp);
UNIONFS_INTERNAL_DEBUG("unionfs_lookup: leave (%d)\n", error);