diff options
author | jeff <jeff@FreeBSD.org> | 2005-03-14 07:16:55 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2005-03-14 07:16:55 +0000 |
commit | bb63517e7e0f7af6a62d67c01c83cb9c5cb2f8f7 (patch) | |
tree | b86afcbd42fa50b026f4e046262eb3fde47dacdf /sys/kern/vfs_subr.c | |
parent | a307ec6ef809153ac619d169f0bf6680db24e4ea (diff) | |
download | FreeBSD-src-bb63517e7e0f7af6a62d67c01c83cb9c5cb2f8f7.zip FreeBSD-src-bb63517e7e0f7af6a62d67c01c83cb9c5cb2f8f7.tar.gz |
- Slightly rearrange vrele() to move the common case in one indentation
level.
Sponsored by: Isilon Systems, Inc.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 94dee20..fa0a62e 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1912,32 +1912,29 @@ vrele(vp) return; } - - if (vp->v_usecount == 1) { - v_incr_usecount(vp, -1); - /* - * We must call VOP_INACTIVE with the node locked. Mark - * as VI_DOINGINACT to avoid recursion. - */ - if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, td) == 0) { - VI_LOCK(vp); - vinactive(vp, td); - VOP_UNLOCK(vp, 0, td); - } else - VI_LOCK(vp); - if (VSHOULDFREE(vp)) - vfree(vp); - else - vlruvp(vp); - VI_UNLOCK(vp); - - } else { + if (vp->v_usecount != 1) { #ifdef DIAGNOSTIC vprint("vrele: negative ref count", vp); #endif VI_UNLOCK(vp); panic("vrele: negative ref cnt"); } + v_incr_usecount(vp, -1); + /* + * We must call VOP_INACTIVE with the node locked. Mark + * as VI_DOINGINACT to avoid recursion. + */ + if (vn_lock(vp, LK_EXCLUSIVE | LK_INTERLOCK, td) == 0) { + VI_LOCK(vp); + vinactive(vp, td); + VOP_UNLOCK(vp, 0, td); + } else + VI_LOCK(vp); + if (VSHOULDFREE(vp)) + vfree(vp); + else + vlruvp(vp); + VI_UNLOCK(vp); } /* |