summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/vm/vm_mmap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index 1721fd3e1bac..bb106f3d0094 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -1024,6 +1024,13 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
return (error);
objsize = round_page(vat.va_size);
type = OBJT_VNODE;
+ /*
+ * if it is a regular file without any references
+ * we do not need to sync it.
+ */
+ if (vp->v_type == VREG && vat.va_nlink == 0) {
+ flags |= MAP_NOSYNC;
+ }
}
}