Page MenuHomeFreeBSD

D22760.diff
No OneTemporary

D22760.diff

Index: head/sys/vm/vm_map.c
===================================================================
--- head/sys/vm/vm_map.c
+++ head/sys/vm/vm_map.c
@@ -2291,6 +2291,42 @@
}
/*
+ * vm_map_entry_clone
+ *
+ * Create a duplicate map entry for clipping.
+ */
+static vm_map_entry_t
+vm_map_entry_clone(vm_map_t map, vm_map_entry_t entry)
+{
+ vm_map_entry_t new_entry;
+
+ VM_MAP_ASSERT_LOCKED(map);
+
+ /*
+ * Create a backing object now, if none exists, so that more individual
+ * objects won't be created after the map entry is split.
+ */
+ vm_map_entry_charge_object(map, entry);
+
+ /* Clone the entry. */
+ new_entry = vm_map_entry_create(map);
+ *new_entry = *entry;
+ if (new_entry->cred != NULL)
+ crhold(entry->cred);
+ if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) {
+ vm_object_reference(new_entry->object.vm_object);
+ vm_map_entry_set_vnode_text(new_entry, true);
+ /*
+ * The object->un_pager.vnp.writemappings for the object of
+ * MAP_ENTRY_WRITECNT type entry shall be kept as is here. The
+ * virtual pages are re-distributed among the clipped entries,
+ * so the sum is left the same.
+ */
+ }
+ return (new_entry);
+}
+
+/*
* vm_map_clip_start: [ internal use only ]
*
* Asserts that the given entry begins at or after
@@ -2316,16 +2352,8 @@
KASSERT(entry->end > start && entry->start < start,
("_vm_map_clip_start: invalid clip of entry %p", entry));
- /*
- * Create a backing object now, if none exists, so that more individual
- * objects won't be created after the map entry is split.
- */
- vm_map_entry_charge_object(map, entry);
+ new_entry = vm_map_entry_clone(map, entry);
- /* Clone the entry. */
- new_entry = vm_map_entry_create(map);
- *new_entry = *entry;
-
/*
* Split off the front portion. Insert the new entry BEFORE this one,
* so that this entry has the specified starting address.
@@ -2333,22 +2361,7 @@
new_entry->end = start;
entry->offset += (start - entry->start);
entry->start = start;
- if (new_entry->cred != NULL)
- crhold(entry->cred);
-
vm_map_entry_link(map, new_entry);
-
- if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) {
- vm_object_reference(new_entry->object.vm_object);
- vm_map_entry_set_vnode_text(new_entry, true);
- /*
- * The object->un_pager.vnp.writemappings for the
- * object of MAP_ENTRY_WRITECNT type entry shall be
- * kept as is here. The virtual pages are
- * re-distributed among the clipped entries, so the sum is
- * left the same.
- */
- }
}
/*
@@ -2377,31 +2390,15 @@
KASSERT(entry->start < end && entry->end > end,
("_vm_map_clip_end: invalid clip of entry %p", entry));
- /*
- * Create a backing object now, if none exists, so that more individual
- * objects won't be created after the map entry is split.
- */
- vm_map_entry_charge_object(map, entry);
+ new_entry = vm_map_entry_clone(map, entry);
- /* Clone the entry. */
- new_entry = vm_map_entry_create(map);
- *new_entry = *entry;
-
/*
* Split off the back portion. Insert the new entry AFTER this one,
* so that this entry has the specified ending address.
*/
new_entry->start = entry->end = end;
new_entry->offset += (end - entry->start);
- if (new_entry->cred != NULL)
- crhold(entry->cred);
-
vm_map_entry_link(map, new_entry);
-
- if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) {
- vm_object_reference(new_entry->object.vm_object);
- vm_map_entry_set_vnode_text(new_entry, true);
- }
}
/*

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 1:18 PM (21 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14698327
Default Alt Text
D22760.diff (3 KB)

Event Timeline