diff options
author | phk <phk@FreeBSD.org> | 2005-03-15 08:07:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2005-03-15 08:07:07 +0000 |
commit | 124bf5e823dfe2ddde94c57660a3beffc2f99b57 (patch) | |
tree | 222a537cdd030d8083d8dae9e650ae3be7de0573 /sys/gnu | |
parent | a7b3bd456408d157545ff8c8ffd7060ae2070886 (diff) | |
download | FreeBSD-src-124bf5e823dfe2ddde94c57660a3beffc2f99b57.zip FreeBSD-src-124bf5e823dfe2ddde94c57660a3beffc2f99b57.tar.gz |
Simplify the vfs_hash calling convention.
Diffstat (limited to 'sys/gnu')
-rw-r--r-- | sys/gnu/ext2fs/ext2_vfsops.c | 26 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 26 |
2 files changed, 6 insertions, 46 deletions
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index 81787f8..5c2fed4 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -916,10 +916,8 @@ ext2_vget(mp, ino, flags, vpp) int used_blocks; error = vfs_hash_get(mp, ino, flags, curthread, vpp); - if (error) + if (error || *vpp != NULL) return (error); - if (*vpp != NULL) - return (0); ump = VFSTOEXT2(mp); dev = ump->um_dev; @@ -945,30 +943,12 @@ ext2_vget(mp, ino, flags, vpp) 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); - } - /* Read in the disk contents for the inode, copy into the inode. */ #if 0 printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino))); diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index 81787f8..5c2fed4 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -916,10 +916,8 @@ ext2_vget(mp, ino, flags, vpp) int used_blocks; error = vfs_hash_get(mp, ino, flags, curthread, vpp); - if (error) + if (error || *vpp != NULL) return (error); - if (*vpp != NULL) - return (0); ump = VFSTOEXT2(mp); dev = ump->um_dev; @@ -945,30 +943,12 @@ ext2_vget(mp, ino, flags, vpp) 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); - } - /* Read in the disk contents for the inode, copy into the inode. */ #if 0 printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino))); |