From 4a2eca23cad9d40a1fada75edcfa78e2cbb3c34f Mon Sep 17 00:00:00 2001 From: "Matthew N. Dodd" Date: Sun, 22 Sep 2002 08:22:32 +0000 Subject: [PATCH] Modify vm_map_clean() (and thus the msync(2) system call) to support invalidation of cached pages for objects of type OBJT_DEVICE. Submitted by: Christian Zander Approved by: alc --- sys/vm/vm_map.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 386acbcccb6..f28271dc29b 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1920,16 +1920,19 @@ vm_map_clean( OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); - if (invalidate) { - /*vm_object_pip_wait(object, "objmcl");*/ - vm_object_page_remove(object, - OFF_TO_IDX(offset), - OFF_TO_IDX(offset + size + PAGE_MASK), - FALSE); - } VOP_UNLOCK(object->handle, 0, curthread); vm_object_deallocate(object); } + if (object && invalidate && + ((object->type == OBJT_VNODE) || + (object->type == OBJT_DEVICE))) { + vm_object_reference(object); + vm_object_page_remove(object, + OFF_TO_IDX(offset), + OFF_TO_IDX(offset + size + PAGE_MASK), + FALSE); + vm_object_deallocate(object); + } start += size; }