Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jun 2014 19:01:38 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267239 - head/sys/kern
Message-ID:  <201406081901.s58J1cJg061476@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Jun  8 19:01:37 2014
New Revision: 267239
URL: http://svnweb.freebsd.org/changeset/base/267239

Log:
  Remove extra branching from r267232.
  
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sun Jun  8 18:11:53 2014	(r267238)
+++ head/sys/kern/vfs_subr.c	Sun Jun  8 19:01:37 2014	(r267239)
@@ -995,18 +995,14 @@ void
 getnewvnode_reserve(u_int count)
 {
 	struct thread *td;
-	long num;
 
 	td = curthread;
 	/* First try to be quick and racy. */
-	if (numvnodes + count <= desiredvnodes) {
-		num = atomic_fetchadd_long(&numvnodes, count);
-		if (num + count <= desiredvnodes) {
-			td->td_vp_reserv += count;
-			return;
-		} else
-			atomic_subtract_long(&numvnodes, count);
-	}
+	if (atomic_fetchadd_long(&numvnodes, count) + count <= desiredvnodes) {
+		td->td_vp_reserv += count;
+		return;
+	} else
+		atomic_subtract_long(&numvnodes, count);
 
 	mtx_lock(&vnode_free_list_mtx);
 	while (count > 0) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406081901.s58J1cJg061476>