diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2007-05-29 05:28:55 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2007-05-29 05:28:55 +0000 |
commit | 19d1793a620285adccacc8348f6b3e9d88cc23be (patch) | |
tree | fead5765e712a758c1451f2a0eeedf7a57692eee /sys/xfs/xfs_node-bsd.c | |
parent | 96c361a947808e1870f50cf6f8681214195235e2 (diff) |
Step one of some vnode improvements - change getnewvnode to
actually allocate "desiredvnodes" - add a vdrop to un-hold a vnode held
with vhold, and change the name cache to make use of vhold/vdrop, while
keeping track of which vnodes are referred to by which cache entries to
correctly hold/drop vnodes when the cache uses them.
ok thib@, tedu@, art@
Diffstat (limited to 'sys/xfs/xfs_node-bsd.c')
-rw-r--r-- | sys/xfs/xfs_node-bsd.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/sys/xfs/xfs_node-bsd.c b/sys/xfs/xfs_node-bsd.c index 306abdc970d..9d635545f6d 100644 --- a/sys/xfs/xfs_node-bsd.c +++ b/sys/xfs/xfs_node-bsd.c @@ -420,6 +420,8 @@ static struct long_entry tbl; static void tbl_clear (void) { + vdrop(tbl.vp); + vdrop(tbl.dvp); tbl.dvp = tbl.vp = NULL; tbl.name[0] = '\0'; tbl.len = 0; @@ -433,6 +435,8 @@ tbl_clear (void) static void tbl_enter (size_t len, const char *name, struct vnode *dvp, struct vnode *vp) { + vhold(vp); + vhold(dvp); tbl.len = len; bcopy(name, tbl.name, len); tbl.dvp = dvp; @@ -453,10 +457,15 @@ tbl_lookup (struct componentname *cnp, { if (tbl.dvp == dvp && tbl.len == cnp->cn_namelen - && strncmp(tbl.name, cnp->cn_nameptr, tbl.len) == 0 - && tbl.dvpid == tbl.dvp->v_id - && tbl.vpid == tbl.vp->v_id) { - + && strncmp(tbl.name, cnp->cn_nameptr, tbl.len) == 0) { +#ifdef DIAGNOSTIC + if (tbl.vpid != tbl.vp->v_id) + panic("tbl.vpid %x != tbl.vp->v_id %x", tbl.vpid, + tbl.vp->v_id); + if (tbl.dvpid != tbl.dvp->v_id) + panic("tbl.dvpid %x != tbl.dvp->v_id %x", tbl.dvpid, + tbl.dvp->v_id); +#endif *res = tbl.vp; return -1; } else @@ -667,10 +676,10 @@ xfs_dnlc_lock(struct vnode *dvp, xfs_vfs_writelock(dvp, xfs_cnp_to_proc(cnp)); #endif - if (error == 0 && dvp->v_id != vpid) { - vput(*res); - return 0; - } +#ifdef DIAGNOSTIC + if (dvp->v_id != vpid) + panic("dvp->v_id %x != vpid %x", dvp->v_id, vpid); +#endif } else { #ifdef HAVE_FREEBSD_THREAD error = xfs_do_vget(*res, LK_EXCLUSIVE, xfs_cnp_to_thread(cnp)); |