svn commit: r228315 - user/attilio/vmcontention/sys/fs/tmpfs

Attilio Rao attilio at FreeBSD.org
Wed Dec 7 00:07:57 UTC 2011


Author: attilio
Date: Wed Dec  7 00:07:57 2011
New Revision: 228315
URL: http://svn.freebsd.org/changeset/base/228315

Log:
  Fix tmpfs to build with vmcontention branch.

Modified:
  user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_fifoops.c
  user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_vnops.c

Modified: user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_fifoops.c
==============================================================================
--- user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_fifoops.c	Tue Dec  6 22:57:48 2011	(r228314)
+++ user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_fifoops.c	Wed Dec  7 00:07:57 2011	(r228315)
@@ -39,6 +39,7 @@
 #include <sys/param.h>
 #include <sys/filedesc.h>
 #include <sys/proc.h>
+#include <sys/systm.h>
 #include <sys/vnode.h>
 
 #include <vm/vm.h>

Modified: user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_vnops.c	Tue Dec  6 22:57:48 2011	(r228314)
+++ user/attilio/vmcontention/sys/fs/tmpfs/tmpfs_vnops.c	Wed Dec  7 00:07:57 2011	(r228315)
@@ -505,11 +505,14 @@ tmpfs_mappedread(vm_object_t vobj, vm_ob
 	offset = addr & PAGE_MASK;
 	tlen = MIN(PAGE_SIZE - offset, len);
 
-	if ((vobj == NULL) ||
-	    (vobj->resident_page_count == 0 && vobj->cache == NULL))
+	if (vobj == NULL)
 		goto nocache;
 
 	VM_OBJECT_LOCK(vobj);
+	if (vobj->cached_page_count == 0) {
+		VM_OBJECT_UNLOCK(vobj);
+		goto nocache;
+	}
 lookupvpg:
 	if (((m = vm_page_lookup(vobj, idx)) != NULL) &&
 	    vm_page_is_valid(m, offset, tlen)) {
@@ -633,13 +636,17 @@ tmpfs_mappedwrite(vm_object_t vobj, vm_o
 	offset = addr & PAGE_MASK;
 	tlen = MIN(PAGE_SIZE - offset, len);
 
-	if ((vobj == NULL) ||
-	    (vobj->resident_page_count == 0 && vobj->cache == NULL)) {
+	if (vobj == NULL) {
 		vpg = NULL;
 		goto nocache;
 	}
 
 	VM_OBJECT_LOCK(vobj);
+	if (vobj->cached_page_count == 0) {
+		VM_OBJECT_UNLOCK(vobj);
+		vpg = NULL;
+		goto nocache;
+	}
 lookupvpg:
 	if (((vpg = vm_page_lookup(vobj, idx)) != NULL) &&
 	    vm_page_is_valid(vpg, offset, tlen)) {
@@ -657,8 +664,6 @@ lookupvpg:
 		VM_OBJECT_UNLOCK(vobj);
 		error = uiomove_fromphys(&vpg, offset, tlen, uio);
 	} else {
-		if (__predict_false(vobj->cache != NULL))
-			vm_page_cache_free(vobj, idx, idx + 1);
 		VM_OBJECT_UNLOCK(vobj);
 		vpg = NULL;
 	}


More information about the svn-src-user mailing list