From 3345d73ca8033de27169a478810f39a7a8f161ec Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Sun, 8 Jun 2014 19:01:37 +0000 Subject: [PATCH] Remove extra branching from r267232. MFC after: 2 weeks --- sys/kern/vfs_subr.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 4b73cefd0def..95f593bb9009 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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) {