PERFORCE change 200538 for review

John Baldwin jhb at FreeBSD.org
Fri Oct 21 19:25:54 UTC 2011


http://p4web.freebsd.org/@@200538?ac=10

Change 200538 by jhb at jhb_jhbbsd on 2011/10/21 19:25:05

	Drop the default FADV_WILLNEED implementation as it doesn't
	really work and marking any pages that happen to be in RAM as
	active isn't really the right approach either.  Instead, punt
	and require each FS to implement this.

Affected files ...

.. //depot/projects/fadvise/sys/kern/vfs_default.c#3 edit

Differences ...

==== //depot/projects/fadvise/sys/kern/vfs_default.c#3 (text+ko) ====

@@ -46,7 +46,6 @@
 #include <sys/lock.h>
 #include <sys/lockf.h>
 #include <sys/malloc.h>
-#include <sys/mman.h>
 #include <sys/mount.h>
 #include <sys/mutex.h>
 #include <sys/namei.h>
@@ -997,20 +996,10 @@
 	switch (ap->a_advice) {
 	case FADV_WILLNEED:
 		/*
-		 * Apply the request to the backing VM object.
-		 *
-		 * XXX: madvise(MADV_WILLNEED) will not do readahead on
-		 * a file, perhaps FADV_WILLNEED should.
+		 * Do nothing for now.  Filesystems should provide a
+		 * custom method which starts an asynchronous read of
+		 * the requested region.
 		 */
-		start = trunc_page(ap->a_start);
-		end = round_page(ap->a_end);
-		vfslocked = VFS_LOCK_GIANT(vp->v_mount);
-		vn_lock(vp, LK_SHARED | LK_RETRY);
-		if (vp->v_object != NULL)
-			vm_object_madvise(vp->v_object, OFF_TO_IDX(start),
-			    atop(end - start), MADV_WILLNEED);
-		VOP_UNLOCK(vp, 0);
-		VFS_UNLOCK_GIANT(vfslocked);
 		error = 0;
 		break;
 	case FADV_DONTNEED:


More information about the p4-projects mailing list