Author: avg
Date: Sun Nov 28 12:26:15 2010
New Revision: 215995
URL: http://svn.freebsd.org/changeset/base/215995

Log:
  MFC r215401: zfs+sendfile: populate all requested pages, not just those
  already cached

Modified:
  stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==============================================================================
--- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 
28 11:02:18 2010        (r215994)
+++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Nov 
28 12:26:15 2010        (r215995)
@@ -67,6 +67,7 @@
 #include <sys/sf_buf.h>
 #include <sys/sched.h>
 #include <sys/acl.h>
+#include <vm/vm_pageout.h>
 
 /*
  * Programming rules.
@@ -464,7 +465,7 @@ again:
                                uiomove_fromphys(&m, off, bytes, uio);
                        VM_OBJECT_LOCK(obj);
                        vm_page_wakeup(m);
-               } else if (m != NULL && uio->uio_segflg == UIO_NOCOPY) {
+               } else if (uio->uio_segflg == UIO_NOCOPY) {
                        /*
                         * The code below is here to make sendfile(2) work
                         * correctly with ZFS. As pointed out by ups@
@@ -474,9 +475,19 @@ again:
                         */
                        KASSERT(off == 0,
                            ("unexpected offset in mappedread for sendfile"));
-                       if (vm_page_sleep_if_busy(m, FALSE, "zfsmrb"))
+                       if (m != NULL && vm_page_sleep_if_busy(m, FALSE, 
"zfsmrb"))
                                goto again;
-                       vm_page_busy(m);
+                       if (m == NULL) {
+                               m = vm_page_alloc(obj, OFF_TO_IDX(start),
+                                   VM_ALLOC_NOBUSY | VM_ALLOC_NORMAL);
+                               if (m == NULL) {
+                                       VM_OBJECT_UNLOCK(obj);
+                                       VM_WAIT;
+                                       VM_OBJECT_LOCK(obj);
+                                       goto again;
+                               }
+                       }
+                       vm_page_io_start(m);
                        VM_OBJECT_UNLOCK(obj);
                        if (dirbytes > 0) {
                                error = dmu_read_uio(os, zp->z_id, uio,
@@ -494,7 +505,7 @@ again:
                        VM_OBJECT_LOCK(obj);
                        if (error == 0)
                                m->valid = VM_PAGE_BITS_ALL;
-                       vm_page_wakeup(m);
+                       vm_page_io_finish(m);
                        if (error == 0) {
                                uio->uio_resid -= bytes;
                                uio->uio_offset += bytes;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to