From 124bf5e823dfe2ddde94c57660a3beffc2f99b57 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 15 Mar 2005 08:07:07 +0000 Subject: Simplify the vfs_hash calling convention. --- sys/fs/cd9660/cd9660_vfsops.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'sys/fs/cd9660') diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index bcbcae8..169df65 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -662,10 +662,8 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) int error; error = vfs_hash_get(mp, ino, flags, curthread, vpp); - if (error) + if (error || *vpp != NULL) return (error); - if (*vpp != NULL) - return (0); imp = VFSTOISOFS(mp); dev = imp->im_dev; @@ -682,30 +680,12 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) ip->i_dev = dev; ip->i_number = ino; - /* - * Exclusively lock the vnode before adding to hash. Note, that we - * must not release nor downgrade the lock (despite flags argument - * says) till it is fully initialized. - */ - lockmgr(vp->v_vnlock, LK_EXCLUSIVE, (struct mtx *)0, curthread); - - /* - * Atomicaly (in terms of vfs_hash operations) check the hash for - * duplicate of vnode being created and add it to the hash. If a - * duplicate vnode was found, it will be vget()ed from hash for us. - */ - if ((error = vfs_hash_insert(vp, ino, flags, curthread, vpp)) != 0) { + error = vfs_hash_insert(vp, ino, flags, curthread, vpp); + if (error || *vpp != NULL) { vput(vp); - *vpp = NULL; return (error); } - /* We lost the race, then throw away our vnode and return existing */ - if (*vpp != NULL) { - vput(vp); - return (0); - } - if (isodir == 0) { int lbn, off; -- cgit v1.1