From 8f55a87473b33436bc4486539ea23dd6fd4924fd Mon Sep 17 00:00:00 2001 From: kib Date: Sat, 29 Oct 2016 18:03:29 +0000 Subject: [PATCH] Add unlock_vp() helper. Trim space. Discussed with: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/vm/vm_fault.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 03c68dd23cba..ebaa56e0d4f5 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -152,6 +152,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) 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 @@ RetryFault:; 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)