diff options
author | phk <phk@FreeBSD.org> | 1997-08-26 07:32:51 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-08-26 07:32:51 +0000 |
commit | fddfc9d5bb4c35d88417fa80a062219876186593 (patch) | |
tree | 7f29931e5661e3731f6b972dc3a9508534617833 /sys/isofs/cd9660 | |
parent | f320b3a30651cae7b34067561adb48f2b6f57621 (diff) | |
download | FreeBSD-src-fddfc9d5bb4c35d88417fa80a062219876186593.zip FreeBSD-src-fddfc9d5bb4c35d88417fa80a062219876186593.tar.gz |
Uncut&paste cache_lookup().
This unifies several times in theory indentical 50 lines of code.
The filesystems have a new method: vop_cachedlookup, which is the
meat of the lookup, and use vfs_cache_lookup() for their vop_lookup
method. vfs_cache_lookup() will check the namecache and pass on
to the vop_cachedlookup method in case of a miss.
It's still the task of the individual filesystems to populate the
namecache with cache_enter().
Filesystems that do not use the namecache will just provide the
vop_lookup method as usual.
Diffstat (limited to 'sys/isofs/cd9660')
-rw-r--r-- | sys/isofs/cd9660/cd9660_lookup.c | 56 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_node.h | 4 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vnops.c | 5 |
3 files changed, 7 insertions, 58 deletions
diff --git a/sys/isofs/cd9660/cd9660_lookup.c b/sys/isofs/cd9660/cd9660_lookup.c index 94fe78e..57393df 100644 --- a/sys/isofs/cd9660/cd9660_lookup.c +++ b/sys/isofs/cd9660/cd9660_lookup.c @@ -38,7 +38,7 @@ * from: @(#)ufs_lookup.c 7.33 (Berkeley) 5/19/91 * * @(#)cd9660_lookup.c 8.2 (Berkeley) 1/23/94 - * $Id: cd9660_lookup.c,v 1.15 1997/03/08 16:09:38 bde Exp $ + * $Id: cd9660_lookup.c,v 1.16 1997/08/02 14:31:18 bde Exp $ */ #include <sys/param.h> @@ -89,7 +89,7 @@ */ int cd9660_lookup(ap) - struct vop_lookup_args /* { + struct vop_cachedlookup_args /* { struct vnode *a_dvp; struct vnode **a_vpp; struct componentname *a_cnp; @@ -146,59 +146,7 @@ cd9660_lookup(ap) /* * We now have a segment name to search for, and a directory to search. - * - * Before tediously performing a linear scan of the directory, - * check the name cache to see if the directory/name pair - * we are looking for is known already. */ - if ((error = cache_lookup(vdp, vpp, cnp))) { - u_long vpid; /* capability number of vnode */ - - if (error == ENOENT) - return (error); -#ifdef PARANOID - if ((vdp->v_flag & VROOT) && (flags & ISDOTDOT)) - panic("cd9660_lookup: .. through root"); -#endif - /* - * Get the next vnode in the path. - * See comment below starting `Step through' for - * an explaination of the locking protocol. - */ - pdp = vdp; - dp = VTOI(*vpp); - vdp = *vpp; - vpid = vdp->v_id; - if (pdp == vdp) { - VREF(vdp); - error = 0; - } else if (flags & ISDOTDOT) { - VOP_UNLOCK(pdp, 0, p); - error = vget(vdp, LK_EXCLUSIVE, p); - if (!error && lockparent && (flags & ISLASTCN)) - error = vn_lock(pdp, LK_EXCLUSIVE, p); - } else { - error = vget(vdp, LK_EXCLUSIVE, p); - if (!lockparent || error || !(flags & ISLASTCN)) - VOP_UNLOCK(pdp, 0, p); - } - /* - * Check that the capability number did not change - * while we were waiting for the lock. - */ - if (!error) { - if (vpid == vdp->v_id) - return (0); - vput(vdp); - if (lockparent && pdp != vdp && (flags & ISLASTCN)) - VOP_UNLOCK(pdp, 0, p); - } - if (error = vn_lock(pdp, LK_EXCLUSIVE, p)) - return (error); - vdp = pdp; - dp = VTOI(pdp); - *vpp = NULL; - } len = cnp->cn_namelen; name = cnp->cn_nameptr; diff --git a/sys/isofs/cd9660/cd9660_node.h b/sys/isofs/cd9660/cd9660_node.h index bd010f4..a1ab0b1 100644 --- a/sys/isofs/cd9660/cd9660_node.h +++ b/sys/isofs/cd9660/cd9660_node.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_node.h 8.6 (Berkeley) 5/14/95 - * $Id: cd9660_node.h,v 1.10 1997/02/22 09:38:49 peter Exp $ + * $Id: cd9660_node.h,v 1.11 1997/04/14 18:15:45 phk Exp $ */ /* @@ -95,7 +95,7 @@ struct iso_node { /* * Prototypes for ISOFS vnode operations */ -int cd9660_lookup __P((struct vop_lookup_args *)); +int cd9660_lookup __P((struct vop_cachedlookup_args *)); int cd9660_inactive __P((struct vop_inactive_args *)); int cd9660_reclaim __P((struct vop_reclaim_args *)); int cd9660_bmap __P((struct vop_bmap_args *)); diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index e6f7dee..6a14c87 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95 - * $Id: cd9660_vnops.c,v 1.35 1997/04/15 08:05:08 bde Exp $ + * $Id: cd9660_vnops.c,v 1.36 1997/08/25 10:26:18 kato Exp $ */ #include <sys/param.h> @@ -1031,7 +1031,8 @@ vop_t **cd9660_vnodeop_p; struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = { { &vop_default_desc, (vop_t *)vn_default_error }, - { &vop_lookup_desc, (vop_t *)cd9660_lookup }, /* lookup */ + { &vop_lookup_desc, (vop_t *)vfs_cache_lookup }, /* lookup */ + { &vop_cachedlookup_desc, (vop_t *)cd9660_lookup }, /* lookup */ { &vop_create_desc, (vop_t *)cd9660_create }, /* create */ { &vop_mknod_desc, (vop_t *)cd9660_mknod }, /* mknod */ { &vop_open_desc, (vop_t *)cd9660_open }, /* open */ |