From 6dd9661b774ba6fb2bd3dbcc7afb5f3832fa88d9 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Thu, 29 Dec 2016 08:34:50 +0000 Subject: [PATCH] cache: drop the NULL check from VP2VNODELOCK Now that negative entries are annotated with a dedicated flag, NULL vnodes are no longer passed. --- sys/kern/vfs_cache.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 827a019b4abd..a4cc1cd57e9a 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -260,12 +260,8 @@ static struct mtx *vnodelocks; static inline struct mtx * VP2VNODELOCK(struct vnode *vp) { - struct mtx *vlp; - if (vp == NULL) - return (NULL); - vlp = &vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]; - return (vlp); + return (&vnodelocks[(((uintptr_t)(vp) >> 8) % numvnodelocks)]); } /* @@ -1373,10 +1369,9 @@ cache_lock_vnodes_cel_3(struct celockstate *cel, struct vnode *vp) cache_assert_vlp_locked(cel->vlp[0]); cache_assert_vlp_locked(cel->vlp[1]); MPASS(cel->vlp[2] == NULL); + MPASS(vp != NULL); vlp = VP2VNODELOCK(vp); - MPASS(vlp != NULL); - ret = true; if (vlp >= cel->vlp[1]) { mtx_lock(vlp);