Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Oct 2016 18:03:29 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308094 - head/sys/vm
Message-ID:  <201610291803.u9TI3Ti0013037@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sat Oct 29 18:03:29 2016
New Revision: 308094
URL: https://svnweb.freebsd.org/changeset/base/308094

Log:
  Add unlock_vp() helper.
  Trim space.
  
  Discussed with:	alc
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Sat Oct 29 16:31:16 2016	(r308093)
+++ head/sys/vm/vm_fault.c	Sat Oct 29 18:03:29 2016	(r308094)
@@ -153,6 +153,16 @@ unlock_map(struct faultstate *fs)
 }
 
 static void
+unlock_vp(struct faultstate *fs)
+{
+
+	if (fs->vp != NULL) {
+		vput(fs->vp);
+		fs->vp = NULL;
+	}
+}
+
+static void
 unlock_and_deallocate(struct faultstate *fs)
 {
 
@@ -168,11 +178,8 @@ unlock_and_deallocate(struct faultstate 
 		fs->first_m = NULL;
 	}
 	vm_object_deallocate(fs->first_object);
-	unlock_map(fs);	
-	if (fs->vp != NULL) { 
-		vput(fs->vp);
-		fs->vp = NULL;
-	}
+	unlock_map(fs);
+	unlock_vp(fs);
 }
 
 static void
@@ -339,10 +346,7 @@ RetryFault:;
 		vm_map_lock(fs.map);
 		if (vm_map_lookup_entry(fs.map, vaddr, &fs.entry) &&
 		    (fs.entry->eflags & MAP_ENTRY_IN_TRANSITION)) {
-			if (fs.vp != NULL) {
-				vput(fs.vp);
-				fs.vp = NULL;
-			}
+			unlock_vp(&fs);
 			fs.entry->eflags |= MAP_ENTRY_NEEDS_WAKEUP;
 			vm_map_unlock_and_wait(fs.map, 0);
 		} else
@@ -642,10 +646,7 @@ readrest:
 				vp = fs.object->handle;
 				if (vp == fs.vp)
 					goto vnode_locked;
-				else if (fs.vp != NULL) {
-					vput(fs.vp);
-					fs.vp = NULL;
-				}
+				unlock_vp(&fs);
 				locked = VOP_ISLOCKED(vp);
 
 				if (locked != LK_EXCLUSIVE)



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