summaryrefslogtreecommitdiffstats
path: root/sys/fs/unionfs/union_subr.c
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2003-06-14 23:27:29 +0000
committerdas <das@FreeBSD.org>2003-06-14 23:27:29 +0000
commitc07dc83d2b107dd072974998fcc61754849dfecc (patch)
treef4a04e29ebf023c3b89978dd65428dc4eeaf47ae /sys/fs/unionfs/union_subr.c
parent83f108b04dd3280195b5f0cf6bc2af10630e5f75 (diff)
downloadFreeBSD-src-c07dc83d2b107dd072974998fcc61754849dfecc.zip
FreeBSD-src-c07dc83d2b107dd072974998fcc61754849dfecc.tar.gz
Factor out the process of freeing ``directory caches'', which unionfs
directory vnodes use to refer to their constituent vnodes, into union_dircache_free(). Also s/union_dircache/union_dircache_get/ and tweak the structure of union_dircache_r(). MFC after: 3 days
Diffstat (limited to 'sys/fs/unionfs/union_subr.c')
-rw-r--r--sys/fs/unionfs/union_subr.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index 0777268..ae0323a 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -1173,12 +1173,8 @@ union_removed_upper(un)
* the union node from cache, so that it will not be referrenced.
*/
union_newupper(un, NULLVP);
- if (un->un_dircache != 0) {
- for (vpp = un->un_dircache; *vpp != NULLVP; vpp++)
- vrele(*vpp);
- free(un->un_dircache, M_TEMP);
- un->un_dircache = 0;
- }
+ if (un->un_dircache != NULL)
+ union_dircache_free(un);
if (un->un_flags & UN_CACHED) {
un->un_flags &= ~UN_CACHED;
@@ -1227,19 +1223,17 @@ union_dircache_r(vp, vppp, cntp)
} else {
(*cntp)++;
}
-
- return;
+ } else {
+ un = VTOUNION(vp);
+ if (un->un_uppervp != NULLVP)
+ union_dircache_r(un->un_uppervp, vppp, cntp);
+ if (un->un_lowervp != NULLVP)
+ union_dircache_r(un->un_lowervp, vppp, cntp);
}
-
- un = VTOUNION(vp);
- if (un->un_uppervp != NULLVP)
- union_dircache_r(un->un_uppervp, vppp, cntp);
- if (un->un_lowervp != NULLVP)
- union_dircache_r(un->un_lowervp, vppp, cntp);
}
struct vnode *
-union_dircache(vp, td)
+union_dircache_get(vp, td)
struct vnode *vp;
struct thread *td;
{
@@ -1305,6 +1299,17 @@ out:
return (nvp);
}
+void
+union_dircache_free(struct union_node *un)
+{
+ struct vnode **vpp;
+
+ for (vpp = un->un_dircache; *vpp != NULLVP; vpp++)
+ vrele(*vpp);
+ free(un->un_dircache, M_TEMP);
+ un->un_dircache = NULL;
+}
+
/*
* Module glue to remove #ifdef UNION from vfs_syscalls.c
*/
@@ -1316,7 +1321,7 @@ union_dircheck(struct thread *td, struct vnode **vp, struct file *fp)
if ((*vp)->v_op == union_vnodeop_p) {
struct vnode *lvp;
- lvp = union_dircache(*vp, td);
+ lvp = union_dircache_get(*vp, td);
if (lvp != NULLVP) {
struct vattr va;
OpenPOWER on IntegriCloud