Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2011 21:49:24 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218304 - head/sys/vm
Message-ID:  <201102042149.p14LnOTS003264@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Fri Feb  4 21:49:24 2011
New Revision: 218304
URL: http://svn.freebsd.org/changeset/base/218304

Log:
  Since the last parameter to vm_object_shadow() is a vm_size_t and not a
  vm_pindex_t, it makes no sense for its callers to perform atop().  Let
  vm_object_shadow() do that instead.

Modified:
  head/sys/vm/vm_map.c
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Fri Feb  4 21:04:00 2011	(r218303)
+++ head/sys/vm/vm_map.c	Fri Feb  4 21:49:24 2011	(r218304)
@@ -3077,8 +3077,8 @@ vmspace_fork(struct vmspace *vm1, vm_oof
 			vm_object_reference(object);
 			if (old_entry->eflags & MAP_ENTRY_NEEDS_COPY) {
 				vm_object_shadow(&old_entry->object.vm_object,
-					&old_entry->offset,
-					atop(old_entry->end - old_entry->start));
+				    &old_entry->offset,
+				    old_entry->end - old_entry->start);
 				old_entry->eflags &= ~MAP_ENTRY_NEEDS_COPY;
 				/* Transfer the second reference too. */
 				vm_object_reference(
@@ -3589,8 +3589,8 @@ vm_map_lookup(vm_map_t *var_map,		/* IN/
 	vm_prot_t prot;
 	vm_prot_t fault_type = fault_typea;
 	vm_object_t eobject;
+	vm_size_t size;
 	struct ucred *cred;
-	vm_ooffset_t size;
 
 RetryLookup:;
 
@@ -3677,10 +3677,8 @@ RetryLookup:;
 				}
 				entry->cred = cred;
 			}
-			vm_object_shadow(
-			    &entry->object.vm_object,
-			    &entry->offset,
-			    atop(size));
+			vm_object_shadow(&entry->object.vm_object,
+			    &entry->offset, size);
 			entry->eflags &= ~MAP_ENTRY_NEEDS_COPY;
 			eobject = entry->object.vm_object;
 			if (eobject->cred != NULL) {

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c	Fri Feb  4 21:04:00 2011	(r218303)
+++ head/sys/vm/vm_object.c	Fri Feb  4 21:49:24 2011	(r218304)
@@ -1147,7 +1147,7 @@ vm_object_shadow(
 	/*
 	 * Allocate a new object with the given length.
 	 */
-	result = vm_object_allocate(OBJT_DEFAULT, length);
+	result = vm_object_allocate(OBJT_DEFAULT, atop(length));
 
 	/*
 	 * The new object shadows the source object, adding a reference to it.



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