svn commit: r310766 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Thu Dec 29 08:34:52 UTC 2016


Author: mjg
Date: Thu Dec 29 08:34:50 2016
New Revision: 310766
URL: https://svnweb.freebsd.org/changeset/base/310766

Log:
  cache: drop the NULL check from VP2VNODELOCK
  
  Now that negative entries are annotated with a dedicated flag, NULL vnodes
  are no longer passed.

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c	Thu Dec 29 08:28:42 2016	(r310765)
+++ head/sys/kern/vfs_cache.c	Thu Dec 29 08:34:50 2016	(r310766)
@@ -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 celocksta
 	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);


More information about the svn-src-all mailing list