summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2003-03-06 03:41:02 +0000
committeralc <alc@FreeBSD.org>2003-03-06 03:41:02 +0000
commitc50367da676eaa300253058b5594f783a3db948b (patch)
tree333a33c08a22ccf64aa091f047218641fdbb343a /sys/vm/vm_map.c
parent9ecf925a7d952716f0fd6c5a64b072a3caee80af (diff)
downloadFreeBSD-src-c50367da676eaa300253058b5594f783a3db948b.zip
FreeBSD-src-c50367da676eaa300253058b5594f783a3db948b.tar.gz
Remove ENABLE_VFS_IOOPT. It is a long unfinished work-in-progress.
Discussed on: arch@
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c249
1 files changed, 0 insertions, 249 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index cd3b2e7..33e819d 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -2879,255 +2879,6 @@ vm_map_lookup_done(vm_map_t map, vm_map_entry_t entry)
vm_map_unlock_read(map);
}
-#ifdef ENABLE_VFS_IOOPT
-/*
- * Experimental support for zero-copy I/O
- *
- * Implement uiomove with VM operations. This handles (and collateral changes)
- * support every combination of source object modification, and COW type
- * operations.
- */
-int
-vm_uiomove(
- vm_map_t mapa,
- vm_object_t srcobject,
- off_t cp,
- int cnta,
- vm_offset_t uaddra,
- int *npages)
-{
- vm_map_t map;
- vm_object_t first_object, oldobject, object;
- vm_map_entry_t entry;
- vm_prot_t prot;
- boolean_t wired;
- int tcnt, rv;
- vm_offset_t uaddr, start, end, tend;
- vm_pindex_t first_pindex, oindex;
- vm_size_t osize;
- off_t ooffset;
- int cnt;
-
- GIANT_REQUIRED;
-
- if (npages)
- *npages = 0;
-
- cnt = cnta;
- uaddr = uaddra;
-
- while (cnt > 0) {
- map = mapa;
-
- if ((vm_map_lookup(&map, uaddr,
- VM_PROT_READ, &entry, &first_object,
- &first_pindex, &prot, &wired)) != KERN_SUCCESS) {
- return EFAULT;
- }
-
- vm_map_clip_start(map, entry, uaddr);
-
- tcnt = cnt;
- tend = uaddr + tcnt;
- if (tend > entry->end) {
- tcnt = entry->end - uaddr;
- tend = entry->end;
- }
-
- vm_map_clip_end(map, entry, tend);
-
- start = entry->start;
- end = entry->end;
-
- osize = atop(tcnt);
-
- oindex = OFF_TO_IDX(cp);
- if (npages) {
- vm_size_t idx;
- for (idx = 0; idx < osize; idx++) {
- vm_page_t m;
- if ((m = vm_page_lookup(srcobject, oindex + idx)) == NULL) {
- vm_map_lookup_done(map, entry);
- return 0;
- }
- /*
- * disallow busy or invalid pages, but allow
- * m->busy pages if they are entirely valid.
- */
- if ((m->flags & PG_BUSY) ||
- ((m->valid & VM_PAGE_BITS_ALL) != VM_PAGE_BITS_ALL)) {
- vm_map_lookup_done(map, entry);
- return 0;
- }
- }
- }
-
-/*
- * If we are changing an existing map entry, just redirect
- * the object, and change mappings.
- */
- if ((first_object->type == OBJT_VNODE) &&
- ((oldobject = entry->object.vm_object) == first_object)) {
-
- if ((entry->offset != cp) || (oldobject != srcobject)) {
- /*
- * Remove old window into the file
- */
- vm_page_lock_queues();
- pmap_remove(map->pmap, uaddr, tend);
- vm_page_unlock_queues();
-
- /*
- * Force copy on write for mmaped regions
- */
- vm_object_pmap_copy_1 (srcobject, oindex, oindex + osize);
-
- /*
- * Point the object appropriately
- */
- if (oldobject != srcobject) {
-
- /*
- * Set the object optimization hint flag
- */
- vm_object_set_flag(srcobject, OBJ_OPT);
- vm_object_reference(srcobject);
- entry->object.vm_object = srcobject;
-
- if (oldobject) {
- vm_object_deallocate(oldobject);
- }
- }
-
- entry->offset = cp;
- map->timestamp++;
- } else {
- vm_page_lock_queues();
- pmap_remove(map->pmap, uaddr, tend);
- vm_page_unlock_queues();
- }
-
- } else if ((first_object->ref_count == 1) &&
- (first_object->size == osize) &&
- ((first_object->type == OBJT_DEFAULT) ||
- (first_object->type == OBJT_SWAP)) ) {
-
- oldobject = first_object->backing_object;
-
- if ((first_object->backing_object_offset != cp) ||
- (oldobject != srcobject)) {
- /*
- * Remove old window into the file
- */
- vm_page_lock_queues();
- pmap_remove(map->pmap, uaddr, tend);
- vm_page_unlock_queues();
-
- /*
- * Remove unneeded old pages
- */
- vm_object_lock(first_object);
- vm_object_page_remove(first_object, 0, 0, 0);
- vm_object_unlock(first_object);
-
- /*
- * Invalidate swap space
- */
- if (first_object->type == OBJT_SWAP) {
- swap_pager_freespace(first_object,
- 0,
- first_object->size);
- }
-
- /*
- * Force copy on write for mmaped regions
- */
- vm_object_pmap_copy_1 (srcobject, oindex, oindex + osize);
-
- /*
- * Point the object appropriately
- */
- if (oldobject != srcobject) {
- /*
- * Set the object optimization hint flag
- */
- vm_object_set_flag(srcobject, OBJ_OPT);
- vm_object_reference(srcobject);
-
- if (oldobject) {
- TAILQ_REMOVE(&oldobject->shadow_head,
- first_object, shadow_list);
- oldobject->shadow_count--;
- /* XXX bump generation? */
- vm_object_deallocate(oldobject);
- }
-
- TAILQ_INSERT_TAIL(&srcobject->shadow_head,
- first_object, shadow_list);
- srcobject->shadow_count++;
- /* XXX bump generation? */
-
- first_object->backing_object = srcobject;
- }
- first_object->backing_object_offset = cp;
- map->timestamp++;
- } else {
- vm_page_lock_queues();
- pmap_remove(map->pmap, uaddr, tend);
- vm_page_unlock_queues();
- }
-/*
- * Otherwise, we have to do a logical mmap.
- */
- } else {
-
- vm_object_set_flag(srcobject, OBJ_OPT);
- vm_object_reference(srcobject);
-
- vm_page_lock_queues();
- pmap_remove(map->pmap, uaddr, tend);
- vm_page_unlock_queues();
-
- vm_object_pmap_copy_1 (srcobject, oindex, oindex + osize);
- vm_map_lock_upgrade(map);
-
- if (entry == &map->header) {
- map->first_free = &map->header;
- } else if (map->first_free->start >= start) {
- map->first_free = entry->prev;
- }
-
- vm_map_entry_delete(map, entry);
-
- object = srcobject;
- ooffset = cp;
-
- rv = vm_map_insert(map, object, ooffset, start, tend,
- VM_PROT_ALL, VM_PROT_ALL, MAP_COPY_ON_WRITE);
-
- if (rv != KERN_SUCCESS)
- panic("vm_uiomove: could not insert new entry: %d", rv);
- }
-
-/*
- * Map the window directly, if it is already in memory
- */
- pmap_object_init_pt(map->pmap, uaddr,
- srcobject, oindex, tcnt, 0);
-
- map->timestamp++;
- vm_map_unlock(map);
-
- cnt -= tcnt;
- uaddr += tcnt;
- cp += tcnt;
- if (npages)
- *npages += osize;
- }
- return 0;
-}
-#endif
-
#include "opt_ddb.h"
#ifdef DDB
#include <sys/kernel.h>
OpenPOWER on IntegriCloud