svn commit: r312602 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Sat Jan 21 19:01:44 UTC 2017


Author: mjg
Date: Sat Jan 21 19:01:42 2017
New Revision: 312602
URL: https://svnweb.freebsd.org/changeset/base/312602

Log:
  vfs: __predict_false the need to handle F_HASLOCK
  
  Also reorder the check with DTYPE_VNODE. Passed files are vnodes vast
  majority of the time, so it is typically true.

Modified:
  head/sys/kern/vfs_vnops.c

Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c	Sat Jan 21 18:56:58 2017	(r312601)
+++ head/sys/kern/vfs_vnops.c	Sat Jan 21 19:01:42 2017	(r312602)
@@ -1575,12 +1575,12 @@ vn_closefile(fp, td)
 	vp = fp->f_vnode;
 	fp->f_ops = &badfileops;
 
-	if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK)
-		vref(vp);
+	if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE)
+		vrefact(vp);
 
 	error = vn_close(vp, fp->f_flag, fp->f_cred, td);
 
-	if (fp->f_type == DTYPE_VNODE && fp->f_flag & FHASLOCK) {
+	if (__predict_false(fp->f_flag & FHASLOCK) && fp->f_type == DTYPE_VNODE) {
 		lf.l_whence = SEEK_SET;
 		lf.l_start = 0;
 		lf.l_len = 0;


More information about the svn-src-head mailing list